<br><div class="gmail_quote">On Wed, Oct 12, 2011 at 4:21 PM, Sergey <span dir="ltr"><<a href="mailto:asnarta@gmail.com" target="_blank">asnarta@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

We are newers in HB and have problems with using HB on Windows in our project<br>
for rendering Arabic/Indic and etc. languages. MAIN our goal while using<br>
harfbuzz is to get appropriate ligatures/replacement glyph indexes and etc. We<br>
build HB on msvc9, use FT-2.4.2 and ICU-4c-4_8_1. Our  implementation of  buffer<br>
shaping example is next:<br>
<br>
<br>
<br>
        /* Get our harfbuzz font/face structs */<br>
<br>
        hb_font_t *hb_ft_font = hb_ft_font_create(Font_Mgr::Font_Face, NULL);<br>
<br>
    hb_face_t *hb_ft_face = hb_ft_face_create(Font_Mgr::Font_Face, NULL);<br>
<br>
<br>
<br>
        hb_ft_font_set_funcs (hb_ft_font); // IS IT AS A MUST or could be ommited??<br>
<br>
<br>
<br>
        wchar_t *w_cut_text = L"عر بي";     // x0639, 0x0631, 0x0020, 0x0628, 0x064a<br>
<br>
<br>
<br>
        // INPUT string is wchar_t - NOT SURE that further conversion works well!!<br>
<br>
<br>
<br>
        uint16_t *cur_text_16 = (uint16_t*)w_cut_text;<br>
<br>
<br>
<br>
        const char *cur_lang = "ar"; // OK<br>
<br>
<br>
<br>
        /* Create a buffer for harfbuzz to use */<br>
<br>
        hb_buffer_t *buffer = hb_buffer_create(); //OK<br>
<br>
<br>
<br>
        hb_buffer_set_unicode_funcs(buffer, hb_icu_get_unicode_funcs());<br>
<br>
        // WHAT IS THE PURPOSE OF USING hb_icu_get_unicode_funcs() or what own<br>
implemtation should provide??<br>
<br>
<br>
<br>
        hb_buffer_set_direction(buffer, HB_DIRECTION_RTL); //OK<br>
<br>
        hb_buffer_set_script(buffer, HB_SCRIPT_ARABIC); //OK<br>
<br>
        hb_buffer_set_language(buffer, hb_language_from_string(cur_lang)); //OK<br>
<br>
<br>
<br>
        /* Layout the text */<br>
<br>
        hb_buffer_add_utf16 (buffer, cur_text_16, 5, 0, 5); // WHAT is the semantic<br>
usage of 3 last parameters??<br>
<br>
<br>
<br>
        hb_shape (hb_ft_font, buffer, NULL, 0);<br>
<br>
<br></blockquote><div>Try using hb_ot_shape() and see if it solves your problem. I too had used hb_shape() earlier but that didn't work, and when I used hb_ot_shape() it started working.<br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<br>
        /* Hand the layout to render */<br>
<br>
        unsigned int glyph_count = hb_buffer_get_length (buffer);<br>
<br>
        hb_glyph_info_t *glyph_infos = hb_buffer_get_glyph_infos (buffer, NULL);<br>
<br>
        hb_glyph_position_t *glyph_positions = hb_buffer_get_glyph_positions (buffer,<br>
NULL);<br>
<br>
<br>
<br>
        for (unsigned int i = 0; i < glyph_count; i++)<br>
<br>
        {<br>
<br>
                hb_glyph_info_t *info = &glyph_infos[i];<br>
<br>
                hb_glyph_position_t *pos = &glyph_positions[i];<br>
<br>
<br>
<br>
                printf ("cluster %d     glyph 0x%x at   (%d,%d)+(%d,%d)\n",<br>
<br>
                        info->cluster,<br>
<br>
                        info->codepoint,<br>
<br>
                        pos->x_offset,<br>
<br>
                        pos->x_offset,<br>
<br>
                        pos->x_advance,<br>
<br>
                        pos->y_advance);<br>
<br>
<br>
<br>
        }<br>
<br>
<br>
<br>
        hb_buffer_destroy (buffer);<br>
<br>
        hb_font_destroy (hb_ft_font);<br>
<br>
        hb_face_destroy (hb_ft_face);<br>
<br>
<br>
<br>
AS AN OUTPUT we got array of glyphs indexes in info->codepoint, but this array<br>
is the same as array of glyphs indexes, that backs FT for text<br>
<br>
 {'ع','ر',' ','ب','ي'}.<br>
<br>
 - > BUT DID NOT GET EXPECTED ligatures/replaced glyphs and etc. So, only string<br>
revers is worked good.<br>
<br>
What are we donig wrong??<br>
<br>
Could you please give any ideas or provide a sample code for a such task!<br>
<br>
THANK YOU VERY MUCH IN ADVANCED!<br>
<br>
WE ARE LOOKING FORWARD RECEIVING FEEDBACK FROM YOU!<br>
<br>
REGARDS,<br>
<br>
Sergey.<br>
<br>
_______________________________________________<br>
HarfBuzz mailing list<br>
<a href="mailto:HarfBuzz@lists.freedesktop.org" target="_blank">HarfBuzz@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/harfbuzz" target="_blank">http://lists.freedesktop.org/mailman/listinfo/harfbuzz</a><br>
</blockquote></div><br clear="all">-- <br>Thanks & Regards,<br>Shiva Kumar H R<br>