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

Simon Cozens simon at simon-cozens.org
Wed Nov 26 18:33:17 PST 2014


I don't know if this is a HB question or a general font/PDF question,
but I am trying to shape some Tibetan text with combining characters and
I can't get it working.

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]

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?

I think the font supports combining these two characters, as it seems to
look fine in a text editor. My code can render Latin combining sequences
correctly, and Arabic works as well. I don't understand why Tibetan
subjoined characters aren't playing for me.

What am I doing wrong?

Simon


More information about the HarfBuzz mailing list