Hi,<br><br>I'm using HarfBuzz with freetype to render arabic text. I must say that this library was exactly what I was looking for, great job!<br><br>Anyway I spotted something strange, I don't know if it's a bug or if it's me that didn't understand correctly the spirit behind Harfbuzz.<br>
<br>When rendering arabic letter equivalent of la , it should give me only one glyph (لا).<br><br>However, Harfbuzz render me correctly the glyph, but do not get rid of the a. See screenshot here:<br><br><a href="http://img522.yfrog.com/i/21856341.png/">http://img522.yfrog.com/i/21856341.png/</a><br>
<br><br>Here's my (simplified) render loop:<br><br>HB_ShaperItem shaper_item;<br><br> shaper_item.string = (HB_UChar16 *) g_utf8_to_utf16((gchar*)txt, -1, NULL, &numberOfWords, NULL);<br><br> shaper_item.kerning_applied = 0;<br>
shaper_item.stringLength = 0;<br> shaper_item.shaperFlags = 0;<br> shaper_item.font = &hbFont;<br> shaper_item.face = hbFace;<br> shaper_item.glyphIndicesPresent = 0;<br> shaper_item.initialGlyphCount = 0;<br>
<br> shaper_item.item.bidiLevel = 0;<br><br> out_glyphs = (HB_Glyph*)malloc(numberOfWords * sizeof(HB_Glyph));<br> memset(out_glyphs, 0, numberOfWords * sizeof(HB_Glyph));<br> out_attrs = (HB_GlyphAttributes*)malloc(numberOfWords * sizeof(HB_GlyphAttributes));<br>
memset(out_attrs, 0, numberOfWords * sizeof(HB_GlyphAttributes));<br> out_advs = (HB_Fixed*)malloc(numberOfWords * sizeof(HB_Fixed));<br> memset(out_advs, 0, numberOfWords * sizeof(HB_Fixed));<br> out_offsets = (HB_FixedPoint*)malloc(numberOfWords * sizeof(HB_FixedPoint));<br>
memset(out_offsets, 0, numberOfWords * sizeof(HB_FixedPoint));<br> out_logClusters = (unsigned short*)malloc(numberOfWords * sizeof(unsigned short));<br> memset(out_logClusters, 0, numberOfWords * sizeof(unsigned short));<br>
<br> shaper_item.glyphs = out_glyphs;<br> shaper_item.attributes = out_attrs;<br> shaper_item.advances = out_advs;<br> shaper_item.offsets = out_offsets;<br> shaper_item.log_clusters = out_logClusters;<br> shaper_item.num_glyphs = numberOfWords;<br>
shaper_item.stringLength = numberOfWords;<br><br> int l = 0;<br> while(1){<br> <br> shaper_item.num_glyphs = numberOfWords;<br> if (!hb_utf16_script_run_next(NULL, &shaper_item.item, shaper_item.string, numberOfWords , &iterator))<br>
break;<br><br> memset(out_glyphs, 0, numberOfWords * sizeof(HB_Glyph));<br> HB_ShapeItem(&shaper_item);<br> for (unsigned int j = 0; j < shaper_item.item.length; j++)<br> {<br>
ind[l++] = out_glyphs[j];<br> }<br> }<br><br>so at the end, ind contains all the index of the glyph I need to draw.<br><br>Is there a way harfbuzz can tell me to get rid of a glyph?<br><br>Thanks, Nico.<br>
<br><br>