[Fontconfig] FontConfig font selection problem

Akira TAGOH akira at tagoh.org
Mon Mar 12 20:43:16 PDT 2012


Please be aware that no one can tell you the better answer without the
details. this is a rough answer for the rough question. if you aren't
comfortable with it, please give us what you did, what happened and
what you were expected. otherwise there are no way to see what's wrong
in fontconfig.

On Tue, Mar 13, 2012 at 9:30 AM, Eagle Burkut <eagle.burkut at gmail.com> wrote:
> So I am here to ask your help. I have couple of questions:
>
> (1) Why does the fontconfig select the font poorly here, even selecting a
> font which does not support the required code points and or glyphs?

The possible reason is, 1) there are no better fonts against the
query. which covers the code points in ug.orth. 2) the font pattern in
the query is wrong. 3) ug.orth has a bug.

> (2) Is the any way to tell/force fontconfig to use a font for the given
> language environment / writing system / scripts?

You can put the following config to $HOME/.fonts.conf:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "/etc/fonts/fonts.dtd">
<fontconfig>
  <alias>
    <family>serif</family>
    <prefer>
        <family>Your Font Family Name</family>
    </prefer>
  </alias>
  <alias>
    <family>sans-serif</family>
    <prefer>
        <family>Your Font Family Name</family>
    </prefer>
  </alias>
  <alias>
    <family>monospace</family>
    <prefer>
        <family>Your Font Family Name</family>
    </prefer>
  </alias>
</fontconfig>

or if you want to use your font for Uyghur only:
  <match>
    <test name="lang" compare="contains">
      <string>ug</string>
    </test>
    <test name="family">
        <string>sans-serif</string>
    </test>
    <edit name="family" mode="prepend">
        <string>Your Font Family Name</string>
    </edit>
  </match>

and similar for serif and monospace too.

-- 
Akira TAGOH


More information about the Fontconfig mailing list