Uses nimbus for sans-serif font

Bug #42559 reported by Matthew Garrett
8
Affects Status Importance Assigned to Milestone
Debian
Fix Released
Unknown
firefox (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Epiphany seems to be defaulting to nimbus whenever it should be using a sans-serif font. The headline of the top entry on the front page of news.bbc.co.uk makes this quite obvious.

This is
Debian bug #299697

Revision history for this message
In , Romain Francoise (rfrancoise) wrote : More info

retitle 299697 Some fonts look different and much less readable
thanks, control

I have to apologize for the misleading title and information in this bug
report, the problem is not related to font size. See these two
examples:

<URL: http://orebokech.com/tmp/shot_vote_ok.png> is version 2.2.3-4

<URL: http://orebokech.com/tmp/shot_vote_nok.png> is version 2.3.1-2

The latter is much less readable.

--
  ,''`.
 : :' : Romain Francoise <email address hidden>
 `. `' http://people.debian.org/~rfrancoise/
   `-

Revision history for this message
In , Romain Francoise (rfrancoise) wrote : Closing

Robert McQueen solved the problem for me:

<URL: http://www.hadesian.co.uk/2005/03/16/fontconfig-fun/>

and in particular

<URL: http://www.hadesian.co.uk/files/fonts.conf>

--
  ,''`.
 : :' : Romain Francoise <email address hidden>
 `. `' http://people.debian.org/~rfrancoise/
   `-

Revision history for this message
In , Romain Francoise (rfrancoise) wrote : Reopening

reopen 299697
retitle 299697 fontconfig: Default font configuration changed in 2.3.1-1
severity 299697 wishlist
quit

Steve convinced me to reopen this bug as it is still an issue with the
default configuration. Apparently the change came from Redhat, maybe
their font handling is different from Debian's and the change isn't
suitable for us?

Thanks,

--
  ,''`.
 : :' : Romain Francoise <email address hidden>
 `. `' http://people.debian.org/~rfrancoise/
   `-

Revision history for this message
In , Romain Francoise (rfrancoise) wrote :

Romain Francoise <email address hidden> writes:

> Steve convinced me to reopen this bug

Er, I meant Robert, of course. Sorry.

--
  ,''`.
 : :' : Romain Francoise <email address hidden>
 `. `' http://people.debian.org/~rfrancoise/
   `-

Revision history for this message
In , Jürgen Kreileder (jk) wrote : Re: Default font configuration changed in 2.3.1-1

severity 299697 normal
thanks

I consider this a normal, not a wishlist, bug. After upgrading from
2.2.3-4, some pages looked quite ugly in Mozilla: Overall blurry text
rendering, color artifacts from subpixel rendering, some characters
too close together... (this is with subpixel rendering, native hinting
and hintstyle=hintfull).

Please use the MS or Bitstream fonts for Times/Helvetica/Courier if
available.

        Juergen

--
Juergen Kreileder, Blackdown Java-Linux Team
http://blog.blackdown.de/

Revision history for this message
In , Keith Packard (keithp) wrote : Re: Bug#299697: Default font configuration changed in 2.3.1-1

Around 17 o'clock on Mar 31, Juergen Kreileder wrote:

> Please use the MS or Bitstream fonts for Times/Helvetica/Courier if
> available.

I don't want to do this by default -- the whole point of the Nimbus family
is to provide metric and shape compatible fonts for applications
requesting one of the fonts included with the Postscript implementations.
Replacing them in everywhere with the metric and shape incompatible
Microsoft faces isn't a good solution most of the time.

Let's try to work out some more precise rules for when each family should
be used and try to make that happen in the configuration. (These would be
defaults, and could be overridden by the user). Here's some
suggestions:

 1) When an application requests *only* Times, Helvetica or Courier,
 then it should get the Nimbus faces.

 2) When an application requests "Times,Serif" "Helvetica,Sans-Serif",
 or "Courier,Monospace", then the users generic aliases should
 override the Nimbus faces.

 3) When an application requests "Times,Times New Roman",
 "Helvetica,Arial", or "Courier,Courier New", then if those
 faces are present, they should be used instead of Nimbus. When
 not present, the users generic alias equivalents should be
 used, not the Nimbus faces.

