[HarfBuzz] Arabic shaping questions

Deron Kazmaier deron at pagestream.org
Tue Jan 18 21:59:51 PST 2011


Just a little additional information. The font (a truetype sold by 
Linotype as an "OpenType" font) includes an "arab" script and "ARA " 
language defined in various tables (kern, mark, mkmk, locl, ccmp, fina, 
medi, init, isol, rlig, dlig, frac, pnum, and calt).

Changing hb_buffer_set_language() to:

hb_buffer_set_language (hb_buffer, hb_ot_tag_to_language 
(HB_TAG('A','R','A',' ')));

made no difference.

However, I downloaded the font Thabit, and using the same code I get the 
same rendering as other apps! The key difference in my debug output:

  outputchar 338 (1575) offset:0,0 advance:199040,0
   outputchar 657 (65198) offset:0,0 advance:199040,0
   outputchar 719 (65260) offset:0,0 advance:199040,0
   outputchar 682 (65223) offset:0,0 advance:199040,0
   outputchar 3 (32) offset:0,0 advance:199040,0
   outputchar 713 (65254) offset:0,0 advance:199040,0
   outputchar 727 (65268) offset:0,0 advance:199040,0
   outputchar 715 (65256) offset:0,0 advance:199040,0
   outputchar 638 (65179) offset:0,0 advance:199040,0
   outputchar 734 (65275) offset:0,0 advance:199040,0
   outputchar 338 (1575) offset:0,0 advance:199040,0

Where the glyphs appear to have been substituted with the proper forms. 
Similar positive results using the font Naqsh.

So, is something missing from this Frutiger font that Harfbuzz requires? 
I can't say that it is a defective font (brand new from Linotype, must 
be good, right ;-), so is this a font that requires code not yet 
written?? Or something I am not handling on my end?

Thanks,

Deron


On 1/17/11 10:02 PM, Deron Kazmaier wrote:
> Hi,
>
> Playing with harfbuzz this evening and I'm not getting what I 
> expected. The string I am trying to render is:
>
> ‎الاثنين ظهرا
>
> And the font I'm using is Frutiger LT Arabic 55 Roman (if some other 
> font might work better, I'm happy to try it, but this one worked on 
> Mac and Windows in various apps so I figured all was good with it).
>
> hb_buffer_set_direction (hb_buffer, HB_DIRECTION_RTL);
> hb_buffer_set_script (hb_buffer, HB_SCRIPT_ARABIC);
> hb_buffer_set_language (hb_buffer, hb_language_from_string ("ar"));
>
> Not 100% about the set_language call. That was the best I could suse out.
>
> I've cobbled together my own implementation of the unicode functions, 
> and dumped the requests. They match the Unicode database so that is 
> not the problem.
>
> Here is the output I have put in. It should be clear what is going on, 
> but if not just ask. The important part is that the letters get 
> reversed, but no actual joining is performed.
>
> Thanks for any ideas on what I've got going wrong!
>
> Deron
>
> /* calling hb_buffer_add_glyph, number is decimal unicode */
> add_glyph 1575
> add_glyph 1604
> add_glyph 1575
> add_glyph 1579
> add_glyph 1606
> add_glyph 1610
> add_glyph 1606
> add_glyph 32
> add_glyph 1592
> add_glyph 1607
> add_glyph 1585
> add_glyph 1575
> get_general_category 1604 (644) ->7 /* decimal unicode, hex unicode, 
> general category */
> get_combining_class 1604 (644) ->0 /* decimal unicode, hex unicode, 
> combing class */
> get_general_category 1575 (627) ->7
> get_combining_class 1575 (627) ->0
> get_general_category 1579 (62B) ->7
> get_combining_class 1579 (62B) ->0
> get_general_category 1606 (646) ->7
> get_combining_class 1606 (646) ->0
> get_general_category 1610 (64A) ->7
> get_combining_class 1610 (64A) ->0
> get_general_category 1606 (646) ->7
> get_combining_class 1606 (646) ->0
> get_general_category 32 (20) ->29
> get_combining_class 32 (20) ->0
> get_general_category 1592 (638) ->7
> get_combining_class 1592 (638) ->0
> get_general_category 1607 (647) ->7
> get_combining_class 1607 (647) ->0
> get_general_category 1585 (631) ->7
> get_combining_class 1585 (631) ->0
> get_general_category 1575 (627) ->7
> get_combining_class 1575 (627) ->0
> get_mirroring 1575 (627) -> 1575
> get_mirroring 1604 (644) -> 1604
> get_mirroring 1575 (627) -> 1575
> get_mirroring 1579 (62B) -> 1579
> get_mirroring 1606 (646) -> 1606
> get_mirroring 1610 (64A) -> 1610
> get_mirroring 1606 (646) -> 1606
> get_mirroring 32 (20) -> 32
> get_mirroring 1592 (638) -> 1592
> get_mirroring 1607 (647) -> 1607
> get_mirroring 1585 (631) -> 1585
> get_mirroring 1575 (627) -> 1575
> get_glyph 1575 -> 275
> get_glyph 1604 -> 355
> get_glyph 1575 -> 275
> get_glyph 1579 -> 287
> get_glyph 1606 -> 363
> get_glyph 1610 -> 378
> get_glyph 1606 -> 363
> get_glyph 32 -> 1
> get_glyph 1592 -> 331
> get_glyph 1607 -> 367
> get_glyph 1585 -> 307
> get_glyph 1575 -> 275
> get_glyph_advance 275: 84352
> get_glyph_advance 355: 207040
> get_glyph_advance 275: 84352
> get_glyph_advance 287: 281536
> get_glyph_advance 363: 204544
> get_glyph_advance 378: 231552
> get_glyph_advance 363: 204544
> get_glyph_advance 1: 88896
> get_glyph_advance 331: 238272
> get_glyph_advance 367: 139840
> get_glyph_advance 307: 100160
> get_glyph_advance 275: 84352
> get_kerning 275 307: 0
> get_kerning 307 367: 0
> get_kerning 367 331: 0
> get_kerning 331 1: 0
> get_kerning 1 363: 0
> get_kerning 363 378: 0
> get_kerning 378 363: 0
> get_kerning 363 287: 0
> get_kerning 287 275: 0
> get_kerning 275 355: 0
> get_kerning 355 275: 0
>
> /* hb_shape results */
>
> outputchar 275 (1575) offset:0,0 advance:84352,0
> outputchar 307 (1585) offset:0,0 advance:100160,0
> outputchar 367 (1607) offset:0,0 advance:139840,0
> outputchar 331 (1592) offset:0,0 advance:238272,0
> outputchar 1 (32) offset:0,0 advance:88896,0
> outputchar 363 (1606) offset:0,0 advance:204544,0
> outputchar 378 (1610) offset:0,0 advance:231552,0
> outputchar 363 (1606) offset:0,0 advance:204544,0
> outputchar 287 (1579) offset:0,0 advance:281536,0
> outputchar 275 (1575) offset:0,0 advance:84352,0
> outputchar 355 (1604) offset:0,0 advance:207040,0
> outputchar 275 (1575) offset:0,0 advance:84352,0
>




More information about the HarfBuzz mailing list