harfbuzz-tutorial icon indicating copy to clipboard operation
harfbuzz-tutorial copied to clipboard

not drawing the complete letter

Open Fahad-Alsaidi opened this issue 6 years ago • 7 comments

When I try to draw letter "H" using the attached font, it appears cut from the end. out

I don't know where is the problem come from? harfbuzz or cairo ? so I hesitate to report it in main harfbuzz repository.

the font: Edw.zip

Fahad-Alsaidi avatar Oct 16 '19 04:10 Fahad-Alsaidi

HarfBuzz doesn't draw anything.

@khaledhosny

behdad avatar Oct 17 '19 18:10 behdad

Whithout checking the font, the glyph might have a -ve left side bearing and the code that is creating Cairo surface is only taking the glyph advance into account when setting the width.

khaledhosny avatar Oct 17 '19 21:10 khaledhosny

This code does not take glyph extents into account. https://github.com/harfbuzz/harfbuzz-tutorial/blob/d09b20511a0feb918c557ae3c89592bf8627baa2/hello-harfbuzz-freetype.c#L102-L110

khaledhosny avatar Oct 17 '19 21:10 khaledhosny

I meant right side bearing.

khaledhosny avatar Oct 17 '19 21:10 khaledhosny

That's actually expected. hb-view etc work the same way. User should add more margin if needed.

behdad avatar Oct 18 '19 00:10 behdad

@khaledhosny how I can add right side bearing automatically?

Fahad-Alsaidi avatar Oct 20 '19 02:10 Fahad-Alsaidi

Use hb_font_get_glyph_extents() to get the glyph bounding box and use this to calculate the ”ink” extents of the line.

khaledhosny avatar Oct 21 '19 19:10 khaledhosny