comparison 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
comparison
equal deleted inserted replaced
87:8dfebf76cb59 88:dd813dcc232c
54 text->flags |= TXF_SCALE_DIRTY; 54 text->flags |= TXF_SCALE_DIRTY;
55 55
56 text->shape.free = sh_text_free; 56 text->shape.free = sh_text_free;
57 57
58 return (shape_t *)text; 58 return (shape_t *)text;
59 }
60
61 extern void sh_text_set_text(shape_t *shape, const char *txt) {
62 sh_text_t *text = (sh_text_t *)shape;
63 char *buf;
64
65 buf = strdup(txt);
66 if(text->data) free(text->data);
67 text->data = buf;
59 } 68 }
60 69
61 static int get_extents(sh_text_t *text, cairo_text_extents_t *extents) { 70 static int get_extents(sh_text_t *text, cairo_text_extents_t *extents) {
62 cairo_matrix_t fmatrix; 71 cairo_matrix_t fmatrix;
63 cairo_matrix_t ctm; 72 cairo_matrix_t ctm;