lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Check if a font is currently installed


From: Paolo Prete
Subject: Re: Check if a font is currently installed
Date: Sun, 21 Nov 2021 20:01:53 +0100

What I mean is that a font-name attribute can be in the form:

"Bitstream Vera Sans, sans-serif, Oblique Bold"

If you want to check that the font-name is accepted, you have to inspect the output of the list and then see if it can be a valid combination of font + style attributes
(see: http://lilypond.org/doc/v2.21/Documentation/notation/fonts#single-entry-fonts)

This is not what I was searching for. I would like to automatize this check, so to prevent LilyPond to compile the score (or raise a warning) if the font is not found, with a function like:

\checkFont "Bitstream Vera Sans, sans-serif, Oblique Bold"

 (ly:font-config-get-font-file font-name) appears the only scheme function candidate for this, but unfortunately it defaults to some system font when the wanted font-name does not correspond to any file.

Best,
P



On Sun, Nov 21, 2021 at 7:38 PM David Wright <lilylis@lionunicorn.co.uk> wrote:
On Sun 21 Nov 2021 at 19:12:33 (+0100), Paolo Prete wrote:
> On Sun, Nov 21, 2021 at 6:37 PM David Wright wrote:
> > On Sun 21 Nov 2021 at 17:29:37 (+0100), Paolo Prete wrote:
> > >
> > > it would be useful to have a functions that checks if a font with a
> > > specific font-name is currently installed, so to have the produced score
> > > without visual errors that are not always easy to detect.
> >
> > Would the list produced by this snippet help? I can't help you
> > parse the output as I'm not a scheme programmer.
> >
> > > I searched a bit in the list of the scheme helper functions, and could
> > find only:
> > >
> > > ly:font-config-get-font-file font-name
> > >
> > > However, in case the file is not found, it defaults to some font that (I
> > > suppose) is OS dependent, then I don't know  how to check if the searched
> > > font is really installed. Any idea about this?
> >
> Sorry, it doesn't help.
> It just shows a long list of the available fonts.
> Not what I was searching for...

Does that mean that your 'specific font-name' would not appear in
that long list of available fonts, or that if it appeared, that still
wouldn't be a sufficient indication that what you wanted from that
font was actually available, ie some attribute might not be present.

Cheers,
David.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]