[Fontconfig] Font matching in Unicode locales

Owen Taylor otaylor at redhat.com
Sun Oct 26 01:52:34 EST 2003


On Sat, 2003-10-25 at 11:36, John Alexander Thacker wrote:
> On Sat, Oct 25, 2003 at 09:35:24AM -0400, Owen Taylor wrote:
> > Well, actually, you are almost certainly going to have to tell the
> > rendering system that you are rendering Japanese to get good results
> > when you render Japanese. There is no reliable automatic way to tell
> > that text is in Japanese rather than Chinese or Korean.
> 
> Sure, that's true, although it still should be possible to set a 
> preferred CJK font for rending Han characters, IMO.

Yes, with the Pango-1.4 scheme, that will work as expected - 
you'll get a language tag of ?? so the ordering in your Sans
alias will be respected.
 
> > It's also possible to put magic in your fonts.conf to replace 'en'
> > language tags with 'en,ja'. That would be an immediate workaround
> > for your problem, though I don't consider it a solution.
> 
> Wouldn't the right workaround be to replace "ja" with "ja,en" instead?
> I want to make the Japanese fonts available under an English Unicode
> locale, right?  Now, in the current Fedora Core release, you made a 
> workaround since language matching doesn't work correctly, so I guess
> I have to match on the font names explicitly.  I thought the correct
> syntax should look like:
> 
> <match target="font">
> 	<test name="family" compare="eq">
>         	<string>Kochi Mincho</string>
>         </test>
> 	<edit name="lang" mode="append">
> 		<string>en</string>
> 	</edit>
> </match>
> 
> But this doesn't seem to have any effect.  Nor does putting a comma
> before "en" work.  Using "assign" instead of "append" and trying to
> assign "ja,en" doesn't work either.  It seems that no matter what I
> do, Kochi Mincho keeps the same list of supported languages, according
> to fc-list.  Perhaps I have the syntax wrong?

<match target="font"> applies when fontconfig has found the final font,
not to the patterns that are matched against.

Basically, how it works is:

 Apply <match target="pattern> rules to the pattern
 Match against all fonts on the system
 Apply <match target="font"> rules to the result

In the original that you are copied, what it is doing is saying 
"When you find Kochi Mincho, don't prefer embedded bitmaps".

What you want to say is "When someone is looking for English fonts,
Japanese fonts are OK too".

Something like:

<match target="pattern">
          <test name="lang" compare="eq">
         	<string>en</string>
        </test>
	<edit name="lang" mode="append">
		<stringja</string>
	</edit>
</match>

Regards,
						Owen






More information about the Fontconfig mailing list