[Fontconfig] Detecting whether a font is a fallback

Jean Abou Samra jean at abou-samra.fr
Thu Apr 20 09:22:36 UTC 2023


Le jeudi 20 avril 2023 à 21:13 +1200, Lawrence D'Oliveiro a écrit :

> 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](https://github.com/ldo/harfpy_examples/blob/master/font_features)>.)


If we were starting the LilyPond project today, that might make sense. However, there are plenty of existing LilyPond files that use font family names like “times new roman” that are substituted with “Times New Roman”, and I think we'd rather not start making those emit warnings.

Thanks,

Jean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/fontconfig/attachments/20230420/273d4ff0/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/fontconfig/attachments/20230420/273d4ff0/attachment.sig>


More information about the Fontconfig mailing list