Folks,
recently I wanted to read the glyph of a NoteHead grob in order to use
it as model for another grob. (Background: During the investigations on
'modern' Custos styles I'm doing with Gabriel Ellsworth, we had the idea
of copying the look of the 'parent' notehead for a Custos grob).
But I was surprised that the glyph-name property is used quite
inconsistently. If I print all glyph-name properties occurring in a
simple score
\relative { \override NoteHead.style = #'baroque a4 cis'8 des? e4.
f8 \fine }
I get (see below for the code):
Clef: glyph-name "clefs.G" BarLine: glyph-name "|." Flag: glyph-name
"flags.d3" NoteHead: glyph-name "2" Dots: glyph-name "dots.dot"
NoteHead: glyph-name "2" AccidentalCautionary: glyph-name
"accidentals.flat" NoteHead: glyph-name "2" Accidental: glyph-name
"accidentals.sharp" NoteHead: glyph-name "2" Clef: glyph-name
"clefs.G_change" NoteHead: glyph-name "2"
I can understand how BarLines have a special meaning for the glyph-name
property (and this is well-documented). But while most other grobs have
an actual glyph name that I can find in the Feta font, NoteHead grobs
only have *part* of the actual glyph name in their glyph-name property.
Even worse, when one removes the NoteHead.style override, the
NoteHead.glyph-name property is not set/used at all, since the logic for
glyph selection in the default style is done in the C++. Werner's
comment in output-lib.scm (in select-head-glyph) suggests that this
design is motivated by performance considerations.
So my two questions:
1) It seems to me it would be reasonable to change the meaning of the
glyph-name property for NoteHead grobs such that it *always* (as long as
we use the default stencil routines) carries the actual glyph name in
the font. I'm aware that this might potentially break user code, but in
its current state, the glyph-name property for NoteHeads is probably not
terribly useful, and its meaning contradicts the explanation in the
internals reference. ("The glyph name within the font. In the context of
(span) bar lines, glyph-name represents a processed form of glyph, where
decisions about line breaking, etc., are already taken.")
2) I don't know enough about Scheme vs. C++ to judge whether it is
really so important to do the note head selection (for the the default
style) in C++; the current separated state seems to me to be ugly and
hard to maintain. What's your feeling on this?
Best Lukas
PS. Here's the code displaying the glyph-name settings:
\layout { \context { \Score \consists #(lambda (ctx) (let ((grobs '()))
(make-engraver (acknowledgers ((grob-interface engraver grob
source-engraver) (set! grobs (cons grob grobs)))) ((finalize engraver)
(for-each (lambda (grob) (let ((glyph-name (ly:grob-property grob
'glyph-name #f))) (when glyph-name (format #t "~a:\t\t glyph-name
\"~a\"\n" (grob::name grob) glyph-name)))) (filter grob::is-live?
grobs)))))) } }