lilypond-devel
[Top][All Lists]

## Re: towards a 'normal' Emmentaler font

 From: Werner LEMBERG Subject: Re: towards a 'normal' Emmentaler font Date: Wed, 24 Nov 2021 10:12:13 +0000 (UTC)

> While playing around with accidentals, I compared Bravura's glyph
> metrics with the ones from Emmentaler.  In short: Bravura looks like
> a 'normal' font, while Emmentaler is non-standard.

Meanwhile I came to the conclusion that this doesn't matter because...

> With 'normal' I mean that if you mix Bravura glyphs with other text,
> they behave as expected, that is, the current position on the line
> gets increased similarly to other glyphs like 'a' or 'x'.

... after re-reading the SMuFL standard I found out that this isn't
true for Bravura either.

> I want to improve the situation eventually; I think the goal should
> be to make Emmentaler glyphs have similar bounding boxes as Bravura
> (and probably all other music notation fonts not designed for
> LilyPond).

Again, I convinced myself that this isn't necessary since...

> The solution on the font side is very simple: Move all glyphs to the
> right so that 'bp' becomes zero.  This automatically gives all
> glyphs the correct advance width.  The necessary changes on the
> METAFONT side are just a few lines of code.

... there is a much cleaner solution: Provide a completely different
set of metrics to create a text version of the Emmentaler fonts:
'Emmentaler Text', similar to 'Bravura Text'.

> [Note that the DVI proof sheet output would stay as-is; the horizontal
>  shift happens at glyph shipout time, which comes later.]

I now envision an additional macro set_textchar_box, to be inserted
right after set_char_box.


set_textchar_box (<scale>, <left sidebearing>, <right sidebearing>);


If the global METAFONT parameter text_metrics is set to value 1, it
would do the following.

(1) Shift the glyph and its bounding box horizontally to the right by
the value of the 'breapth' parameter given in set_char_box.

(2) Apply <left sidebearing> and <right sidebearings>, where <left
sidebearing> shifts the glyph further to the right (so that the
left side of the bounding box is positioned at x=0), and <right
sidebearing> further extends the right side of the bounding box.

(3) Scale the glyph by <scale> to make it look good if typeset as
text.

(4) In DVI proof mode, draw the new bounding box in stead of the old
one.

Note that the goal is *not* to emulate what 'Bravura Text' is doing –
for example, it contains a poor-man's method to typeset small music
snippets with textglyphs (see
https://github.com/steinbergmedia/bravura/blob/master/redist/bravura-text.md
for more details); this is something that lilypond-book can do much
better.  The idea is rather to make the use of \markup easier by
entering Emmentaler glyphs without the need to apply \hspace,
\magnify, and other commands excessively; it would also help
packages like 'lilyglyphs' (for LaTeX) work better.

On the technical level, the Emmentaler fonts would become OpenType
Collections (which don't get the expected extension .otc but .ttc
for various reasons), containing both 'Emmentaler' and 'Emmentaler
Text' (compare this to the MS font cambria.ttc).  The glyphs with
new metrics would be composite glyphs that simply reference the glyphs
with the default metrics; this means that the size increase of the
font would be just a few kByte.

We would further need to implement WOFF2 support since neither WOFF
nor SVG support OpenType Collections.

Werner