lilypond-user
[Top][All Lists]
Advanced

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

Questions regarding creation of a new glyph (was: White diamond, black d


From: Maximilian Albert
Subject: Questions regarding creation of a new glyph (was: White diamond, black diamond, and possible small sponsorship?)
Date: Tue, 23 Jan 2007 16:03:04 +0100
User-agent: IceDove 1.5.0.9 (X11/20061220)

Hi everyone,

a couple of days ago Trevor asked for help with regard to a certain
special note head (a black diamond of 'harmonic' style, where a white
one already existed). Since Trevor sent his initial request on the
lilypond-user list but I feel that -devel is the right place to get the
information I need, I'm sending this to both lists (just in case other
users who don't read -devel are interested, too).

I just saw that there has been another reply which tries to achieve the
wanted output with syntax tweaks. This was my first approach, too -- an
unsuccessful one, though. Since for some time I have been looking for an
opportunity to dive into lilypond's internals and get acquainted a bit
with the source code, I decided to check out a git version and start
experimenting, trying to make "sophisticated guesses".

Contrary to my expectations :), I finally succeeded to create the glyph
as requested, but there are still some open questions and since I only
started to scratch the surface of some of the topics involved, I would
be grateful for some advice. Be warned that I am a complete beginner
with regard to font issues, so all of my "insights" are gained from
reading the source and trying to make sense of it.

However, if everything is OK (or if I am told what I did wrong) and
there is interest I can easily provide a patch to include the black
diamond in future releases.


On to my questions:

1) Is it correct that all I need to do in order to create a new glyph is
to modify the metafont source file of the corresponding font? That is,
are all the other files (*.otf, *.svg, etc.) created during the
compilation process of lilypond? (My experiments seem to indicate this).

2) The definition of the existing white diamond-shaped head is contained
in the file 'mf/parmesan-heads.mf'. What I basically did was copy the
existing definition and change the description of the glyph, its name (I
chose "s2harmonic" -- see question 3+4 below) and the function which
draws it. Correct so far?
Inspecting the other font formats I saw that the svg files sometimes
contain unicode numbers of the glyphs (although not for the parmesan
font, as it seems). Do I have to take care of that and other related
issues or can I ignore these aspects and rely on the compilation process
to sort it all out?

3) After compiling the source it is possible to use the new glyph by
explicitly setting

  \once \override NoteHead #'style = #'harmonic
  \once \override NoteHead #'glyph-name = #'"2harmonic"

.
(BTW, the definition in mf/parmesan-heads.mf is 's2harmonic' -- what
causes the leading 's' to be inserted in the name?).
Now with neomensural instead of harmonic style, lilypond prints the
black notehead automatically when the note has quarter duration. This
automatic recognition of the "correct" head does not work yet with the
new harmonic glyph. Which further changes in the source are required to
implement this? I hoped that the digit "2" in the name would be enough
to tell lilypond to use the black head (similar to the neomensural
case), but I was wrong. Any hints? If this behaviour is not related to
the glyph name, would it be better to rename it to "s1harmonic" instead
(because "s0harmonic" already exists) or even to something completey
different?

4) In the *.mf file there already exists a function called
"draw_neomensural_black_head" which draws a black diamond of the
required shape. It is called when drawing the open diamond (the black
head is overwritten with a smaller white one to create the open
notehead). Since the functionality is already there -- is there a good
reason why the black diamond is not yet included as a separate glyph in
the font? I have no experience whatsoever with ancient or other special
noteheads so maybe it doesn't make sense to have a black diamond in the
'harmonic' style. Should a new style containing this single glyph be
created? If so, what would be a good name?

5) IIRC, some time ago there were other questions related to fonts which
mentioned the inadequacy of certain formats and suggested a conversion
of the fonts. Since font issues are still a rather closed book to me --
is the *.mf file the right place at all to make changes? Does it maybe
make more sense to modify other formats? If so, how? (I first tried to
use fontforge but did not really manage to correctly export the file
into the various formats, that's why I decided to dive into the metafont
source directly).

6) Possibly this is related to question 5: After compiling my modified
git version of lilypond and processing a sample *.ly file, all the
glyphs (including, e.g., clefs) seem to have rather "rough" outlines
when viewing the *.pdf output with xpdf (on Debian Linux). Increasing
the zoom level smoothens them out a bit, which indicates that it is
probably only a viewing problem (in addition, they appear perfectly
smooth in Acrobat Reader). But since the font files shipped with the
"official" binary do not show this behaviour -- am I missing something?
Is there another way to compile the fonts which makes them behave more
nicely?


Sorry for the plethora of questions and my verbosity (it's hard for me
to write really concise English ...). Also, please excuse if some of my
questions are redundant or even irrelevant if you are more into the
subject. But I wanted to make sure I had not overlooked anything.


Many thanks, kind regards and once more a huge compliment to all
developers and contributors for such a _great_ piece of software,

Max




reply via email to

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