On 11/7/2022 12:02 AM, Jean Abou Samra wrote:
\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"
...
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).
Excellent! Thank you three times for your examples and patient
explanations!
So part of the trick is discovering which lilypond font-name to specify
in order to embed the desired font in lilypond's postscript.
My target is /Helvetica-Bold in postscript, and the wikipedia article on
Ghostscript indicates that "Nimbus Sans L" is the proper substitute for
Helvetica. So I followed your pattern and used font-name "Nimbus Sans
L", but (surprise 1) the generated postscript font was
/TeXGyreHeros-Regular. The Hello World output looked like Helvetica
but was not bold, so I specified \bold "abcxyz", but (surprise 2) that
didn't change abcxyz to bold and still used font /TeXGyreHeros-Regular.
So font-name "Nimbus Sans L" does not appear to have a bold type?
Similar thing (surprise 3) with font-name "Nimbus Sans": adding \bold
had no effect on abcxyz and the postscript font was still
/NimbusSans-Regular. Here's the code I used:
\markup
\override #'(font-name . "Nimbus Sans")
\abs-fontsize #20
\bold
"abcxyz"
Not knowing how to guess the right font-name, I removed the override and
just did \sans \bold:
\markup
\abs-fontsize #20
\sans \bold
"ABCDEFG#b in ly \sans \bold"
That of course produced output in sans bold and the postscript font it
embedded was /NimbusSans-Bold. I guess surprise 4 is that lilypond
knows about postscript font /NimbusSans-Bold but won't generate it when
\bold is specified with font-name "Nimbus Sans".
As a check, removing the \bold and doing just \sans does indeed revert
to /NimbusSans-Regular (no surprise).
So I can get my postscript to run with /NimbusSans-Bold instead of
/Helvetica-Bold. I just have to let lilypond pick the specific font
family for abcxyz based on the generic family. It works, but I'd feel
more confident if I knew the right font-name to cause /NimbusSans-Bold
to be loaded.
Am I still doing something wrong? (wouldn't be a surprise)
Jeff