Re: pango_cairo_update_layout()



Behdad Esfahbod wrote:


Thanks Theo.  I can reproduce this.  Will look into it as time permits.  In
the mean time, mind filing a bug on bugzilla.gnome.org against pango so it
doesn't get lost?

behdad

I will do so. Thank you.
Theo



Theo Veenker wrote:
 > Behdad Esfahbod wrote:
 >> Theo Veenker wrote:
 >>> Hi,
 >>
 >> Hi,
 >>
 >>> A question regarding pango_cairo_update_layout(). The example in
 >>> http://library.gnome.org/devel/pango/stable/pango-Cairo-Rendering.html
 >>> contains the following fragment:
 > [snip]
 >>> Why is it that it doesn't make a difference whether
 >>> pango_cairo_update_layout()
>>> is called or not. The output is the same. Is it really necessary to call
 >>> this
 >>> function if only the cairo context changes? Why? In my own code I also
 >>> don't
 >>> notice any diffrence if I just drop the pango_cairo_update_layout()
 >>> call.
 >>
 >> It's very delicate.  For example, if you have hinting enabled, then
 >> the size
 >> of a layout with identity matrix may be different from one of a
 >> rotated matrix
 >> as hinting is only done with axis-aligned transforms.  And for pango
 >> to pick
 >> up the matrix from your cairo_t you need to make that function call.
 >
 > Thanks for the info. But I now noticed some condition where calling
 > pango_cairo_update_layout() has a big unexpected impact. I've created
 > a little X test application that demonstrates it (attached). The program
 > draws a string using cairo-pango. It responds to following keys:
 >  - page up/down: controls scaling factor for cairo_scale()
 >  - up/down: controls rotate angle for cairo_rotate()
 >  - 1/0: enable/disable calling pango_cairo_update_layout() before
 >         pango_cairo_show_layout()
 >  - r: recreate layout object
 >  - R: recreate both context and layout object
 >  - enter: dump image as xresult.png
 >
 > Start the program and scale up to a factor 5 (hit pgup). It now looks
 > like in attached result1.png. Hit '1' to enable calling
 > pango_cairo_update_layout().
 > Now you'll see result2.png, which is rather weird. Turn off calling
 > pango_cairo_update_layout() (hit '0') and recreate the layout (hit 'r').
 > The result stays bad. After recreating both the context and layout (hit
 > 'R')
> the output is OK again. FWIW, there is no difference (in my eyes) when the
 > image is rotated a bit.
 >
> What's going on here? I can't believe it is a font question as the output > looks perfect to me when not calling pango_cairo_update_layout(). Hopefully
 > it is just a silly error on my side.
 >
 > Could you please take a look at this Behdad?
 >
 > Regards,
 > Theo
 >
 >
 > ------------------------------------------------------------------------
 >
 >
 > ------------------------------------------------------------------------
 >




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