Does this seem sensible? Are there other cases which we should consider?

-keith

Revision history for this message
In , Browaeys-alban (browaeys-alban) wrote :

While looking after a gsfonts bug (urw symbol does not map well to
adobe symbols so some symbols are not drawn) i foudn this thread.

gsfonts take over the system http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=155169

> 8 Sep 2002 Roland Rosenfeld wrote:
>> On Tue, 13 Aug 2002, Cory Dodt wrote:
>> What package can prevent that from happening? Does it behoove every
>> upstream author to request only font strings that match known AA
>> fonts?
>
>This is the "right way"...
>
>An alternative is to remove the adobe font names from gsfonts-x11 and
>use only the urw names from fonts.scale. Then patch all drawing
>programs like xfig to use the urw fonts on screen instead of the adobe
>names, which would get rid of the conflicts. But this is only a work
>around to avoid most of the problems while it is not a solution to
>the problem.

The issue about mapping URW to adobe is quite old. To sum up the workaround was then to add alias for example:
!
! Work around problems with Comments in XEmacs:
!
-adobe-courier-bold-i-normal--14-140-75-75-m-90-iso8859-1 -adobe-courier-bold-o-normal--14-140-75-75-m-90-iso8859-1
-adobe-courier-bold-i-normal--12-120-75-75-m-70-iso8859-1 -adobe-courier-bold-o-normal--12-120-75-75-m-70-iso8859-1
-adobe-courier-bold-i-normal--24-240-75-75-m-150-iso8859-1 -adobe-courier-bold-o-normal--24-240-75-75-m-150-iso8859-1
!
! Work around problems with Tk8.2:
!
-adobe-helvetica-bold-r-normal--12-120-75-75-p-0-iso8859-1 -adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859-1
-adobe-helvetica-medium-r-normal--12-120-75-75-p-0-iso8859-1 -adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1

to avoid some of them being used without breaking application where those fonts are usefuless (xfig)

As fontconfig has the capaibility that was missing then (avoid using type1 for small fonts) could it be added to fonts.conf ?

Or should we keep the current setting (which does not try to guess what the application want but provide the best match)
and let the applications implement substitution depending on the field they apply to : writer would like type1 to be type1,
when web applications would mostly want them replaced by closest truetype ...
(in such case could fontconfig enable a per application font patterns ?)

Regards
Alban

Revision history for this message
In , Ian Jackson (ijackson) wrote : Removal of URW alias from fonts.conf.in

FYI:

I am applying the enclosed patch to Ubuntu's fontconfig in Ubuntu
Breezy. This fixes the problem with our Firefox using the Nimbus
fonts too often.

But, following the discussion on our ubuntu-devel mailing list (see
the references in the diff, below) I'm far from convinced that this is
a wholly correct solution.

I'm just sending this email keep Ubuntu, Debian and upstream
participants informed, including to provide a reference to the
discussion on our list.

(This message is BCC'd to the Debian BTS, to avoid clogging the BTS
with any subsequent discussion. If there is discussion CC'd to me
which comes to some conclusion I will summarise.)

Ian.

diff -u fontconfig-2.3.2/debian/changelog fontconfig-2.3.2/debian/changelog
--- fontconfig-2.3.2/debian/changelog
+++ fontconfig-2.3.2/debian/changelog
@@ -1,3 +1,12 @@
+fontconfig (2.3.2-1ubuntu2) breezy; urgency=low
+
+ * Remove URW font aliases. See in ubuntu-devel, thread starting
+ <email address hidden>
+ http://lists.ubuntu.com/archives/ubuntu-devel/2005-September/011564.html
+ http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=299697, Ubuntu 7196.
+
+ -- Ian Jackson <email address hidden> Fri, 30 Sep 2005 18:18:30 +0100
+
 fontconfig (2.3.2-1ubuntu1) breezy; urgency=low

   * Resynchronise with Debian.
