Hans Aberg wrote:
Graham,
Do you what types of fonts that LilyPond can use? - Behnam Rassi he says
he only knows how to make music fonts.
There are two ways Lilypond loads its fonts: music fonts and
Pango fonts. The music fonts start out as Metafont and get
converted to OTF along with some special tables that I never
sorted out. Music fonts are what Lilypond uses by default
for accidentals so that's the best way to go. And once
somebody's drawn them they're likely to get added to the
standard fonts I'd have thought if we're only talking two
new glyphs.
The Pango route is a bit of a hack. The accidental engraver
is a bit picky about what fonts it can work with. You can't
load a font by name but you can load one of the system fonts
and use it in a markup block. But as it's very useful, and
can be used with a variety of third-party fonts (whatever
Pango supports, to answer you question) I'll explain how it
works.
The first step, then is to load you font into the system. I
get Sagittal like this:
\paper{
newStaffSize = #20
#(define fonts (make-pango-font-tree "Century Schoolbook L"
"Sagittal"
"Bitstream Vera Sans Mono"
(/ newStaffSize 20)))
}
"Sagittal" is the one I use for the accidentals. The other
two have to be on your system. I've discovered that the
sans font is used by default for chord symbols so overriding
the typewriter font may be safer.
Then you need to set glyphs from the music font the way you
always did because some redundant code is still active. For
this example the alist is called "tripodGlyphs". After
that, something like this:
tripodStrings = #'(
(3/5 . "\xe2\x88\x86") ;rightscrolltripleup, 15:14
(-11/100 . "\xc3\xba") ;rightarcup, 7-comma
(1/10 . "\xc3\xb6") ;leftbarbup, 25:24
( 0 . "\xc3\xaa") ;natural
(-1/10 . "\xc3\x9c") ;leftbarbdown, 25:24
(-11/100 . "\xc3\x91") ;rightarcdown, 7-comma
(-1/5 . "\xc3\x87") ;rightbarbdown, 2/60
(-2/5 . "\x68") ;rightarcdoubledown
(-3/5 . "\x5a") ;rightscrolltripledown, 14:15
)
The strings are the accidentals you want to show in UTF-8
format (there is a function to convert to UTF-8).
Then add this code:
#(define (accidental-text grob)
(cdr (assoc (ly:grob-property grob 'alteration)
tripodStrings)))
And wire everything up:
\layout {
\context {
\Score
\override Accidental #'stencil = #ly:text-interface::print
\override Accidental #'text = #accidental-text
\override Accidental #'font-family = #'sans
\override Accidental #'font-size = #4
\override Accidental #'glyph-name-alist = \tripodGlyphs
\override Accidental #'Y-extent = #'(-1 . 1)
}
}
The font-size is because they come out too small by default.
The Y-extend is because Lilypond allows way too much
vertical space by default. If you're conscientious you'll
make the X- and Y-extents into functions so that you can
specify the size of each glyph.
These examples are taken from the code to my tripod notation
exposition:
http://x31eq.com/magic/tripod-code.zip
Graham
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user