Commit 7d969021 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

need to get ascent and descent from a PangoLayoutLine. Report negative

2003-06-03  Sven Neumann  <sven@gimp.org>

	* app/text/gimptext-compat.c (text_get_extents): need to get
	ascent and descent from a PangoLayoutLine. Report negative descent
	so the function behaves like it used to in 1.2.
parent 1a37cd6e
2003-06-03 Sven Neumann <sven@gimp.org>
* app/text/gimptext-compat.c (text_get_extents): need to get
ascent and descent from a PangoLayoutLine. Report negative descent
so the function behaves like it used to in 1.2.
2003-06-03 Jakub Steiner <jimmac@ximian.com>
* themes/Default/images/stock-path-16.png
......@@ -141,7 +141,7 @@ text_get_extents (const gchar *fontname,
PangoFontDescription *font_desc;
PangoContext *context;
PangoLayout *layout;
PangoRectangle logical_rect;
PangoRectangle rect;
g_return_val_if_fail (fontname != NULL, FALSE);
g_return_val_if_fail (text != NULL, FALSE);
......@@ -157,16 +157,29 @@ text_get_extents (const gchar *fontname,
pango_layout_set_text (layout, text, -1);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
pango_layout_get_pixel_extents (layout, NULL, &rect);
if (width)
*width = logical_rect.width;
*width = rect.width;
if (height)
*height = logical_rect.height;
if (ascent)
*ascent = -logical_rect.y;
if (descent)
*descent = logical_rect.height + logical_rect.y;
*height = rect.height;
if (ascent || descent)
{
PangoLayoutIter *iter;
PangoLayoutLine *line;
iter = pango_layout_get_iter (layout);
line = pango_layout_iter_get_line (iter);
pango_layout_iter_free (iter);
pango_layout_line_get_pixel_extents (line, NULL, &rect);
if (ascent)
*ascent = PANGO_ASCENT (rect);
if (descent)
*descent = - PANGO_DESCENT (rect);
}
g_object_unref (layout);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment