Re: Font lookup ranges [was Re: Notes on Pango Xft backend]



Keith Packard <keithp keithp com> writes:

> >  b) Call FcFontSetSort() separately for each language, and somehow
> >     influence the sort order; what we'd like to do is make including
> >     the specified language tag have an weight:
> 
> Language tags are currently given greater weight than family names, but 
> given two families which both support the requested language tag, they 
> will be ordered by family name.
> 
> This algorithm is used by Mozilla and works reasonably well, as you say 
> there are still some significant issues.  One important detail -- language 
> tags are only used when attempting to disambiguate fonts with Han glyphs; 
> in all other cases, language tags are not passed to the matching routine
> at all.

Hmmm, limiting font tag usage to CJK definitely would reduce the
possible harm that could result; and probably makes sense. (At
least initially.)

Pango would simply contain a small table mapping language tags 
onto FC_LANG attributes to add.
 
> >   c) Pango adds the language tag to the pattern it feeds to 
> >      FcConfigSubstitute, and fonts.conf does pattern matching magic
> >      to provide a different "Sans-serif" alias for every language.
> > 
> > Can't say I like this too much:
> > 
> >  - Requires lots of careful configuration (more than just
> >    slapping extra fonts into "Sans-serif".) Configuration is bad.
> 
> I don't think it requires careful configuration; the config file just 
> needs to list all of the fonts that are 'sans-serif' in the definition of 
> the 'sans-serif' alias.  Once placed in the pattern, the language tag will 
> force the appropriate one to be selected in preference to the others, and 
> the preference order in the sans-serif alias definition will refine the 
> selection.
> 
> Do you think this would work:
> 
> 	if (language_tag == Han language)
> 		PatternAddInteger (FC_LANG, language_tag)
> 	FcConfigSubstitute
> 	FcFontSetSort

This is fine; I thought you were suggesting something that
would involve conditionalizing on language in fonts.conf.

> with the config file containing:
> 
> 	<alias>
> 		<family>sans-serif</family>
> 		<prefer>
> 			<family>MS Gothic</family>
> 			<family>AR PL KaitiM Big5</family>
> 			<family>Norasi</family>
> 			<family>Garuda</family>
> 			<family>Arial Unicode MS</family>
> 		</prefer>
> 	</alias>
> 
> Ask for "sans\-serif:lang=traditionalchinese" and this will pick 
> "AR PL KaitiM Big5" instead of "Arial Unicode MS".

I'm worried that with this same configuration file

We have:

 - User is running in ja_JP locale so the default language tag
   for Pango is 'ja-jp'

 - They pull up a Traditional Chinese document (not itself tagged) 
   in their word processor and see that it is a mix of MS Gothic and 
   AR PL KaitiM Big5.
 
 - They select "AR PL KaitiM Big5" from the font menu.

 - The display doesn't change because Xft is still finding 
   MS Gothic which matches the language tag.
   
If the user has explicitely chosen a font, and it has the characters,
I think there is an obligation to use it.

Regards,
                                        Owen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]