Around 9 o'clock on Jun 27, Brian Stell wrote:
> Even though "Times New Roman" is in the font list
> it won't have simplified Chinese characters. It would
> be enough if all the chars were ASCII. CJK user might
> want to specify the font used for ASCII char. Of course, as
> you point out it won't help for simplified Chinese.
I was illustrating the problem for the case when the application wanted a
single font, I think it's easier to understand in this context.
> Unicode apps such as Mozilla have the problem that
> for any given font spec the document could have any
> Unicode character. To address this Mozilla always
> creates a font list for each font specification.
Fontconfig provides the FcFontSort API for applications interested in
performing fill-in of this nature. This API sorts the available fonts by
measuring each one against the provided pattern, the list is (optionally)
trimmed so that each successive font provides additional Unicode coverage
for the list as a whole. The result is a short list of fonts which the
application can search for each codepoint.
It's this process of 'measuring' that is the tricky part. I'm attempting
to create a metric which will order fonts in reasonable ways, the current
question is how to order the relationship between family and lang.
> Mozilla fills the font list in approximately this
> order:
>
> family + language-group
> family (any-language-group)
> language-group (any-family)
> any font that has the needed character
>
> Is there some way to support a font list in Fontconfig?
Yes, this is precisely the semantic I'm aiming for in the solutions I
proposed. I would rephrase this as ordering fonts by:
1) Specified family
2) Language group
3) Generic family aliases
Now, when the application hands
Times New Roman,serif:lang=simplifiedchinese
to FcFontSort, it will receive the list:
Times New Roman
AR PL SungTiL GB
...
(other fonts in 'serif' alias)
...
Arial Unicode
Last night, I tried a relatively simple modification to Fontconfig which
requires no changes to the font configuration -- I added a distinction
between 'strong' and 'weak' values, 'strong' values are provided by the
application while 'weak' values are those substituted into the pattern
from the configuration.
'Strong' family names have higher precedence than 'lang' while 'weak'
family names have lower precedence than 'lang'.
This works when all of the fonts provide a value for 'lang', currently I
only provide 'lang' for TrueType fonts with valid OS/2 tables. One simple
kludge would be to heuristically assign 'lang' values based on Unicode
coverage; which easy enough for non-Han languages. I'm going to do some
coverage analysis of the Han fonts I have to see if I can't find some
reasonable metric which can generate a probability for each font's
suitability for a particular Han variant. I'd really like to avoid
requiring the custom configuration of each face to make this work.
As an alternative, I could add the ability to make aliases match lang as
well as family, that way you could have separate aliases for each generic
family name/lang pair. I'd like to avoid this as it seems like a
configuration problem.
Keith Packard XFree86 Core Team HP Cambridge Research Lab
_______________________________________________
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts