[Fontconfig] Further details on font ranking
Akira TAGOH
akira at tagoh.org
Fri Jan 14 09:38:48 UTC 2022
On Fri, Jan 14, 2022 at 7:02 AM Kévin Le Gouguec
<kevin.legouguec at gmail.com> wrote:
> (1) The weighing process described above takes place with FcFontMatch
> and FcFontSort, is that correct? Meaning that given the same
> FcPattern *p, as well as:
Basically it is but note that you need to call FcFontRenderPrepare()
yourself for the result of FcFontSort().
>
> (2) Does FcFontList sort its results according to a well-defined order?
> Empirically, I see that the order of the fonts returned by this
> function does not match what FcFontSort returns (cf. comments in
> attached snippet).
No.
>
> (3) Given two files that define the same font, say
>
> - /usr/share/fonts/truetype/foo.ttf: installed by the distro,
> lagging wrt its upstream developer,
>
> - ~/.local/share/fonts/foo.ttf: installed by the user, latest
> version from upstream,
>
> how will FcFontMatch, FcFontSort and FcFontList sort these files?
> Empirically, it seems that FcFontMatch and FcFontSort rank the
> user's file higher than the distro's, but I have no idea whether
> that's due to (a) the directory order in fonts.conf, (b) the font's
> :version attribute, (c) the font's coverage, (d) another
> well-defined quality of the font, or (e) sheer dumb luck.
The latest one has a priority. It is measured by FC_FONTVERSION. If
both are the same, it is up to the order of <dir> elements. the first
one has a priority.
>
> I ran my code snippet with FC_DEBUG=7, but the "Score" lines are
> identical for both files, so I'm not sure what to make of that:
>
> > Score 0 0 0 0 0 0 0 0 0 0 1e+99 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>
> I apologize if my questions already have documented answers. Thank you
> for your time.
>
Hope that helps,
--
Akira TAGOH
More information about the Fontconfig
mailing list