comparison src/shape_text.c @ 294:2ca0773cd48d

* Add MBAF files * Change begin_index to be start_index * fix the color setting.
author wycc
date Sun, 01 Feb 2009 09:51:12 +0800
parents 7270e368ee98
children f894b30676e9
comparison
equal deleted inserted replaced
293:a171b94582ae 294:2ca0773cd48d
81 text->data = buf; 81 text->data = buf;
82 } 82 }
83 83
84 void sh_text_set_color(shape_t *shape, unsigned int color) 84 void sh_text_set_color(shape_t *shape, unsigned int color)
85 { 85 {
86 PangoAttribute *attr = pango_attr_color_new(color); 86 PangoAttribute *attr = pango_attr_foreground_new(TEXTCOLOR_RED(color)<<8,TEXTCOLOR_GREEN(color)<<8,TEXTCOLOR_BLUE(color)<<8);
87 sh_text_t *text = (sh_text_t *)shape; 87 sh_text_t *text = (sh_text_t *)shape;
88 attr->begin_index = 0; 88 attr->start_index = 0;
89 attr->end_index = -1; 89 attr->end_index = -1;
90 pango_attr_list_change(text->attrs, attr); 90 pango_attr_list_change(text->attrs, attr);
91 } 91 }
92 void sh_text_set_bold(shape_t *shape,int bold) 92 void sh_text_set_bold(shape_t *shape,int bold)
93 { 93 {
94 PangoAttribute *attr = pango_attr_weight_new(bold? PANGO_WEIGHT_BOLD:PANGO_WEIGHT_NORMAL); 94 PangoAttribute *attr = pango_attr_weight_new(bold? PANGO_WEIGHT_BOLD:PANGO_WEIGHT_NORMAL);
95 sh_text_t *text = (sh_text_t *)shape; 95 sh_text_t *text = (sh_text_t *)shape;
96 attr->begin_index = 0; 96 attr->start_index = 0;
97 attr->end_index = -1; 97 attr->end_index = -1;
98 pango_attr_list_change(text->attrs, attr); 98 pango_attr_list_change(text->attrs, attr);
99 } 99 }
100 void sh_text_set_italic(shape_t *shape,int italic) 100 void sh_text_set_italic(shape_t *shape,int italic)
101 { 101 {
102 PangoAttribute *attr = pango_attr_style_new(italic? PANGO_STYLE_ITALIC:PANGO_STYLE_NORMAL); 102 PangoAttribute *attr = pango_attr_style_new(italic? PANGO_STYLE_ITALIC:PANGO_STYLE_NORMAL);
103 sh_text_t *text = (sh_text_t *)shape; 103 sh_text_t *text = (sh_text_t *)shape;
104 attr->begin_index = 0; 104 attr->start_index = 0;
105 attr->end_index = -1; 105 attr->end_index = -1;
106 pango_attr_list_change(text->attrs, attr); 106 pango_attr_list_change(text->attrs, attr);
107 } 107 }
108 void sh_text_set_underline(shape_t *shape,int underline) 108 void sh_text_set_underline(shape_t *shape,int underline)
109 { 109 {
110 PangoAttribute *attr = pango_attr_underline_new(underline? PANGO_UNDERLINE_SINGLE:PANGO_UNDERLINE_NONE); 110 PangoAttribute *attr = pango_attr_underline_new(underline? PANGO_UNDERLINE_SINGLE:PANGO_UNDERLINE_NONE);
111 sh_text_t *text = (sh_text_t *)shape; 111 sh_text_t *text = (sh_text_t *)shape;
112 attr->begin_index = 0; 112 attr->start_index = 0;
113 attr->end_index = -1; 113 attr->end_index = -1;
114 pango_attr_list_change(text->attrs, attr); 114 pango_attr_list_change(text->attrs, attr);
115 } 115 }
116 void sh_text_set_font(shape_t *shape,char *family) 116 void sh_text_set_font(shape_t *shape,char *family)
117 { 117 {
118 PangoAttribute *attr = pango_attr_family_new(family); 118 PangoAttribute *attr = pango_attr_family_new(family);
119 sh_text_t *text = (sh_text_t *)shape; 119 sh_text_t *text = (sh_text_t *)shape;
120 attr->begin_index = 0; 120 attr->start_index = 0;
121 attr->end_index = -1; 121 attr->end_index = -1;
122 pango_attr_list_change(text->attrs, attr); 122 pango_attr_list_change(text->attrs, attr);
123 } 123 }
124 124
125 void sh_text_set_style(shape_t *shape,int begin,int end,mb_textstyle_t *format) 125 void sh_text_set_style(shape_t *shape,int begin,int end,mb_textstyle_t *format)