app/text/gimptext-private.h app/text/gimptextlayout.c Fix text rendering

2007-07-17  Simon Budig  <simon@gimp.org>

	* app/text/gimptext-private.h
	* app/text/gimptextlayout.c
	* app/text/gimptextlayout-render.c: Fix text rendering for xres != yres.


svn path=/trunk/; revision=22943
This commit is contained in:
Simon Budig 2007-07-17 11:00:56 +00:00 committed by Simon Budig
parent 83898a0cf8
commit 340cd2f8e6
4 changed files with 15 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2007-07-17 Simon Budig <simon@gimp.org>
* 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 <sven@gimp.org>
* app/widgets/gimpmenudock.c (gimp_menu_dock_new): unref the context.

View File

@ -32,6 +32,8 @@ struct _GimpTextLayout
GObject object;
GimpText *text;
gdouble xres;
gdouble yres;
PangoLayout *layout;
PangoRectangle extents;
};

View File

@ -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;
}

View File

@ -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);