[Fontconfig] How can I set priority according to style in same font family name?

Akira TAGOH akira at tagoh.org
Mon Jun 18 20:12:13 PDT 2012


Well, ideally you should add :style= to the pattern in query. actually
fontconfig doesn't do any wrong, because either of those fonts has
"Time" as the family name. it just do the right thing according to
your request. having said if you want to set "Regular" as the default
style for "Time", you can try this:

<match>
  <test name="family">
    <string>Time</string>
  </test>
  <edit name="style" mode="append">
    <string>Regular</string>
    <string>Medium</string>
    <string>Bold</string>
  </edit>
</match>

or

  <edit name="weight" mode="append">
    <int>80</int>
    <int>100</int>
    <int>200</int>
  </edit>

instead of adding "style". though I'd not recommend it unless you have
the certain reason you can't do add your requirements into the
pattern.

On Tue, Jun 19, 2012 at 11:20 AM, Deokjin Kim <deokjin81.kim at samsung.com> wrote:
> Hello all,
>
> I can set priority among different font family name using configuration file(under /etc/fonts/conf.avail).
> However, I can't set priority according to style in same font family name.
> Assume I have font files which have 3 styles(regular, meidum, bold), and family name is same(Time).
>    TimeBold.ttf, TimeMedium.ttf, and TimeRegular.ttf.
> I want to get a below result when I execute "fc-match -a".
> ...
> TimeRegular.ttf
> TimeMedium.ttf
> TimeBold.ttf
>
> But actual result is below.
> ...
> TimeBold.ttf
> TimeMedium.ttf
> TimeRegular.ttf
>
> When I check score of 3 font files, they have same score.
> So their priority is determined by lexicographic order. (i.e. B > M > R.)
> When I rename 3 font files, (For example, TimeARegular.ttf, TimeBMedium.ttf, TimeCBold.ttf)
> I can get expected result.
>
> Is there better solution?
>
> Best Regards,
> Deokjin Kim
> _______________________________________________
> Fontconfig mailing list
> Fontconfig at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/fontconfig



-- 
Akira TAGOH


More information about the Fontconfig mailing list