[Fontconfig] Request for implementing font substitution for CJK fonts

BlissSam m13253 at hotmail.com
Thu May 31 07:41:10 PDT 2012

I agree with SOME of your ideas.

But, what I want to say first is, what is font fallback.
For example (Helvetica is always a good example), if Helvetica is missing, will you choose DejaVu Sans or Tahoma to replace it? The answer is surely no. Because they are in different styles. You will certainly use Arial to substitute it, because they are compatible--which means, they almost look the same (even not all the same, compare the letter R and G).
If you have used a word-processing software, you will find that, if you specify a non-exist font, it will say `blah blah font is not installed, a similar font is used instead.' So what is a `similar font'? It means a compatible one, not one has only the same sans/serif attribute.
Therefore, font fallback is NOT simply to choose a sans-serif to replace a sans-serif, or a serif to replace a serif; it is to choose another font compatible with it.

So let's talk about CJK fonts. If SimSun is missing, will SimKai replace it? No, though they are all serif font, they look totally different.

What fontconfig's fallback feature should do is:
- Keep a list of what fonts are compatible
- When a font is missing, firstly search for that list to choose a compatible font
- If that font is not on the list, choose another font has the same sans/serif attribute
- If no info can be found from that font (e.g. it is not in TTF/OTF format so that you can have nothing got from it), simply choose the user's favorite font which is specified in his/hers ~/.fonts.conf or somewhere else. This is the worst plan.

A list should be maintained, I know. But it is really the work of fontconfig, not the distro. Does a distro keep a list of compatible fonts?

> Date: Thu, 31 May 2012 22:17:59 +0900
> Subject: Re: [Fontconfig] Request for implementing font substitution for CJK fonts
> From: akira at tagoh.org
> To: m13253 at hotmail.com
> CC: fontconfig at lists.freedesktop.org
> On Thu, May 31, 2012 at 8:19 PM, BlissSam <m13253 at hotmail.com> wrote:
> > I think a tool to generate these kind of rules is necessary. However, the table I listed in the previous message is necessary, too.Try to think, if Helvetica font is required but not installed, fonconfig will surely choose Arial or Liberation Sans to substitute.As the same, if a document requires STSong, will fontconfig choose SimSun to display that document?These fonts are basic fonts in CJK typography, so I think substitutions among these fonts are necessary.
> > Therefore, if Helvetica->Arial exists, STSong->SimSun exists too.
> Well, strictly speaking there are no alternatives fonts of Helvetica,
> Courier and Times for CJK fonts since those aren't designed for them.
> we just fall back to anything else only when requesting those fonts
> for glyphs in CJK. in your example, you may expect to modify
> 30-metric-aliases.conf, but for the above reason, I'm afraid I disgree
> with it.
> Aside from that, I suppose what you are linking to them is came from
> the generic family names as we sometimes try to find the fallback
> fonts out for them. e.g. Helvetica->sans-serif, Times->serif and
> Courier->monospace. I mean, that would be the same case with assigning
> the generic family names to fonts. so I would recommend to have the
> better rules with the font author or the distros.
> Honestly I would rather want to get rid of even them from fontconfig
> tree in the future. the classification can be guessed from the panose
> and the OS2 table. the last piece that is missing in this idea would
> be how to determine the order of the fonts though, it can be exported
> outside fontconfig as the preference. that should provides the minimal
> requirements. the problem on this idea is, there are no way to guess
> the classification for non OpenType/TrueType fonts. I have no idea
> when I can move on. but anyway.
> Anyway, IMHO sort of the order of the fonts should be outsourced to
> the desktop preference say. I guess it's not something maintained in
> fontconfig today. if we don't have sufficient facilities to do so, we
> should spend a time to implement it instead. that somewhat sounds
> constructive and productive.
> --
> Akira TAGOH

More information about the Fontconfig mailing list