Bug 1160935

Summary: Webpages that request Helvetica get Nimbus Sans, which has terrible kerning
Product: [Fedora] Fedora Reporter: Jason Merrill <jason>
Component: firefoxAssignee: Gecko Maintainer <gecko-bugs-nobody>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: fonts-bugs, gecko-bugs-nobody, i18n-bugs, jason, jhorak, matthew.hirsch, mfabian, moez.roy, pnemade, psatpute, redhat-bugzilla, stransky, tagoh
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-20 12:56:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jason Merrill 2014-11-06 02:45:33 UTC
Description of problem:

Facebook suffers from bad kerning on Firefox under Fedora 20.  It seems that it the problem is that when Facebook asks for a font it specifies

Helvetica,Arial,"lucida grande",tahoma,verdana,arial,sans-serif

And /etc/fonts/conf.d/30-metric-aliases.conf defines Nimbus Sans L as the preferred fallback for Helvetica, so that's what Facebook gets.  But Nimbus Sans L has poor kerning, at least in Firefox, so the display looks bad.

If I override the aliases with a personal fonts.conf to use Arimo or Liberation Sans instead, it looks much better.  If we don't want to change the system-wide aliases, it ought to be possible to override these aliases just for Firefox.

Version-Release number of selected component (if applicable):

firefox-33.0-1.fc20.x86_64
fontconfig-2.11.0-2.fc20.x86_64
urw-fonts-2.4-18.fc20.noarch

How reproducible:

Always

Steps to Reproduce:
1. Start Firefox
2. Go to facebook.com

Actual results:

Display has bad kerning, with some letters stuck together

Expected results:

Display has good kerning

Additional info:

Here's my ~/.config/fontconfig/fonts.conf that works around the problem.  I tried sticking this in /usr/lib64/firefox/res/Xft, but that doesn't seem to have the desired effect.

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <alias binding="same">
    <family>Helvetica</family>
    <accept>
      <family>Arimo</family>
      <family>Liberation Sans</family>
    </accept>
  </alias>
  <alias binding="same">
    <family>Times</family>
    <accept>
      <family>Tinos</family>
      <family>Liberation Serif</family>
    </accept>
  </alias>
  <alias binding="same">
    <family>Courier</family>
    <accept>
      <family>Cousine</family>
      <family>Liberation Mono</family>
    </accept>
  </alias>
</fontconfig>

Comment 1 Jason Merrill 2014-11-06 03:22:47 UTC
It seems that Chrome on my system skips the Helvetica replacements and uses Arial instead (which I have installed); if Arial is not installed, it somehow chooses Liberation Sans.

Comment 2 Matt Hirsch 2014-11-14 08:52:49 UTC
In my system there is a symlink 30-metric-aliases.conf in /etc/fonts/conf.d to /usr/share/fontconfig/conf.avail/30-metric-aliases.conf. Removing this symlink causes 

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

instead of Nimbus Sans.

I'm not a fontconfig guru but that may be something to check for your modification to take effect.

Comment 3 Matt Hirsch 2014-11-14 08:54:57 UTC
Ah, I didn't fully read your comment. Shame on me.

Comment 4 Martin Stransky 2015-01-21 14:01:00 UTC
That's more about fontconfig setup, right?

Comment 5 Jason Merrill 2015-01-21 15:16:18 UTC
Well, it's about the interaction of firefox and the fontconfig setup on a standard Fedora system; it could be addressed in either place.  I think the choice of Nimbus Sans was based on metric compatibility, which is less important for web fonts.

