[HarfBuzz] Streamlining hb_font_t some more

Nikolay Sivov bunglehead at gmail.com
Mon Oct 26 08:37:30 PDT 2015


On 26.10.2015 11:30, 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.

I don't think it's that simple, according to specs you need to check 
with fsSelection (bit 7), and use sTypo* metrics only when this bit is 
set. But of course there's no guarantee that font was generated properly 
and sTypo* values are meaningful when this bit is set or garbage if it's 
not. Also this bit selector is supposed to be consistent with os/2 
version being >= 4; otherwise an option is to use usWin* metrics. And 
usWin* metrics are broken too sometimes, just recently I had to fix and 
issue when signed value was written to unsigned usWinDescent, which 
won't play nice as you can imagine. Also there is an 'hhea' table that 
could provide 'similar' functionality, but not always...

But probably more important is that this functionality doesn't seem to 
belong to harfbuzz in a first place, as it never needs global metrics 
internally (or does it?). If you only need a couple of fields it's easy 
to get them manually from font blob.


More information about the HarfBuzz mailing list