diff --git a/ChangeLog b/ChangeLog index c706ba2e2f..861d73da14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-07-17 Simon Budig + + * app/text/gimptext-private.h + * app/text/gimptextlayout.c + * app/text/gimptextlayout-render.c: Fix text rendering for xres != yres. + 2007-07-17 Sven Neumann * app/widgets/gimpmenudock.c (gimp_menu_dock_new): unref the context. diff --git a/app/text/gimptext-private.h b/app/text/gimptext-private.h index 473f6c506c..a4a3105d7e 100644 --- a/app/text/gimptext-private.h +++ b/app/text/gimptext-private.h @@ -32,6 +32,8 @@ struct _GimpTextLayout GObject object; GimpText *text; + gdouble xres; + gdouble yres; PangoLayout *layout; PangoRectangle extents; }; diff --git a/app/text/gimptextlayout-render.c b/app/text/gimptextlayout-render.c index 61853283d7..0734ef12af 100644 --- a/app/text/gimptextlayout-render.c +++ b/app/text/gimptextlayout-render.c @@ -198,8 +198,8 @@ gimp_text_layout_render_trafo (GimpTextLayout *layout, { GimpText *text = layout->text; - trafo->xx = text->transformation.coeff[0][0] * 65536.0; + trafo->xx = text->transformation.coeff[0][0] * 65536.0 / layout->yres * layout->xres; trafo->xy = text->transformation.coeff[0][1] * 65536.0; - trafo->yx = text->transformation.coeff[1][0] * 65536.0; + trafo->yx = text->transformation.coeff[1][0] * 65536.0 / layout->yres * layout->xres; trafo->yy = text->transformation.coeff[1][1] * 65536.0; } diff --git a/app/text/gimptextlayout.c b/app/text/gimptextlayout.c index 1ffa8c35c4..1650c91b15 100644 --- a/app/text/gimptextlayout.c +++ b/app/text/gimptextlayout.c @@ -125,6 +125,8 @@ gimp_text_layout_new (GimpText *text, layout = g_object_new (GIMP_TYPE_TEXT_LAYOUT, NULL); layout->text = g_object_ref (text); layout->layout = pango_layout_new (context); + layout->xres = xres; + layout->yres = yres; g_object_unref (context); @@ -258,6 +260,9 @@ gimp_text_layout_position (GimpTextLayout *layout) pango_layout_get_pixel_extents (layout->layout, &ink, &logical); + ink.width = ceil ((gdouble) ink.width * layout->xres / layout->yres); + logical.width = ceil ((gdouble) logical.width * layout->xres / layout->yres); + #ifdef VERBOSE g_print ("ink rect: %d x %d @ %d, %d\n", ink.width, ink.height, ink.x, ink.y);