only in patch2:
unchanged:
--- fontconfig-2.3.2.orig/fonts.conf.in
+++ fontconfig-2.3.2/fonts.conf.in
@@ -140,22 +140,6 @@
  </match>

 <!--
- URW provides metric and shape compatible fonts for these 3 Adobe families.
- -->
- <alias>
- <family>Times</family>
- <accept><family>Nimbus Roman No9 L</family></accept>
- </alias>
- <alias>
- <family>Helvetica</family>
- <accept><family>Nimbus Sans L</family></accept>
- </alias>
- <alias>
- <family>Courier</family>
- <accept><family>Nimbus Mono L</family></accept>
- </alias>
-
-<!--
  AMT provides metric and shape compatible fonts for these three web font
  families.
  -->

Revision history for this message
In , Steve Pomeroy (xxv) wrote : fontconfig: Still unresolved

Package: fontconfig
Version: 2.3.2-5.1
Followup-For: Bug #299697

fontconfig just updated my /etc/fonts/font.conf file, reminding
me that this bug is still unresolved.

Does anyone have any further info on this issue?

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (700, 'testing')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages fontconfig depends on:
ii defoma 0.11.8-0.1 Debian Font Manager -- automatic f
ii fontconfig-config 2.3.2-5.1 generic font configuration library
ii libc6 2.3.6-7 GNU C Library: Shared libraries
ii libfontconfig1 2.3.2-5.1 generic font configuration library

fontconfig recommends no packages.

-- debconf information:
  fontconfig/subpixel_rendering: Automatic
  fontconfig/enable_bitmaps: false
  fontconfig/hinting_type: Native

Revision history for this message
In , Josselin Mouette (joss) wrote : Re: Bug#299697: fontconfig: Still unresolved

Le jeudi 20 avril 2006 à 19:41 -0400, Steve Pomeroy a écrit :
> Package: fontconfig
> Version: 2.3.2-5.1
> Followup-For: Bug #299697
>
>
> fontconfig just updated my /etc/fonts/font.conf file, reminding
> me that this bug is still unresolved.
>
> Does anyone have any further info on this issue?

There are lots of things in this bug report, so I'd like to make them
clear.

Most contributors to this thread noticed that the URW fonts had replaced
the Bitstream fonts in Firefox/epiphany. This is caused by the Mozilla
suite replacing the "sans-serif" and "serif" aliases by "Helvetica" and
"Times". We will not include a broken patch from Ubuntu for fontconfig
when the bug is in Mozilla; it has been fixed in xulrunner 1.8.0.1-3. I
don't know whether it has been fixed in firefox as well, but it is only
a matter of porting the same patch.

I'd like to know whether the original bug report (ugly fonts at small
sizes) is the same. You can check the latest epiphany package, in which
I'm sure the DejaVu fonts are correctly used by default. You can also
try with removing the gsfonts-x11 package.

Regards,
--
 .''`. Josselin Mouette /\./\
: :' : <email address hidden>
`. `' <email address hidden>
   `- Debian GNU/Linux -- The power of freedom

Revision history for this message
In , Ian Jackson (iwj) wrote :

Indeed, as Steve Pomeroy says, the problem is that websites specifying
`Times' (say) get Nimbus rather than DejaVu (or whatever the default
is in Debian).

Fixing this is complicated because, as Keith Packard says, Nimbus is
needed for (for example) PDF viewing, because DejaVu has different
metrics. The real problem is that the fontconfig configuration can't
tell whether we're (i) a web browser, which doesn't really care much
about the metrics but definitely wants a font that looks good on
screen or (ii) a PDF handling program (or similar), which must use
fonts with exactly the metrics of the requested font.

Without a way to distinguish these cases, it is impossible to (as
Keith says) `work out [the] rules for when each family should be used
and try to make that happen'.

