comparison src/shape_text.c @ 303:f894b30676e9

Add MBAF object suport. This is still work in progress yet. However, it won't affect other features. Therefore, it is checked in before it become mature.
author wycc
date Sun, 15 Feb 2009 08:34:57 +0800
parents 2ca0773cd48d
children b0571f10c1b8
comparison
equal deleted inserted replaced
302:8b45e7b374b8 303:f894b30676e9
70 rdman_shape_man(rdman, (shape_t *)text); 70 rdman_shape_man(rdman, (shape_t *)text);
71 71
72 return (shape_t *)text; 72 return (shape_t *)text;
73 } 73 }
74 74
75 extern void sh_text_set_text(shape_t *shape, const char *txt) { 75 void sh_text_set_pos(shape_t *shape, co_aix x, co_aix y)
76 {
77 sh_text_t *text = (sh_text_t *)shape;
78 text->x = x;
79 text->y = y;
80 }
81
82
83 void sh_text_get_pos(shape_t *shape, co_aix *x, co_aix *y)
84 {
85 sh_text_t *text = (sh_text_t *)shape;
86 *x = text->x;
87 *y = text->y;
88 }
89
90 void sh_text_get_text(shape_t *shape, char *text,int size)
91 {
92 sh_text_t *t = (sh_text_t *)shape;
93 strncpy(text,t->data, size);
94 }
95
96 void sh_text_set_text(shape_t *shape, const char *txt) {
76 sh_text_t *text = (sh_text_t *)shape; 97 sh_text_t *text = (sh_text_t *)shape;
77 char *buf; 98 char *buf;
78 99
79 buf = strdup(txt); 100 buf = strdup(txt);
80 if(text->data) free(text->data); 101 if(text->data) free(text->data);
228 if (text->layout) { 249 if (text->layout) {
229 g_object_unref(text->layout); 250 g_object_unref(text->layout);
230 } 251 }
231 text->layout = pango_cairo_create_layout(cr); 252 text->layout = pango_cairo_create_layout(cr);
232 desc = pango_font_description_from_string("Sans Bold"); 253 desc = pango_font_description_from_string("Sans Bold");
233 cairo_set_source_rgb (cr, 0, 0, 0); 254 //cairo_set_source_rgb (cr, 0, 0, 0);
234 pango_layout_set_font_description (text->layout, desc); 255 pango_layout_set_font_description (text->layout, desc);
235 pango_layout_set_text(text->layout,text->data,strlen(text->data)); 256 pango_layout_set_text(text->layout,text->data,strlen(text->data));
236 pango_layout_set_attributes(text->layout, text->attrs); 257 pango_layout_set_attributes(text->layout, text->attrs);
237 pango_cairo_update_layout(cr,text->layout); 258 pango_cairo_update_layout(cr,text->layout);
238 printf("text=%s\n",text->data); 259 printf("text=%s\n",text->data);