[Pkg-fonts-devel] Fwd: Draining the font swamp

Matt Zimmerman mdz at debian.org
Mon May 28 17:12:12 UTC 2007

On Thu, May 24, 2007 at 11:28:09AM +0800, "Arne Götje (高盛華)" wrote:
> Ok, guys, here are my thoughts:

Thanks very much for your thorough reply.

> > I don't know:
> > 
> > - Exactly which pieces are used by GTK, Qt, XUL, etc. and how applications
> >   using those APIs ask for a font specification
> * GTK2 apps use fontconfig
> * QT3 apps do not use fontconfig, at least not for the alias fonts
> serif, sans and monotype
> * Legacy X apps and GTK1 also cannot use fontconfig. They only use xft
> to select the fonts. For these ones defoma is still neded.

What does QT3 use?

I am not very concerned for legacy X apps or GTK1; I think we are
approaching a time when such packages can be expected to declare an explicit
dependency relationship to obtain their fonts if necessary, rather than
assuming that they are available.

> > - Which applications ask for which font specifications, and where that's
> >   configured (sometimes in the application itself, as in Firefox)
> yes, firefox is a horrible application in this regard. Are there any
> ways to change that behavior?

I don't know, though perhaps Alexander does (CCed).

> > - Which fonts are any good, and for which languages (no easy answer here)
> IMHO the following needs to be done:
> 1. classify the available fonts into "Decorative" and "Desktop" fonts.
> With "Decorative" I mean fonts, which are nice for *printing*, "Desktop"
> refers to fonts which are suitable for *screen* display.
> Example for Decorative fonts: AR PL ZenKai family, this is a brushstroke
> CJK font, which is nice for printing documents, but horrible for screen
> display.
> Example for Desktop fonts: DejaVu sans. It's a smart font and a very
> simple stroked font, makes it perfect for screen display... no issues
> with hinting and so on...

Given that this needs input from users of many character sets, perhaps
creating a wiki page would be a good start.

> 2. A list of default fonts should be made for certain languages (this is
> only interesting for screen display):
>  * For Latin script DejaVu Sans and the SIL fonts for sans and serif
> respectively should be on the top of the list. Both are smart fonts
> which can compose almost any diacritical combination, as for Vietnamese,
> European languages and African languages based on Latin script. Also
> both fonts include the full list of IPA characters...

Which one of the SIL fonts do you mean?  Is it packaged and available in
Debian and Ubuntu?

In Ubuntu, we currently use DejaVu for both sans and serif.

>  * For CJK this is difficult. Here we have several issues to take care of:
>   a) embedded bitmap glyphs are needed to render acceptable glyphs in
> small fontsizes (12 pt and below)

Is this an inherent limitation, or one which is specific to the free
rendering engines currently available?  Is it possible to overcome this
problem without creating so many bitmap glyphs?  Who creates them?

>   b) there is currently no font avaliable which covers all CJK glyphs in
> Unicode
>   c) we don't have any acceptable sans-serif font for CJK
>   d) currently we can only use the ming/mincho style for screen display,
> the Kochi Mincho and AR PL ShanHeiSun Uni fonts contain embedded bitmaps
> already.
>   e) CJK glyphs in China, Hong Kong, Taiwan, Japan and Korea have
> different shapes which share the same Unicode codepoints. The available
> fonts (ttf-arphic-uming, ttf-kochi-mincho and ttf-unfonts) overlap each
> other in the CJK range, which confuses fontconfig! Chinese users usually
> prefer the ttf-arphic-uming package, while Japanese users might prefer
> the ttf-kochi-mincho or ttf-sazanami-mincho fonts and Korean users stick
> with the ttf-unfonts package. What makes it worse is, that fontconfig
> comes with a predefined list of fonts which should be preferred. This
> does not suit all CJK users, as they have different preferences.

This seems like a real mess.  In Ubuntu, we try to work around this by
changing font preferences depending on which supported languages are
selected by the user, but it is not ideal.  What if the system needs to
support more than one of these?

