[perl-Goo-Canvas] Bound goo_canvas_text_get_natural_extents()
- From: Jeffrey Ratcliffe <jjr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [perl-Goo-Canvas] Bound goo_canvas_text_get_natural_extents()
- Date: Sun, 23 Aug 2009 21:53:57 +0000 (UTC)
commit 538fa289c5dab343caf2d43334b0042a454ded52
Author: Jeffrey Ratcliffe <Jeffrey Ratcliffe gmail com>
Date: Thu Aug 13 13:16:16 2009 +0200
Bound goo_canvas_text_get_natural_extents()
t/Goo-Canvas.t | 4 +++-
xs/goocanvastext.xs | 19 +++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/t/Goo-Canvas.t b/t/Goo-Canvas.t
index e24693c..eb6c6c7 100644
--- a/t/Goo-Canvas.t
+++ b/t/Goo-Canvas.t
@@ -6,7 +6,7 @@
# change 'tests => 1' to 'tests => last_test_to_print';
-use Test::More tests => 2;
+use Test::More tests => 3;
BEGIN { use_ok('Goo::Canvas') };
use lib qw(../blib/lib ../blib/arch);
@@ -16,3 +16,5 @@ use lib qw(../blib/lib ../blib/arch);
# its man page ( perldoc Test::More ) for help writing this test script.
can_ok('Goo::Canvas', qw(get_items_at get_items_in_area));
+
+can_ok('Goo::Canvas::Text', qw(get_natural_extents));
diff --git a/xs/goocanvastext.xs b/xs/goocanvastext.xs
index 5ec940f..5e15702 100644
--- a/xs/goocanvastext.xs
+++ b/xs/goocanvastext.xs
@@ -1,5 +1,6 @@
#include "goocanvas-perl.h"
+
MODULE = Goo::Canvas::Text PACKAGE = Goo::Canvas::Text PREFIX = goo_canvas_text_
GooCanvasItem*
@@ -16,6 +17,24 @@ goo_canvas_text_new(class, parent, string, x, y, width, anchor, ...)
OUTPUT:
RETVAL
+=for apidoc
+Gets the natural extents of the text, in the text item's coordinate space.
+
+The final extents of the text may be different if the text item is placed in a layout container such as GooCanvasTable.
+=cut
+## call as ($ink_rect, $logical_rect) = $text->get_natural_extents
+void
+goo_canvas_text_get_natural_extents(text)
+ GooCanvasText *text
+ PREINIT:
+ PangoRectangle ink_rect;
+ PangoRectangle logical_rect;
+ PPCODE:
+ goo_canvas_text_get_natural_extents (text, &ink_rect, &logical_rect);
+ XPUSHs(sv_2mortal(newSVPangoRectangle(&ink_rect)));
+ XPUSHs(sv_2mortal(newSVPangoRectangle(&logical_rect)));
+
+
MODULE = Goo::Canvas::Text PACKAGE = Goo::Canvas::TextModel PREFIX = goo_canvas_text_model_
GooCanvasItemModel*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]