[HarfBuzz] Support for optical 'opdb' feature(s)

Georg Duffner g.duffner at gmail.com
Sat Mar 16 10:06:42 PDT 2013


Am 2013-03-15 23:24, schrieb Khaled Hosny:
> Hi all,
>
> I’m considering the possibility of adding support for ‘opbd’ feature in
> XeTeX, and I have some questions.
>
> The OpenType feature registry description¹ is a bit contradicting, but
> my understanding is that ‘opbd’ is a merely user interface shorthand,
> and the actual features are ‘ltbd’ and ‘rtbd’.
>
> Given the nature of glyph protrusion and the way it is implemented in
> XeTeX, those features can not simply be turned on during shaping, they
> need to be applied separately after line breaking, also XeTeX needs to
> query the protrusion values independent of the shaping process as they
> can influence line breaking.
>
> I have been thinking of ways to do this without requiring a dedicating
> HarfBuzz API, something like creating a new buffer with the glyph I want
> to gets its protrusion value (with a special get_glyph() function to
> accept glyph ids instead of characters), applying ‘ltbd’ or ‘rtbd’ as
> appropriate and measuring the difference x advance/offset of the shaped
> glyph to the advance width stored in the font. But this is 1) too
> complex 2) fragile since other features that are applied by default can
> interfere.
>
> So I’m asking if HarfBuzz can provide an API to retrieve optical bounds,
> something like:
>
> hb_ot_layout_get_glyph_optical_bounds (face, gid, side)
>    if side == left:
>       query ‘ltbd’
>    else if side == right
>       query ‘rtbd’
>
>
> There aren’t any fonts with such features in the wild AFAIK, but I have
> a modified version of TeX Gyre Pagella than I used to test this feature
> in LuaTeX a while ago².
>
> Regards,
> Khaled
>
> ¹ http://www.microsoft.com/typography/otspec/features_ko.htm#opbd
> ² http://www.khaledhosny.org/files/tmp/TeXGyrePagella-Regular-opbd.otf

I started to write support for lfbd and rtbd in EB Garamond some time 
ago, but didn’t inlude it in the font. I’ve reworked it and it’s 
available now in EBGaramond12-Regular.sfdir. Not having any tool to 
test, I have no idea if I did it right. The feature file is availabale 
here: 
https://bitbucket.org/georgd/eb-garamond/src/c35e1d485685176169f7ad385e2bd99e2fed6c7c/featurefiles/Regular/opbd.fea?at=master

Best regards,
Georg



More information about the HarfBuzz mailing list