[HarfBuzz] Unsure how to use HB output to combine characters

Martin Hosken mhosken at gmail.com
Fri Nov 28 01:22:26 PST 2014


Dear Simon,

> When I try to shape the diglyph སྐ (TIBETAN LETTER SA U+0F66, TIBETAN
> SUBJOINED LETTER KA U+0F90) in the Kokonor font I get back two glyph
> values, 118 and 160:
> 
> 1: (སྐ)
> 1: <U+0F66,U+0F90>
> 1: [118=0+1539|160=0+0]

Is it that the Kokonor font has the diacritics as overstriking, i.e. with a negative x-min (and probably x-max too)? This would account for all the advance being on the base character and none on the diacritic.

> 
> The glyph_pos structures (using a scaled font via hb_ft_font_create) for
> each glyph look like this:
> 
> { x_advance = 375, y_advance = 0, x_offset = 0, y_offset = 0 }
> { x_advance = 0, y_advance = 0, x_offset = 0, y_offset = 0 }
> 
> That all seems fine, I think. (I'm confused why I should be advancing
> after the first glyph and then not after the combining character, but I
> don't think that's actually the problem here.)
> 
> Next I output that glyph string in my PDF document, where it looks like
> "Td[<007600a0>]TJ". (I have been spending too much time reading PDF
> documents in a text editor this week.)
> 
> What I see in my output is two separate glyphs next to each other, ས
> (TIBETAN LETTER SA U+0F66) and ྐ (TIBETAN SUBJOINED LETTER KA U+0F90)
> with the "hello I am a combining character" dotted circle around it.
> Shouldn't the combination be its own glyph in the font? How do I say in
> PDF-speak "combine these two glyphs together", or should the font be
> doing that for me?

That is very surprising, since the PDF viewer should not be doing any shaping. What is the world coming to if we can't trust PDF viewers to put our glyphs where we tell them! Perhaps if you munge the post table to not let on to PDF what characters the glyphs correspond to?

> What am I doing wrong?

Allowing the PDF viewer to do shaping?

GB,
Martin


More information about the HarfBuzz mailing list