[HarfBuzz] List of languages supported by harfbuzz

Samiullah Khawaja sami.khawaja at gmail.com
Thu Jul 12 02:06:47 PDT 2012


Hi,

I have attached the screenshot with email. As you can see the last word has
2 characters separate which should be attached.

A part of code that renders the text in attached images is:

hb_buffer_t *buff = hb_buffer_create();
hb_buffer_set_unicode_funcs(buff, hb_icu_get_unicode_funcs());
hb_buffer_set_direction(buff, HB_DIRECTION_RTL);
hb_buffer_set_script(buff,HB_SCRIPT_ARABIC);
hb_buffer_set_language(buff, hb_language_from_string("ar", 2));
hb_buffer_add_utf32(buff, text,-1 , 0, -1);
hb_shape(hb_font, buff, NULL, 0);

int num_chars = hb_buffer_get_length(buff);
hb_glyph_info_t *glyphInfos = hb_buffer_get_glyph_infos(buff, &num_chars);
hb_glyph_position_t *glyphPos = hb_buffer_get_glyph_positions(buff,
&num_chars);

int count = 0;
int dst_ptr = 0;
int dst_x = 0;

for (;count < num_chars;++count)
{
    int src_y;
    unsigned int dst_y;

    glyph_index = glyphInfos[count].codepoint;

    if (FT_Load_Glyph(ft_face, glyph_index, FT_LOAD_RENDER))
        continue;

    if (FT_Get_Glyph(ft_face->glyph, ft_glyph))
        continue;

    // render glyph at dst_x + glyph_bitmap->left
    renderGlyph(ft_glyph, dst_x + glyph_bitmap->left);

    dst_x += ((glyphPos[count].x_advance) >> 6);
}

Regards,
Sami

On Thu, Jul 12, 2012 at 1:05 AM, Behdad Esfahbod <behdad at behdad.org> wrote:

> On 07/11/2012 12:10 PM, Samiullah Khawaja wrote:
> > Hi,
> >
> > I am trying to render Arabic text using harfbuzz. The problem is that
> when i
> > glue the glyphs using the x_advance most of the glyphs are glued
> correctly.
> > but in some cases there is 1 or 2 pixel distance between glyphs.
> >
> > I debugged through the harfbuzz code and was able to confirm that the
> GPOS
> > table is present in the font face. But the GPOS data doesn't seem to be
> > applied to the buffer. That is why when i get glyph positions only
> x_advance
> > values are there but the x_offset and y_offset values are always 0.
> >
> > Am I missing something here? Please help.
>
> Easiest if you post sample code and output.  I don't think anyone can help
> you
> based on the description of the problem.
>
> behdad
>
> > Thanks,
> > Sami
> >
> > On Thu, Jul 5, 2012 at 7:43 PM, Samiullah Khawaja <
> sami.khawaja at gmail.com
> > <mailto:sami.khawaja at gmail.com>> wrote:
> >
> >     Thanks guys.
> >
> >     I am trying to link ICU with harfbuzz... will update you guys with
> it.
> >
> >     Regards,
> >     Sami
> >
> >
> >     On Thu, Jul 5, 2012 at 7:37 PM, Behdad Esfahbod <behdad at behdad.org
> >     <mailto:behdad at behdad.org>> wrote:
> >
> >         On 07/05/2012 08:51 AM, Tom Hacohen wrote:
> >         > As for the unicode functions: I think they are used in
> harfbuzz only for
> >         > script detection, wide-characters and mirrored characters
> (probably
> >         more),
> >
> >         More. Fallback mark positioning, cluster formation,
> normalization.  If
> >         you are
> >         willing to give those all up, well, you may as well not use
> HarfBuzz
> >         to begin
> >         with :).   Not exactly that, but close.
> >
> >         behdad
> >
> >
> >
> >
> >     --
> >     Samiullah Khawaja
> >     Software Engineer
> >     email: sami.khawaja at gmail.com <mailto:sami.khawaja at gmail.com>
> >     voice: +(92) 0321-4184324 <tel:%2B%2892%29%200321-4184324>
> >
> >
> >
> >
> > --
> > Samiullah Khawaja
> > Software Engineer
> > email: sami.khawaja at gmail.com <mailto:sami.khawaja at gmail.com>
> > voice: +(92) 0321-4184324
>



-- 
Samiullah Khawaja
Software Engineer
email: sami.khawaja at gmail.com
voice: +(92) 0321-4184324
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/harfbuzz/attachments/20120712/2fd7ead1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: screenshot_1.png
Type: image/png
Size: 8677 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/harfbuzz/attachments/20120712/2fd7ead1/attachment.png>


More information about the HarfBuzz mailing list