Re: trying to specify fonts for a specific language

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

 



OK, thanks Akira, I will give your suggestions a try.

Kind Regards,
Derek

-----Original Message-----
From: Akira TAGOH [mailto:akira@xxxxxxxxx] 
Sent: November-22-13 1:22 AM
To: Derek Leach
Cc: fontconfig@xxxxxxxxxxxxxxxxxxxxx; Joe Bishop
Subject: Re:  trying to specify fonts for a specific language

On Fri, Nov 22, 2013 at 1:07 AM, Derek Leach <DLeach@xxxxxxx> wrote:
> We have this in the fonts.conf file:
>
> <!--
>   Korean characters should be rasterized from the 'NewHD' font.
> -->
>    <match target="font">
>       <test name="lang" compare="contains"><string>ko</string></test>
>       <edit name="family" mode="prepend" binding="strong">               <-- I have also tried weak, and no binding at all -->
>               <string>NewHDR</string>
>       </edit>
>    </match>

doing like that in target="font" is wrong. that means you are about to add NewHDR family name into the matched font pattern. fontconfig already determines better font at that point. given that FontA is better for the certain query, that recipe is adding NewHDR to the pattern for FontA. which in fact just looks like an alias name for FontA.

So:
> At this point, code has discovered that NewHDB does not have 0x60c5.
> So this next code executes:
>
> lang is "ko"
> genericFamily is "sans-serif"
>
>
> FcPattern* pattern = FcPatternBuild(
>                 NULL,
>                 FC_LANG, FcTypeString, lang,
>                 FC_FAMILY, FcTypeString, genericFamily,
>                 FC_SCALABLE, FcTypeBool, true,
>                 (const char *)NULL
>         );
>
> FcConfigSubstitute(0, pattern, FcMatchPattern); 
> FcDefaultSubstitute(pattern);
>
> FcResult result;
> FcPattern* match = NULL;
> FcFontSet *fs = NULL;
> fs = FcFontSort(NULL, pattern, FcTrue, NULL, &result);

the above recipe isn't yet evaluated at this point, but target="pattern".

> At this point, 'fs' contains practically every font on the target system.
> Why not just the ones listed in the lang "ko" section, i.e. NewHDR?

Even if you do the above with target="pattern", the result from
FcFontSort() may contains patterns not matching lang="ko". it really depends on other recipes. it is just building better patterns against recipes on your box.
You need to call FcFontRenderPrepare() to evaluate target="font" and finalize to get the result of better fonts against your query, or just call FcFontMatch().

> So I guess my questions are:
>
> What's wrong with the fonts.conf lang "ko" section?
> Why does 'fs' contains all these fonts, even though we pass FC_LANG of "ko"?
> Why is NewHDB returned in 'match', even though NewHDR is the only one listed in this section?
>
> Many Thanks, sorry for all the questions! :) Derek
>
> _______________________________________________
> Fontconfig mailing list
> Fontconfig@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/fontconfig


HTH,
--
Akira TAGOH
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig




[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux