[HarfBuzz] Streamlining hb_font_t some more

Khaled Hosny khaledhosny at eglug.org
Mon Oct 26 08:15:34 PDT 2015


On Mon, Oct 26, 2015 at 05:30:20PM +0900, Simon Cozens wrote:
> 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 with using glyph metrics is that you don’t have consistent
line spacing, for example in Arabic with a font like Amiri some lines
can contain high glyphs with stacked marks and some not and you end it
with big interline spacing between some lines, a very bad result
overall. I had to jump through hoops to get anything remotely consistent
and (by forcing the line spacing through all the document to be as big
as the biggest one and it looks rather ugly). TeX’s idea is to avoid
overlap, but this assumes that just because a line have a few tall
glyphs, it will overlap with previous line, but in practice this rarely
happens, because there are usually enough gaps in the other line to
accommodate those glyphs.

On the web I just get proper line spacing out of box, and when my
document requires bigger line spacing than the default (fully vocalised
text, for example), I just set the CSS line-spacing to a good value and
get a consistent result.

> 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.

You can always have a way to set the interline spacing overriding the
automatic calculation, just like in CSS (a sane way to do it, not the
convoluted interdependent parameters that TeX uses and only ~2 persons
in the world understand them).

Regards,
Khaled


More information about the HarfBuzz mailing list