Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1073460 - Make alias Consolas displaying DejaVu Sans Mono
Make alias Consolas displaying DejaVu Sans Mono
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: fontconfig (Show other bugs)
7.0
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Akira TAGOH
Desktop QE
:
Depends On:
Blocks: 1295396 1297830 1313485
  Show dependency treegraph
 
Reported: 2014-03-06 08:26 EST by Matěj Cepl
Modified: 2016-11-03 17:18 EDT (History)
5 users (show)

See Also:
Fixed In Version: fontconfig-2.10.95-8.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-03 17:18:19 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
before (217.91 KB, image/png)
2014-03-07 12:49 EST, Matěj Cepl
no flags Details
after (222.42 KB, image/png)
2014-03-07 12:49 EST, Matěj Cepl
no flags Details
original presentation (827.14 KB, application/vnd.ms-powerpoint)
2016-01-05 05:08 EST, Matěj Cepl
no flags Details
export to PDF (642.67 KB, application/pdf)
2016-01-05 06:19 EST, Matěj Cepl
no flags Details
proposed changes to 45-latin.conf (7.43 KB, application/mbox)
2016-05-25 00:11 EDT, Akira TAGOH
no flags Details
.rej file when applying the patch (2.92 KB, patch)
2016-06-07 09:24 EDT, Matěj Cepl
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2601 normal SHIPPED_LIVE Moderate: fontconfig security and bug fix update 2016-11-03 08:12:37 EDT

  None (edit)
