[gegl] text: correct text bounds calculation
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] text: correct text bounds calculation
- Date: Tue, 22 Nov 2016 14:55:21 +0000 (UTC)
commit 125ac625e4025a2dae33829361f131ed9785cff9
Author: Ell <ell_se yahoo com>
Date: Tue Nov 22 09:50:13 2016 -0500
text: correct text bounds calculation
Take the text offset into account; that's particularly sifnificant
when the text is not left-aligned.
operations/external/text.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/operations/external/text.c b/operations/external/text.c
index d155d45..02e594d 100644
--- a/operations/external/text.c
+++ b/operations/external/text.c
@@ -151,11 +151,12 @@ static void text_layout_text (GeglOp *self,
if (width && height)
{
- int w, h;
+ PangoRectangle extents;
- pango_layout_get_pixel_size (layout, &w, &h);
- *width = (gdouble)w;
- *height = (gdouble)h;
+ pango_layout_get_pixel_extents (layout, &extents, NULL);
+
+ *width = (gdouble) (extents.x + extents.width);
+ *height = (gdouble) (extents.y + extents.height);
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]