lilypond-user
[Top][All Lists]
Advanced

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

Re: ghostscript 9.56.1 in lilypond 2.23.14 no longer finds font Helvetic


From: Jean Abou Samra
Subject: Re: ghostscript 9.56.1 in lilypond 2.23.14 no longer finds font Helvetica-Bold, but gs in 2.22.1 did
Date: Mon, 7 Nov 2022 08:02:49 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1

Le 07/11/2022 à 05:39, Jeff Olson a écrit :

Jean, please help me understand what this implies.  The above lilypond-devel thread basically ends with Harm's statement that

    It is no longer possible to specify fonts like above.
    https://lists.gnu.org/archive/html/lilypond-devel/2022-04/msg00018.html

The font specification he says is "no longer possible" is exactly like my case: \postscript "/Arial-Bold findfont", so he suggests not using \postscript.   And the thread he references ends with Jonas' reply about how lilypond's ghostscript is different than others:

    Not quite, our Ghostscript is stripped down to not include unnecessary
    stuff and that is not prepared for users doing stuff with \postscript.

Do the above responses mean there's no way to use fonts within lilypond's \postscript feature anymore?




No. It is still possible to show glyphs.

\markup {
  \postscript #"
    /C059-Roman findfont
    4 scalefont setfont
    (Hello, World!) show
    "
}



That would be a drastic change affecting users who have developed an embedded base of postscript code within lilypond.  I've been searching the v2.23 changes (https://lilypond.org/doc/v2.23/Documentation/changes-big-page.html) and there's no mention at all of "postscript" or "Ghostscript" or the need to migrate from using \postscript to \markup the way that Harm suggested.

There's only this oblique mention of fonts in the section that aimed at enthusiasts compiling LilyPond from source and packagers preparing LilyPond for distribution ("If you are not part of either group, you can skip over this section").  It says:

    Starting with this stable release, LilyPond’s build system does
    not install text fonts anymore. Please provide them as separate
    packages while paying attention to the fonts’ license and notice
    files.




This change has nothing to do with the problem at hand, and only affects the
people it says (those who compile LilyPond themselves, and packagers). It has no user-visible consequences as far as I know (except maybe if you had PostScript code specifying fonts by their full path in the system and you're using a GNU/Linux
distro, in which case the exact path to the font might have changed).



I'm hoping the lack of a specific change notice means there's still a way to use fonts within \postscript, but the replies from Harm and Jonas suggest otherwise.

Please clarify.  For example,

  * Is \postscript inside lilypond deprecated or no longer supported?




No. It is still supported and there are currently no plans
to deprecate it. See below, however, for why you probably
don't want to use it.



  * Is the use of "findfont" within \postscript no longer supported?



I hesitate to use the word "supported" because LilyPond doesn't make
promises on what will work or not work in \postscript. But it can
still be used, see below.



  * Or are there some fonts on which findfont is still usable?




The exact change that happened is that our GhostScript no longer ships with
its own set of base fonts, to reduce its size. Therefore, "/Helvetica-Bold
findfont" no longer works because GhostScript doesn't contain that font
anymore.

Basically, for a font to work, it needs to be loaded by LilyPond into
the PostScript file. LilyPond does this loading when it actually has
some text with that font to show. For example, this works for me:

\version "2.23.80"

\markup {
\postscript "
    /NimbusSans-Regular findfont
    4 scalefont setfont
    (Hello, World!) show
    "
}

\markup
\override #'(font-name . "Nimbus Sans")
\translate #'(100 . 0)
"abcxyz"



The second \markup uses the Nimbus Sans font in a way that
is transparent to LilyPond, which causes it to be embedded in
the output PostScript file. \translate makes sure this text
goes out of the page.

N.B. The way I found "NimbusSans-Regular" was by running
LilyPond with --ps and looking at the generated PostScript
code (search for BeginResource in it).

Also, note that in order to use a font in this way, you
need it installed on your system. In your case, either
you use Nimbus Sans, which is packaged with LilyPond (yes,
with LilyPond, not with the GhostScript embedded inside
LilyPond), or you install Helvetica.



  * E.g., should findfont still work on the font families listed in
    https://lilypond.org/doc/v2.23/Documentation/notation/fonts#font-families?



See above.



  * Or is there a way a font-name override declared outside of
    \postscript can be referenced by findfont inside a \postscript block?




See above.



In other words, perhaps, what's the verdict on \postscript in lilypond?



\postscript is a command that gives you great power, and great power
comes with great responsibility. Basic stuff like drawing paths is
unlikely to break, stuff like loading fonts or relying on how exactly
LilyPond generates its own PostScript output is inherently meddling
with deep LilyPond internals and therefore will break when the internals
change. I would not recommend using \postscript unless you really need
to.

There are advantages other than stability, too. For example, while
PostScript code is a black box to LilyPond, for normal markup LilyPond
is able to get the outline of the text and use it for accurate
spacing. Compare:

\version "2.23.80"

#(ly:set-option 'debug-skylines)

{
  c'^\markup {
      \postscript "
          /NimbusSans-Regular findfont
          2 scalefont setfont
          (Hello, World!) show
          "
      }
  \break
  c'\tweak font-family "Nimbus Sans" ^"Hello, World!"
}


\markup
\override #'(font-name . "Nimbus Sans")
\translate #'(100 . 0)
"abcxyz"




Regards,
Jean


Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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