> For all these CJK issues I'm working on a solution. But it takes time
> until it's ready.

Where can we learn more about your work?

> > - Which criteria are important for selecting which font to use in which
> >   context (language, character set, ...)
> 1. locale setting is probably best to determine the default preferred
> fonts, but the user should have a possibility to change it.

As I understand it, this is something that fontconfig does not consider.  I
think Michael (CCed) has some background from discussions about this.

> 2. documents which use the ODF format can have paragraphs or even single
> letters marked with a language tag. Those can override the default
> system font settings.
> 3. fontconfig should take care of selecting the proper font for each
> script. But it needs some tuning IMHO... see below!
> > - Whether fontconfig requires adjustments in order to respect those criteria
> YES! IMHO fontconfig needs some big improvement.
> Currently fontconfig's decision on which font to use for a specific
> glyph is influenced by the following:
>  * which charsets the font package has registered in defoma. If the font
> has registered itself for ISO8859-1, fontconfig will consider the font
> suitable for that codepoint range. Same is true for all other charsets.
>  * how many glyphs are covered by the font and in which codepoint
> regions (determined by fontconfig)
>  * the config files provided by fontconfig contain a default font
> preference ordering. This might not suit all users... and usually does not.
>  * config files provided by font packages, which can label their own
> fonts as preferred ones and override the system wide setting by this.

Right, there doesn't seem to be a way to tell fontconfig which language is
in use in a particular context, or even good defaults for the system as a

> The following needs to be done:
>  * the default config files which specify any font preference should be
> removed!

Why?  Surely we need to have a globally consistent view of which fonts are
preferred under which circumstances.  The user should of course be able to
override this, but we need to have a common starting point.

If it is because the existing preferences are not flexible enough, then we
should try to fix that instead.

>  * fontpackages should not label their own fonts as preferred, but
> should rather indicate for which locales and which codepoint ranges the
> fonts should be used. (Latin fonts can label the locales as "any" and
> Unicode range to the latin ranges they support; see next item.)
>  * fontconfig should provide a method to specify for which locales which
> fonts are suitable and which codepoint ranges they should be preferred
> for. For example: Chinese users might want the AR PL ShanHeiSun Uni font
> to be preferred for the CJK ranges, but the Doulos SIL or DejaVu Sans
> fonts for Latin glyphs. So, I would configure fontconfig for the zh_*
> locales to prefer the SIL fonts for Unicode ranges U+0000 ~ U+001F, etc.
> and the AR PL ShanHeiSun Uni font for the range U+2E80 ~ U+9FFF, etc.

This sounds reasonable.  I would think that we may also need a way for the
application to override fontconfig's idea of which language is relevant,
when matching a font pattern.  As you point out, applications may display
text in multiple locales, and so in order to match correctly in all cases,
fontconfig must receive that information, and not only the current locale

> > - Whether we still need all these horrible bitmap fonts
> As seperate fonts, probably only for X. CJK users however need fonts
> with embedded bitmaps.

This is my thinking as well; the bitmap font packages (xfonts-*) should only
be needed for legacy apps at this point.

> > - Whether we still need server-side fonts for anything
> > 
> > - Whether we need DeFoMa
> Yes, as legacy X, GTK1 and QT apps depend on it.

I should have been clearer; I am trying to establish (among other things)
what is needed by default in Ubuntu.  The rest will still be available, but
depending on what's currently shipped, we may be able to remove some things
from the default install, which would be a win for us.

> Fontconfig also uses the settings to determine the character sets
> provided by the fonts.
> AFAIK, it is also used to register fonts for ghostscript... however I'm
> not an expert on this and it seems to me that it does not always work as
> planned.

I'm CCing Till Kamppeter in hopes that he can enlighten us regarding font
selection for Ghostscript.

 - mdz

More information about the Pkg-fonts-devel mailing list