wrong pixel extents retrieved from PangoLayout of arabic text



Hello,

I am facing an issue related to the pixel extents of PangoLayout.
Here is what I have done.


I am rendering Arabic Text.

         gunichar2 text[] = {  0x0644, 0x0627, 0x0020, 0x064A, 0x0648, 0x062C, 0x062F, 0x0020, 0x0645, 0x0644, 0x0641, 0x0020, 0x0641, 0x064A, 0x062F, 0x064A, 0x0648, 0x0020, 0x0645, 0x062A, 0x0627, 0x062D, 0x0020, 0x062D, 0x0627, 0x0644, 0x064A, 0x064B, 0x0627, 0x002E, 0 };

char* inputStr = g_utf16_to_utf8(text, 28, &itemsRead, &itemsWritten, &error);
pango_layout_set_text(layout, (const char*)inputStr, -1);

I have set the height, width and other parameters of PangoLayout.

pango_layout_set_height(layout,100*PANGO_SCALE);
pango_layout_set_width(layout,215*PANGO_SCALE);
pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
pango_layout_set_wrap(layout, PANGO_WRAP_CHAR);

On output, it appeared to me as if the left-most portion of the text was getting clipped. Hence, I printed the pixel-extents of the PangoLayout.   
(Output image:  https://sites.google.com/site/fontengine/issue)


This is what I got:

logical_rect:
x: -6
y:  0
w:  227
h:  72

ink_rect
x: -5
y:  8
w: 226
h:  64

I don't understand how can I get a negitive x OR, a width greater than the width that I have manually set on PangoLayout
Moreover, I found that this issue occurs only in case of arabic text. 

Is this a known bug? OR, have I done some mistake here?

My source code (test.cpp) has been shared here:  https://sites.google.com/site/fontengine/issue/

Thanks a lot.

--
Parth 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]