[cairo-commit] goocanvas/demo demo.c, 1.30, 1.31 mv-demo.c, 1.12, 1.13

Damon Chaplin commit at pdx.freedesktop.org
Mon Feb 25 06:11:30 PST 2008


Committed by: damon

Update of /cvs/cairo/goocanvas/demo
In directory kemper:/tmp/cvs-serv15393/demo

Modified Files:
	demo.c mv-demo.c 
Log Message:
2008-02-25  Damon Chaplin  <damon at gnome.org>

	* src/goocanvastext.c (goo_canvas_text_get_natural_extents) 
	(goo_canvas_text_model_get_natural_extents): added functions to get
	the natural extents of the text.



Index: demo.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/demo.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- demo.c	20 Jun 2007 12:59:48 -0000	1.30
+++ demo.c	25 Feb 2008 14:12:25 -0000	1.31
@@ -731,12 +731,20 @@
   double x = (pos % 3) * 200 + 100;
   double y = (pos / 3) * 150 + 5;
   GooCanvasItem *item;
+  PangoRectangle ink_rect, logical_rect;
 
   item = goo_canvas_text_new (root, text, x, y, -1, GTK_ANCHOR_N,
 			      "font", "Sans 12",
 			      NULL);
   goo_canvas_item_skew_y (item, 30, x, y);
   /*goo_canvas_item_rotate (item, 30, x, y);*/
+
+  goo_canvas_text_get_natural_extents (GOO_CANVAS_TEXT (item),
+				       &ink_rect, &logical_rect);
+  g_print ("Ink Extents: %i,%i %ix%i  Logical: %i,%i %ix%i\n",
+	   ink_rect.x, ink_rect.y, ink_rect.width, ink_rect.height,
+	   logical_rect.x, logical_rect.y,
+	   logical_rect.width, logical_rect.height);
 }
 
 

Index: mv-demo.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/mv-demo.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- mv-demo.c	20 Jun 2007 12:59:48 -0000	1.12
+++ mv-demo.c	25 Feb 2008 14:12:25 -0000	1.13
@@ -650,12 +650,20 @@
   double x = (pos % 3) * 200 + 100;
   double y = (pos / 3) * 150 + 5;
   GooCanvasItemModel *item;
+  PangoRectangle ink_rect, logical_rect;
 
   item = goo_canvas_text_model_new (root, text, x, y, -1, GTK_ANCHOR_N,
 				    "font", "Sans 12",
 				    NULL);
   goo_canvas_item_model_skew_y (item, 30, x, y);
   /*goo_canvas_item_rotate (item, 30, x, y);*/
+
+  goo_canvas_text_model_get_natural_extents (GOO_CANVAS_TEXT_MODEL (item),
+					     &ink_rect, &logical_rect);
+  g_print ("Ink Extents: %i,%i %ix%i  Logical: %i,%i %ix%i\n",
+	   ink_rect.x, ink_rect.y, ink_rect.width, ink_rect.height,
+	   logical_rect.x, logical_rect.y,
+	   logical_rect.width, logical_rect.height);
 }
 
 



More information about the cairo-commit mailing list