[Fontconfig] asian font configuration

Keith Packard keithp at keithp.com
Thu Dec 9 07:27:46 EST 2004

Around 1 o'clock on Dec 9, Tor Andersson wrote:

> korean language detection is "broken". only two of all the korean fonts i
> have on my system are correctly identified as being korean:

That's probably just that the ko.lang file has too many glyphs.  We can fix 
this easily enough.  Place all of your Korean fonts in a directory and run:

 $ cd <directory containing korean fonts>
 $ FC_DEBUG=384 fc-cache -f .

If there are only a few codepoints in ko.lang which aren't included in 
your Korean fonts, that will list them as in:

ch(6) { 00c2 00d1 00dc 00e2 00f1 00fc }

This says the font in question (Watanabe) is missing six glyphs required 
to support Chamorro.  If there are more than 10 missing glyphs, it won't 
list the individual glyphs; we'd have to change the libary to display them 
all.  When you get the list of glyphs, you can remove them from ko.lang, 
rebuild the library and see if fontconfig now recognises the fonts 

If the font advertises support for a single Han language, and that 
language is not Korean, then the language coverage checking code won't 
even consider Korean when checking for language coverage.  You can
distinguish this case by the absense of any 'ko(xx)' debug output in the 
above list.  That would be more worrisome; I haven't yet found any fonts 
which mis-mark their Han language support.

If you can (legally) send the fonts in question along, I'd be happy to do 
this work.

> the default configuration for fontconfig is a bit on the scarce side
> regarding font aliases and substitutions for asian fonts.

Thanks muchly for the additional data.  The list of alternate common (but
non-free) family names is really nice to have.  

I think I'd like to try them in a different part of the configuration and
see if they work for you.  For example, as 'Kochi Gothic' is in mapping
from 'sans-serif' to a set of family names, it should suffice to place the
other gothic Japanese fonts in the mapping from family names to
'sans-serif'.  From there, it will be mapped into the list of acceptable
'sans-serif' faces, including 'Kochi Gothic'.

Also, you shouldn't need to map specific languages to specific family 
names; the language identification in fontconfig should suffice to select 
among the families listed for the generic aliases, just placing the family 
names in the generic 'serif', 'sans-serif', and 'monospace' aliases should 
select them when the application specifies the cooresponding language.

For both of these, the guiding principle is that we do font substitution 
in two ways:

 1)	For intentionally similar faces (Helvetica/Arial, Times/Times New 
	Roman), we have specific aliases mapping those names:

                <accept><family>Times New Roman</family></accept>


 2)	To set the preferred faces to use when an intentionally similar
	face not available, we map first from the given family to one
	of the generic names:


	Then we map from the generic name to a list of suitable fonts:


If this stuff isn't working for you, we've just got bugs in fontconfig 
that need fixing.

> i understand that due to the incapability of freetype to use CMaps to
> encode CID fonts, the ability to use CID-fonts with fontconfig is severely
> limited. however, it would be really really nice if fontconfig were extended
> in this area.

I don't have a lot of experience with Type1 CID fonts as I've tried to 
stick to TrueType which supports Unicode so much more nicely.

If you know of code or even documentation which clearly shows how to get 
from Unicode to CID stuff, it would be greatly appreciated.

> i think that fontconfig should look at the registry-ordering in the
> CID System Info dict and put to good use. add a property FC_CSI and 
> put in a corresponding FC_LANG tag for CID-fonts.

If I can get from Unicode to CID, I can generate FC_LANG tags, but I'm not 
sure what other information belongs in fontconfig itself; remember that 
fontconfig is designed to provide information needed to select among 
fonts, not all of the information needed once you have a font in hand.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20041208/fd0e1d6b/attachment.pgp

More information about the Fontconfig mailing list