[HarfBuzz] Streamlining hb_font_t some more
Simon Cozens
simon at simon-cozens.org
Mon Oct 26 01:30:20 PDT 2015
On 09/10/2015 15:09, Khaled Hosny wrote:
>> should just use the typographical ascender/descender of the font and hence not
>> need glyph bounding boxes in Sile at all.
>
> Yes please, an approach similar to what browsers do would be much
> appreciated.
OK; I've implemented support in Harfbuzz for getting these metrics out
of the OS/2 table.
Now that I've fiddled about with it, I don't agree that the correct way
to determine line space for *print* is the way that browsers do it - I'm
actually more convinced that using glyph metrics makes the most sense.
The problem comes when you have mixed font sizes (not something that
really *should* happen in print, I know, but I still want to do the
right thing when it does). The question is, what is the right way to lay out
1) \font[size=30pt]{Lorem} ipsum dolor...
and
2) \font[size=30pt]{Lorem ipsum} dolor...
In InDesign, both (1) and (2) get 12 x 1.2 = 14.4pt interline space.
This means that the descender of the "p" in "ipsum" will bump into
letters on the next line. That's clearly wrong.
In the CSS model, both (1) and (2) get half leading added to the top and
the bottom of the first line. So there is a gap between the first and
second lines of (1) even though there is no large descender using that
gap. That's not *wrong* but I don't like it. Imagine a large drop-cap
"T" at the start of a paragraph - the line spacing after it becomes
inconsistent.
I am not a typographer, I just play one on the Internet, so I am not
sure what someone who was actually typesetting a book would do in that
situation. My guess would be that they would, basically, do what SILE
does right now (and what TeX does; perhaps Knuth knew what he was doing
after all) - use consistent 14.4pt (or whatever) line spacing in
situation (1) and use larger line spacing which fits in the descender in
situation (2). But I would have to ask a real typesetter to know.
S
More information about the HarfBuzz
mailing list