Re: wrong pixel extents retrieved from PangoLayout of arabic text



Your code works just fine for me.  Have no idea how it may behave that way for
you.  Looks like the line-breaking algorithm is somehow failing.  That's
extremely suspect.  I don't have much else to add.

behdad

On 13-04-19 07:32 AM, Parth Kanungo wrote:
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/
<https://sites.google.com/site/fontengine/issue>

Thanks a lot.

-- 
Parth 

-- 
behdad
http://behdad.org/


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