diff src/shape_text.c @ 31:da770188a44d

resize font size for changige of coord.
author Thinker K.F. Li <thinker@branda.to>
date Tue, 05 Aug 2008 16:38:04 +0800
parents e06a4a667ce2
children d82749f77108
line wrap: on
line diff
--- a/src/shape_text.c	Tue Aug 05 12:40:45 2008 +0800
+++ b/src/shape_text.c	Tue Aug 05 16:38:04 2008 +0800
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <math.h>
 #include <cairo.h>
 #include "mb_types.h"
 #include "shapes.h"
@@ -14,6 +15,7 @@
     co_aix x, y;
     co_aix d_x, d_y;		/* device x and y */
     co_aix font_size;
+    co_aix d_font_size;
     cairo_font_face_t *face;
     cairo_scaled_font_t *scaled_font;
     int flags;
@@ -66,8 +68,8 @@
 	if(fopt == NULL)
 	    return ERR;
 	memset(&fmatrix, 0, sizeof(cairo_matrix_t));
-	fmatrix.xx = text->font_size;
-	fmatrix.yy = text->font_size;
+	fmatrix.xx = text->d_font_size;
+	fmatrix.yy = text->d_font_size;
 	memset(&ctm, 0, sizeof(cairo_matrix_t));
 	ctm.xx = 1;
 	ctm.yy = 1;
@@ -99,6 +101,9 @@
     int r;
 
     text = (sh_text_t *)shape;
+
+    text->d_font_size = coord_trans_size(shape->coord, text->font_size);
+
     x = text->x;
     y = text->y;
     coord_trans_pos(shape->coord, &x, &y);