After staring at the various packages involved, I concluded that the
right answer was: a new font template property `anymetrics' which
would be set by applications which would not mind fonts with different
metrics to that specified in the pattern. Doing it that way round
means that the stricter behaviour is the default, so that we will err
on the side of ugliness rather than brokenness.

In Ubuntu we configure firefox to use pango for all of its text
rendering (for i18n charset reasons). And as it turns out, I think
applications that use pango (such as firefox) always leave the
specific text sizing and placement to pango, and pango uses the actual
metrics from the actual font. So the correct place to set the
anymetrics fontconfig flag is in pango, and firefox does not need to
be changed.

I could be wrong about pango clients but it seems likely that this is
true for the majority at least. If it's not true for all - if, for
example, pango even provides an interface that could be used by a
program which needs to use specific fonts and do its own text
placement - then an option could be added to pango's font selection
machinery to turn anymetrics off. It seems to me from what little I
know abouit this situation that this is the right way round for the
default at this layer.

Finally, this provides us with the tools to selectively disable the
font <alias...> directives for the relatively ugly Nimbus fonts when
we know that we don't care about the metrics so that DejaVu fallback
is good. Sadly <alias...> can only be made conditional by turning
it into <match...> which is much more verbose. An <if...> construct
would have been very useful.

Attached:

* Patch to fontconfig (against 2.3.2-1.1ubuntu9) to
  - provide a new FC_ANY_METRICS (aka `anymetrics') boolean property.
  - only use Nimbus for Times et al if anymetrics is not set.

* Patch to pango (against pango1.0 1.12.1-1ubuntu1) to set
  FC_ANY_METRICS (aka `anymetrics') to FcTrue everywhere a fontconfig
  font pattern is constructed. Note that the versioned
  build-dependency on libfontconfig1-dev may need adjusting for Debian.

Regards,
Ian.

Revision history for this message
In , Josselin Mouette (joss) wrote :

Le lundi 24 avril 2006 à 12:35 +0100, Ian Jackson a écrit :
> Indeed, as Steve Pomeroy says, the problem is that websites specifying
> `Times' (say) get Nimbus rather than DejaVu (or whatever the default
> is in Debian).

Again, this is caused by a rewrite of "sans" into "Helvetica" and
"sans-serif" into "Times" in Mozilla. This bug has been fixed in
xulrunner and can easily be fixed in firefox as well.

> In Ubuntu we configure firefox to use pango for all of its text
> rendering (for i18n charset reasons). And as it turns out, I think
> applications that use pango (such as firefox) always leave the
> specific text sizing and placement to pango, and pango uses the actual
> metrics from the actual font. So the correct place to set the
> anymetrics fontconfig flag is in pango, and firefox does not need to
> be changed.

Epiphany disables pango, apart for some languages for which it is
necessary to use it. So this method wouldn't be enough for epiphany;
that would mean dealing with Mozilla's internals to add the same hack.
--
 .''`. Josselin Mouette /\./\
: :' : <email address hidden>
`. `' <email address hidden>
   `- Debian GNU/Linux -- The power of freedom

Revision history for this message
In , Ian Jackson (iwj) wrote :

Josselin Mouette writes ("Re: Bug#299697: fontconfig: Still unresolved"):
> Le lundi 24 avril 2006 à 12:35 +0100, Ian Jackson a écrit :
> > Indeed, as Steve Pomeroy says, the problem is that websites specifying
> > `Times' (say) get Nimbus rather than DejaVu (or whatever the default
> > is in Debian).
>
> Again, this is caused by a rewrite of "sans" into "Helvetica" and
> "sans-serif" into "Times" in Mozilla. This bug has been fixed in
> xulrunner and can easily be fixed in firefox as well.

This may be true and will cause the problem to manifest on most
websites rather than just on ones that ask for `Times' or `Helvetica'
explicity. However, even if we fix Mozilla then we'll still have
problems with those latter sites.

