[Fontconfig] Detecting whether a font is a fallback
Lawrence D'Oliveiro
ldo at geek-central.gen.nz
Thu Apr 20 09:13:43 UTC 2023
On Thu, 20 Apr 2023 00:56:08 +0200, Jean Abou Samra wrote:
> I could compare the two FC_FAMILY values,
> but it seems that Fontconfig does some case transformations — and
> possibly other things like replacing dashes?
If you make a note of the exact family name of the font you want, then
surely matching it again should be enough, shouldn’t it?
def find_face(family_name) :
font = ft.find_face(family_name)
if font.family_name != family_name :
warnings.warn("font “%s” not found, substituting “%s” instead" % (family_name, font.family_name))
#end if
return \
font
#end find_face
(Taken from
<https://github.com/ldo/harfpy_examples/blob/master/font_features>.)
More information about the Fontconfig
mailing list