[Fontconfig] Making family names returned by FcFreeTypeQueryFace locale aware?
gzjjgod at gmail.com
Fri Dec 17 04:06:23 PST 2010
We hit a locale sensitivity issue of font family name matching
in Qt. We use fontconfig like this:
* For system fonts, we query the list of fonts with FcFontList()
and store the first family name of each result in a list,
these family names are always locale aware because the results
returned by FcFontList() are always locale aware.
* For application fonts, we construct a FTFace from the data and
use FcFreeTypeQueryFace to get a FcPattern from it, then get
the first family name in the pattern returned, store it in a
list. However, the family names returned in this pattern are
*NOT* locale aware.
The problem of above methods is the family names from the
application font list cannot be used to query a font in the
first family name list.
For instance, if I have the font "SimSun.ttc", my locale is
zh_CN.UTF-8, then the first list will have "宋体" while the
application font list will have "SimSun".
Possible solutions will be make the family names in the pattern
returned by FcFreeTypeQueryFace locale aware, or at least let
us to get id of family name in locale aware manner, currently
all the locale related functions in fontconfig are private,
thus we cannot reproduce the entire locale matching process
without duplicate fontconfig code in Qt.
More information about the Fontconfig