Hi "lily4jeditors",
This was something I enountered yesterday that left me wondering for sometime.
There are three character in the lilypond font that will be required
to display a single semiquaver note - the notehead, the stem, and the
tail. Now i guess ideally what needs to be done is to place them in a
string, as in quarter_notehead, stem up, tail for stem up.
The problem that I encountered is that the notehead is in the center
of the verticle alignment which is correct but the tail for stem up is
in the bottom half of verticle aligment. The tail for stem down in
should to be in the bottom half, yet it is in the upper half of the
verticle alignment.
So I was wonder if this was a mistake during the design of the fonts
or there is a reason why I have not thought about. I wonder if this is
a reason why there is a
stem-attachment-function (procedure)
note-head-style->attachment-coordinates
A function that calculates where a stem attaches to the note head?
This is a fallback when this information is not specified in the font.
The function takes a grob and axis argument, and returns a (x . y)
pair, specifying location in terms of note head bounding box.
under the lilypond internals.
So to go around this problem, I thought of 2 methods.
1) draw the note head. then if its going to be a stem up, draw the
stem which is in the upper half alignment. now calculate the
coordinates up and left to the notehead and draw the tail over there.
2) draw the notehead. the we place the stem in the lower half with the
stem up tail (which also is in the bottom half) in a string. then we
draw this stem and tail string in the adjusted coordinates.
for both, the adjusted coordinates is determined by the height of the
font and width of the character.
I chose to go for method 2. How are your understanding and views on this?
Joshua
|