[Fontconfig] Font match quality score?
Raimund Steger
rs at mytum.de
Sun Oct 28 07:58:52 PDT 2012
mathog wrote:
> [...]
>
> Is there currently some way to get fontconfig to reveal how good a match
> was found? If not,
> could it please be enhanced to return some sort of quality score? For
> instance "10" for
fontconfig uses a score internally in the matching stage, but it's (1)
not stable, (2) has only relative meaning and (3) has nothing to do with
font metrics, as it only covers the properties available in the
fontconfig cache.
In your case, a good match would be one that is 100% metric-compatible.
However, this is not possible to determine with the data available to
fontconfig; it would imply that the metrics data for all missing fonts
was somehow available.
The most strict implementation would be one that requires family name
equality, but in this case you'd miss a number of good aliases.
A not as strict implementation would be based on Behdad's suggestion:
http://thread.gmane.org/gmane.comp.fonts.fontconfig/4251
Another possible method is to use a restricted fontconfig configuration
that you know only maps to metric-compatible aliases. With the exception
of a few configuration files that are in fontconfig's default set (but
are probably not guaranteed to remain in it forever), you'd have to
write that yourself (and accept the fact that with it you ignore any
configuration done by users/admins etc).
Maybe you could also check bounding boxes of the text you render (if you
know them for sure) and squeeze your fonts with <matrix> elements.
In any case, I'd be careful not to overengineer stuff.
Raimund
--
Worringer Str 31 Duesseldorf 40211 DE home: <rs at mytum.de>
+49-179-2981632 icq 16845346 work: <rs at interface-ag.de>
More information about the Fontconfig
mailing list