The explanantion of the Chrome behavior seems to be, "Because web pages themselves (via CSS) provide their own font fallback preferences, Chrome disregards the font fallback provided by fontconfig except when the fonts requested by the page don't provide the characters needed." (http://neugierig.org/software/chromium/fonts/)

Comment 6 Akira TAGOH 2015-01-26 09:20:26 UTC
Hmm, that's why I don't like maintaining the centralized font aliases in fontconfig and why we set it up in each fonts packages.
The sort of this issue may depends on what the reporter really want. it could be a font bug which should be fixed in a font, in this case, urw-fonts. or it could be a preference issue which can be fixed in installing/uninstalling the unnecessary font packages with the separate config files. making the order of the fonts to satisfy all of users' requirements is quite difficult. the default config in fontconfig is just adding fonts as a last resort. it's not enforcing anything. if we have a good candidate for those fonts as a package, it should do that there. otherwise it will just be used. nobody writes a config as a Helvetica alternative in their own config in this case. that's it.

Comment 7 Fedora End Of Life 2015-05-29 13:13:47 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 8 Jason Merrill 2015-05-29 19:10:41 UTC
This is still a problem with an up-to-date Fedora 21.

I'm also changing the component back to Firefox, because I don't think it's clear that the fontconfig default is wrong for the majority of uses, it just happens to be wrong for Firefox.  So Firefox should override it, either with a local fontconfig file (which should be pretty trivial) or by adopting the Chrome behavior.

Comment 9 Fedora End Of Life 2015-11-04 11:40:25 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 10 Nicolas Mailhot 2015-11-04 14:47:18 UTC
(In reply to Jason Merrill from comment #5)
> Well, it's about the interaction of firefox and the fontconfig setup on a
> standard Fedora system; it could be addressed in either place.  I think the
> choice of Nimbus Sans was based on metric compatibility, which is less
> important for web fonts.

Nimbus is a valid (if old) Helvetica substitute it was designed to replace Helvetica.

If you want better substitutes for historical postscript fonts such as Helvetica, you should package TEX Gyre in Fedora (assuming spot confirms it passes legal now). TEX Gyre is the most modern floss postscript font replacement set.

Comment 11 Jason Merrill 2015-11-04 22:18:21 UTC
Thanks, but I'm not trying to find a better Helvetica substitute, what I want is for Facebook to look better in Firefox.  I think the Chrome behavior quoted in comment #5, i.e. skipping Helvetica in the web font list rather than looking for a substitute, makes a lot of sense.

Comment 12 Nicolas Mailhot 2015-11-05 06:19:13 UTC
(In reply to Jason Merrill from comment #11)
> Thanks, but I'm not trying to find a better Helvetica substitute, what I
> want is for Facebook to look better in Firefox.  I think the Chrome behavior
> quoted in comment #5, i.e. skipping Helvetica in the web font list rather
> than looking for a substitute, makes a lot of sense.

That may work for some pages but given how some web designers inist on pixel-perfect designs Helvetica really needs to be substituted by something with the same metrics

Comment 13 Pravin Satpute 2015-11-25 13:44:01 UTC
Is this bug still exist in F23? Is not please close else move to F23.

Comment 14 Jason Merrill 2015-11-29 22:00:17 UTC
Still an issue for F23.

Comment 15 Jason Merrill 2015-11-29 22:09:34 UTC
(In reply to Nicolas Mailhot from comment #12)
> (In reply to Jason Merrill from comment #11)
> > Thanks, but I'm not trying to find a better Helvetica substitute, what I
> > want is for Facebook to look better in Firefox.  I think the Chrome behavior
> > quoted in comment #5, i.e. skipping Helvetica in the web font list rather
> > than looking for a substitute, makes a lot of sense.
> 
> That may work for some pages but given how some web designers inist on
> pixel-perfect designs Helvetica really needs to be substituted by something
> with the same metrics

For pages that only request Helvetica, sure.  In this case, the page requests "helvetica, arial, sans-serif", so the web designer clearly isn't expecting pixel-exact layout.

Comment 16 Akira TAGOH 2015-11-30 02:19:01 UTC
To make more clearer, what's the expected behavior like what you said "good kerning"? as I said, this is a font issue or depends on what fonts you installed. if you have any particular fonts you want to use in that case, that would be a first step to get a solution for you.

Comment 17 Jason Merrill 2015-11-30 16:15:19 UTC
Arimo and Liberation Sans look much better than Nimbus because they don't have letters stuck together.

Comment 18 Nicolas Mailhot 2015-11-30 17:19:47 UTC
(In reply to Jason Merrill from comment #15)

> For pages that only request Helvetica, sure.  In this case, the page
> requests "helvetica, arial, sans-serif", so the web designer clearly isn't
> expecting pixel-exact layout.

If only…

But anyway the browser knows the css stack, so it can do "if on linux, ignore helvetica if the designer suggested something else", but the font stack does not.

And still a good helvetica variant in Fedora would solve all scenarii, not just one.

Comment 19 Pravin Satpute 2015-12-01 04:48:12 UTC
Historically Liberation was also substitute for "Sans (a substitute for Arial, Albany, Helvetica, Nimbus Sans L, and Bitstream Vera Sans)". https://fedorahosted.org/liberation-fonts/

I don't know why we stopped doing that or may be we missed doing it from beginning.

For now i think lets go ahead by adding Liberation as an alias for Helvetica and see how it goes.

Comment 20 Fedora End Of Life 2016-11-24 11:16:30 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 21 Fedora End Of Life 2016-12-20 12:56:04 UTC
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 22 Pablo Couto 2017-03-13 23:28:10 UTC
I saw this occur on Fedora 25, with Firefox 52. Nimbus Sans L is configured as fallback for Helvetica, but the font appears to have bad kerning and this shows on certain websites, as originally reported.

It is my understanding, however, that the underlying issue is one of browser policy: as noted, Chrome follows CSS fallbacks over those defined in fontconfig, while Firefox, in Linux, respects the latter.¹ As such, it is probably more adequate to discuss the issue upstream.

¹See this related issue on Mozilla’s Bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=553580