[cairo] GTK+ cairo canvas widget

Behdad Esfahbod behdad at cs.toronto.edu
Wed Dec 7 16:34:19 PST 2005


On Wed, 7 Dec 2005, Damon Chaplin wrote:

> On Tue, 2005-12-06 at 10:55 -0500, Behdad Esfahbod wrote:
> > On Tue, 6 Dec 2005, Damon Chaplin wrote:
> >
> > > Also, currently the layout of the text (using Pango) changes when you
> > > zoom in/out, even though I've used CAIRO_HINT_METRICS_OFF. If anyone
> > > knows a way to fix that I'd really appreciate it.
> >
> > There is a bug in Pango bugzilla suggesting that this doesn't
> > work.  Good to find the cause in cairo.
>
> After getting the latest Pango & cairo from cvs the problem got a lot
> worse. The layout only changed slightly before (with code from early
> September), but now the text seems to get scaled twice.
>
> If I do this everything seems to work perfectly::
>
>    layout = pango_cairo_create_layout (cr);
>    cairo_scale (cr, view->pixels_per_unit, view->pixels_per_unit);
>
> (Note that I should really call pango_cairo_update_layout() after
> calling cairo_scale(), but then it doesn't work again.)
>
>
> If I do them the other way round, as I need to, the text seems to be
> scaled twice (e.g. when it should be double the size it is 4 times the
> size, and when it should be 1/2 the size it is 1/4 the size):
>
>    cairo_scale (cr, view->pixels_per_unit, view->pixels_per_unit);
>    layout = pango_cairo_create_layout (cr);
>
>
> The rest of my code is exactly the same - same font size, layout width
> etc. So I'd guess it is a Pango bug (unless I've misunderstood how it is
> supposed to be used with cairo).

Can you file a bug with Pango please and attach a complete test
case?  I will look into it.



> Damon

--behdad
http://behdad.org/

"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
	-- Dan Bern, "New American Language"


More information about the cairo mailing list