Description Matěj Cepl 2014-03-06 08:26:25 EST
Description of problem:
Try to open some PowerPoint presentation using Consolas font for code (e.g. http://www.slideshare.net/migueldeicaza/monkey-space-2013).

Version-Release number of selected component (if applicable):
dejavu-sans-mono-fonts-2.33-6.el7

How reproducible:
100%

Steps to Reproduce:
1.see above
2.
3.

Actual results:
code examples looks ugly

Expected results:
we should use some good replacement for Consolas font

Additional info:
With this trivial /etc/fonts/local.conf I have Impress using DejaVu Sans Mono which looks a way better:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
       <alias binding="same">
         <family>Consolas</family>
         <accept>
         <family>DejaVu Sans Mono</family>
         </accept>
       </alias>
</fontconfig>
Comment 2 Jens Petersen 2014-03-06 20:41:28 EST
Could you attach a screenshot (for before and after too if you like)
just to make sure we're looking at the same thing.
You mean for example slide 29, etc?

I didn't try your .conf file yet...
Though the slides don't look that bad to me
your idea still might make sense perhaps,
but I don't know if dejavu mono is the best fit to Consolas.
Anyway I feel it would be better to do such a change first
in Fedora, so you might want to report the bug there first.
Comment 3 Matěj Cepl 2014-03-07 12:49:11 EST
Created attachment 871971 [details]
before
Comment 4 Matěj Cepl 2014-03-07 12:49:35 EST
Created attachment 871973 [details]
after
Comment 5 Matěj Cepl 2014-03-07 12:51:09 EST
(In reply to Jens Petersen from comment #2)
> Could you attach a screenshot (for before and after too if you like)
> just to make sure we're looking at the same thing.
> You mean for example slide 29, etc?

And yes, slide 29 is the same thing ... basically anywhere a snippet of the code shows up.
Comment 6 Matěj Cepl 2014-03-07 14:09:54 EST
(In reply to Jens Petersen from comment #2)
> Anyway I feel it would be better to do such a change first
> in Fedora, so you might want to report the bug there first.

It certainly should be fixed in Fedora as well, but I believe this is very simple just a configuration fix, and it would serve our enterprise customers as well.
Comment 7 RHEL Product and Program Management 2014-03-22 01:51:07 EDT
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.
Comment 10 Akira TAGOH 2015-12-08 05:37:35 EST
dunno what font was actually used in "before" screenshot though, that looks like font was rendered with wrong hinting. in Fedora, we have a policy to have a separate configuration files for fontconfig per fonts and inherited into RHEL as well, it should be fixed in that font package IMHO (not to have an alias for consolas but proper hinting to have better looks). aside from that having all of aliases into fontconfig is difficult. if it isn't for a font we are packaging, you better do that in your local config as you did as a workaround.

(In reply to Jens Petersen from comment #2)
> but I don't know if dejavu mono is the best fit to Consolas.

me meither. so if we really need to fix this in fontconfig anyway, I would propose to have an alias for consolas to monospace but not to a specific font.
Comment 11 Jens Petersen 2016-01-05 02:08:06 EST
Matěj, could you determine which font was used in the 'before' screenshot?
Comment 12 Matěj Cepl 2016-01-05 05:08 EST
Created attachment 1111777 [details]
original presentation

Just for the sake of completness
Comment 13 Matěj Cepl 2016-01-05 06:19 EST
Created attachment 1111801 [details]
export to PDF

(In reply to Jens Petersen from comment #11)
> Matěj, could you determine which font was used in the 'before' screenshot?

OK, after uninstalling all my third-party fonts I got to point where I can reproduce it.

There are two lines of attack:

1) exported PDF manifests exactly the same behavior to me (see attached),
2) according to LO developers, there is no way how to find out the substituted font used, but it is actually rather easy with fc-match:

~$ fc-match Consolas
DejaVuSans.ttf: "DejaVu Sans" "Book"
~$

Which is obviously a wrong idea for the monospace font.
Comment 14 Akira TAGOH 2016-01-05 21:29:45 EST
That is because fontconfig adds sans-serif into the font pattern as a last resort to find out a better font if it doesn't contain generic aliases such as sans-serif, serif, or monospace.

As I said earlier, supporting all of fonts in fontconfig is difficult and maybe not realistic. IMHO ideally applications which generate documentations should adds a proper fallback too because they should know what it is. so we can avoid the endless complaints like this...
Comment 15 Jens Petersen 2016-01-05 22:10:12 EST
Is this better in Fedora 23 say (with LiberOffice 5)?
Comment 16 Matěj Cepl 2016-01-06 10:20:33 EST
(In reply to Jens Petersen from comment #15)
> Is this better in Fedora 23 say (with LiberOffice 5)?

I don't have any Fedora around and the internal CSB repo of LO still has only libreoffice-impress-4.4.7.2-2.el7.csb.x86_64
Comment 17 Matěj Cepl 2016-01-06 10:22:27 EST
(In reply to Akira TAGOH from comment #14)
> As I said earlier, supporting all of fonts in fontconfig is difficult and
> maybe not realistic.

I am not talking about ALL fonts, just the most well-known ones. We already support Adobe basic fonts (e.g., Times), so I propose just adding the Microsoft ones as well (whatever is freely provided with MS Office or MS Windows).
Comment 19 Akira TAGOH 2016-02-02 06:12:39 EST
So what a solution do you want to see for this? Is an alias to Monospace for Consolas enough? or want to have an alias to DejaVu Sans Mono?
Comment 20 Matěj Cepl 2016-02-02 12:51:47 EST
(In reply to Akira TAGOH from comment #19)
> So what a solution do you want to see for this? Is an alias to Monospace for
> Consolas enough? or want to have an alias to DejaVu Sans Mono?

Well, I was thinking about aliases of all these fonts

https://en.wikipedia.org/wiki/Category:Windows_Vista_typefaces
https://en.wikipedia.org/wiki/Category:Microsoft_typefaces

or (this is probably a better list) https://www.microsoft.com/typography/fonts/product.aspx?PID=164 (not sure about non-Latin scripts, but we may need them as well)?

and it really doesn't matter that much IMHO what fonts will be actually used, so yes either Monospace or DejaVu Sans Mono is fine with me.
Comment 21 Akira TAGOH 2016-02-09 22:11:21 EST
Okay, I'll try to manage this in fontconfig then.
Comment 22 Akira TAGOH 2016-05-25 00:11 EDT
Created attachment 1161306 [details]
proposed changes to 45-latin.conf
Comment 23 Jens Petersen 2016-05-31 03:28:04 EDT
Thanks, any suggestions on how best to test the patch?
I mean both for functionality and against potential regressions.
Comment 24 Akira TAGOH 2016-05-31 05:30:53 EDT
all of the proposed changes are to add 'default' tag i.e. appending a family to the end of the list. so that shouldn't affect the usual queries except it doesn't originally match any without this change. for functional testing, requesting those fonts should simply works and see what typefaces it returns.
Comment 25 Matěj Cepl 2016-05-31 05:39:16 EDT
(In reply to Jens Petersen from comment #23)
> Thanks, any suggestions on how best to test the patch?
> I mean both for functionality and against potential regressions.

The manual testing, prepare set of documents on Windows (e.g., the attached slides), and check they display correctly? As of automatic testing I have no idea (and we have this problem in Desktop QA as well; comparing screenshots seems like incredibly brittle technology, but I don't think I can imagine much anything else). Whatever you do for other fonts?
Comment 26 Jens Petersen 2016-06-07 02:47:59 EDT
Has anyone tried the patch?
Comment 27 Matěj Cepl 2016-06-07 09:24 EDT
Created attachment 1165647 [details]
.rej file when applying the patch

When trying to patch the 45-latin.conf in /usr/share/fontconfig/conf.avail I got:

mitmanek:conf.avail# patch -p2 -z.orig </home/matej/0001-45-latin.conf-Add-some-Windows-fonts-to-categorize-t.patch 
patching file 45-latin.conf
Hunk #2 succeeded at 54 (offset -4 lines).
Hunk #3 FAILED at 70.
Hunk #5 FAILED at 161.
Hunk #6 succeeded at 203 with fuzz 1 (offset -12 lines).
2 out of 6 hunks FAILED -- saving rejects to file 45-latin.conf.rej

And the *.rej file is attached.
Comment 28 Matěj Cepl 2016-06-07 09:54:18 EDT
Otherwise when I have fixed the .rej issues, I get perfectly working stuff, which seems to make LOImpress working on the attached presentation.
Comment 29 Akira TAGOH 2016-06-10 02:34:52 EDT
Okay, fixed in 2.10.95-8.el7
Comment 31 Matěj Cepl 2016-08-06 06:16:35 EDT
Yes, works perfectly. Thank you
Comment 33 errata-xmlrpc 2016-11-03 17:18:19 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-2601.html

Note You need to log in before you can comment on or make changes to this bug.