[cairo] GTK+ cairo canvas widget

Damon Chaplin damon at karuna.uklinux.net
Wed Dec 7 16:28:05 PST 2005


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).

Damon




More information about the cairo mailing list