diff src/shape_text.c @ 88:dd813dcc232c

New example, calculator.
author Thinker K.F. Li <thinker@branda.to>
date Sat, 23 Aug 2008 15:26:47 +0800
parents 9ab15ebc9061
children 98c83441d7d6
line wrap: on
line diff
--- a/src/shape_text.c	Fri Aug 22 16:41:11 2008 +0800
+++ b/src/shape_text.c	Sat Aug 23 15:26:47 2008 +0800
@@ -58,6 +58,15 @@
     return (shape_t *)text;
 }
 
+extern void sh_text_set_text(shape_t *shape, const char *txt) {
+    sh_text_t *text = (sh_text_t *)shape;
+    char *buf;
+
+    buf = strdup(txt);
+    if(text->data) free(text->data);
+    text->data = buf;
+}
+
 static int get_extents(sh_text_t *text, cairo_text_extents_t *extents) {
     cairo_matrix_t fmatrix;
     cairo_matrix_t ctm;