> > In Ubuntu we configure firefox to use pango for all of its text
> > rendering (for i18n charset reasons). And as it turns out, I think
> > applications that use pango (such as firefox) always leave the
> > specific text sizing and placement to pango, and pango uses the actual
> > metrics from the actual font. So the correct place to set the
> > anymetrics fontconfig flag is in pango, and firefox does not need to
> > be changed.
>
> Epiphany disables pango, apart for some languages for which it is
> necessary to use it. So this method wouldn't be enough for epiphany;
> that would mean dealing with Mozilla's internals to add the same hack.

This is not a hack, and I resent you describing it that way.

It's the correct solution; we add the missing piece of information to
the interface. Or do you disagree with some part of my rationale ?
If so, please come out and explain !

But yes, if you don't use pango for everything then you have to find
the places in Mozilla where it uses fontconfig and change those too,
to pass the new flag. I haven't done that at this stage because it
wasn't relevant to the configuration in Ubuntu.

Alternatively you might say that the default is wrong, and that
instead we should edit the programs that have (or whose documents
have) a specific idea of what the metrics are going to be.

Thanks,
Ian.

Revision history for this message
Matthew Garrett (mjg59) wrote :

Epiphany seems to be defaulting to nimbus whenever it should be using a sans-serif font. The headline of the top entry on the front page of news.bbc.co.uk makes this quite obvious.

Revision history for this message
Ian Jackson (ijackson) wrote :

With the latest changes for MOZ_DISABLE_PANGO=1 (workaround for pango performance Malone 32561), this affects firefox proper sometimes too.

Changed in firefox:
status: Unconfirmed → Confirmed
Revision history for this message
Ian Jackson (ijackson) wrote :

The fix for this is in 1.5.dfsg+1.5.0.2-0ubuntu2. It should fix it both with MOZ_DISABLE_PANGO=1 (which is what I've tested) and in epiphany et al.

Changed in firefox:
status: Confirmed → Fix Released
Revision history for this message
In , Ian Jackson (iwj) wrote :

Ian Jackson writes ("Re: Bug#299697: fontconfig: Still unresolved"):
> But yes, if you don't use pango for everything then you have to find
> the places in Mozilla where it uses fontconfig and change those too,
> to pass the new flag. I haven't done that at this stage because it
> wasn't relevant to the configuration in Ubuntu.

It has so turned out that we (Ubuntu) have just changed our firefox
setup to sometimes not use pango, so we have had to make those changes
to firefox.

We've also discovered that the usual way to call fontconfig when you
want to present to the user a list of fonts is to supply a fairly
minimal pattern and call FcFontList or the like; which doesn't work
with anymetrics=1 because the pattern never matches.

Personally I think this is a design error in the FC API:
configuration-directing attributes like anymetrics should be removed
during canonicalisation which ought to completely solve that, but this
wouldn't work at present because applications generally don't do
canonicalisation between pattern creation and font enumeration.

Indeed, I found a couple of places in pango where a pattern was
constructed and FcFontMatch was called without invoking the
canonicalisation and configuration processing.

It seems to me that the canonicalisation and config processing, which
are supposed to be performed by all fontconfig-using programs, should
be done automatically the first time a pattern is used, whether for
enumeration or finding a particular font. This would eliminate
mistakes of this kind (and make application code smaller and more
straightforward). fontconfig would have to maintain a copy of the
original pattern in case the application modified it or had other
unusual flows (or at least, it would have to mark the pattern as
`canonicalised' and refuse to further edit it).

So, currently the correct behaviour for a non-metrics-sensitive
program is to set anymetrics=1 iff it is looking for a particular
font, and not to set it iff the pattern is to be used for
enumeration. This is not quite correct and might lead to misbehaviour
in the future, but the behaviour is correct in the current
configuration.

The revised patch to pango, and the patch to firefox that I mentioned
earlier, are attached.

Thanks,
Ian.

Alexander Sack (asac)
description: updated
Changed in debian:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.