[HarfBuzz] Pinpointing the problem with glyph positions

Jani Brezavšček jani.brezavscek at outfit7.com
Fri Dec 22 12:26:24 UTC 2017


Hi all,

I'm trying to pinpoint a problem with my project implementation (if someone
can find the source of the problem or guide me in the right direction -
hopefully I forgot a define or something similar)

here is what I'm printing:

hb_glyph_info_t *glyphInfo = hb_buffer_get_glyph_infos(buffer, &glyphCount);
hb_glyph_position_t *glyphPos = hb_buffer_get_glyph_positions(buffer,
&glyphCount);

for(i = 0, i < glyphCount; i++) {
    printf("codepoint %d:\n   advance: %f, %f\n   offset: %f, %f\n",
           glyphInfo[i].codepoint,
           (float)glyphPos[i].x_advance, (float)glyphPos[i].y_advance,
           (float)glyphPos[i].x_offset, (float)glyphPos[i].y_offset);
}

input text: कुछ सिक्के
font size: 100
font: NotoSansDevanagari-Medium.ttf

and here is the comparison between my project and harfbuzz example

my project | harfbuzz example
------------------------------------------------------------------------
codepoint 25: | codepoint 25:
   advance: 4992, 0 | advance: 4992, 0
   offset: 0, 0 | offset: 0, 0
codepoint 69: | codepoint 69:
   advance: 0, 0 | advance: 0, 0
   offset: -4992, 0 | offset: -1428, 0
codepoint 31: | codepoint 31:
   advance: 4595, 0 | advance: 4595, 0
   offset: 0, 0 | offset: 0, 0
codepoint 3: | codepoint 3:
   advance: 1664, 0 | advance: 1664, 0
   offset: 0, 0 | offset: 0, 0
codepoint 609: | codepoint 609:
   advance: 1722, 0 | advance: 1722, 0
   offset: 0, 0 | offset: 0, 0
codepoint 60: | codepoint 60:
   advance: 4454, 0 | advance: 4454, 0
   offset: 0, 0 | offset: 0, 0
codepoint 183: | codepoint 183:
   advance: 3962, 0 | advance: 3553, 0
   offset: 0, 0 | offset: 0, 0
codepoint 25: | codepoint 25:
   advance: 4992, 0 | advance: 4992, 0
   offset: 0, 0 | offset: 0, 0
codepoint 75: | codepoint 75:
   advance: 0, 0 | advance: 0, 0
   offset: -4992, 0 | offset: -1428, 0

as you can see the diff is:
codepoint: 69 => offset
codepoint: 183 => advance
codepoint: 75 => offset

harfbuzz example (on the right) is obviously working as it should but I
can't figure out what I am doing wrong since this is harfbuzz code...

I've tried building harfbuzz with version 1.7.4 and 1.2.4 (like harfbuzz
example) ending in same result.. and thats why I hope I just forgot a
define or something similar...

Any help or push in the right directions will help a lot.

Thank you in advance!

Best regards,
Jani Brezavšček
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/harfbuzz/attachments/20171222/42adecb0/attachment.html>


More information about the HarfBuzz mailing list