Mercurial > MadButterfly
comparison src/X_main.c @ 278:a90fd749af82 mbtext
Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
author | wycc |
---|---|
date | Sat, 31 Jan 2009 09:41:04 +0800 |
parents | 530bb7728546 |
children | 16116d84bc5e |
comparison
equal
deleted
inserted
replaced
277:5006e4abdda5 | 278:a90fd749af82 |
---|---|
4 #include <sys/select.h> | 4 #include <sys/select.h> |
5 #include <X11/Xlib.h> | 5 #include <X11/Xlib.h> |
6 #include <X11/Xutil.h> | 6 #include <X11/Xutil.h> |
7 #include <cairo.h> | 7 #include <cairo.h> |
8 #include <cairo-xlib.h> | 8 #include <cairo-xlib.h> |
9 #include <pango/pangocairo.h> | |
9 | 10 |
10 #include <string.h> | 11 #include <string.h> |
11 #include "mb_shapes.h" | 12 #include "mb_shapes.h" |
12 #include "mb_redraw_man.h" | 13 #include "mb_redraw_man.h" |
13 #include "mb_paint.h" | 14 #include "mb_paint.h" |
136 mb_tman_t *tman; | 137 mb_tman_t *tman; |
137 mb_timeval_t mbtv, start, playing; | 138 mb_timeval_t mbtv, start, playing; |
138 mb_progm_t *progm; | 139 mb_progm_t *progm; |
139 mb_word_t *word; | 140 mb_word_t *word; |
140 mb_action_t *act; | 141 mb_action_t *act; |
142 PangoAttrList *attrs = pango_attr_list_new(); | |
141 | 143 |
142 tmpsuf = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, w, h); | 144 tmpsuf = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, w, h); |
143 tmpcr = cairo_create(tmpsuf); | 145 tmpcr = cairo_create(tmpsuf); |
144 | 146 |
145 cairo_set_source_surface(cr, tmpsuf, 0, 0); | 147 cairo_set_source_surface(cr, tmpsuf, 0, 0); |
153 stroke = rdman_paint_color_new(&rdman, 0.4, 0.4, 0.4, 1); | 155 stroke = rdman_paint_color_new(&rdman, 0.4, 0.4, 0.4, 1); |
154 text_stroke = rdman_paint_color_new(&rdman, 0.5, 0.5, 0.5, 1); | 156 text_stroke = rdman_paint_color_new(&rdman, 0.5, 0.5, 0.5, 1); |
155 | 157 |
156 face = cairo_get_font_face(tmpcr); | 158 face = cairo_get_font_face(tmpcr); |
157 text = rdman_shape_text_new(&rdman, "hello \xe6\xbc\xa2\xe5\xad\x97", | 159 text = rdman_shape_text_new(&rdman, "hello \xe6\xbc\xa2\xe5\xad\x97", |
158 10, h / 4, 36.0, face); | 160 10, h / 4, 36.0, face, attrs); |
159 text_fill = rdman_paint_radial_new(&rdman, 100, h / 4, 70); | 161 text_fill = rdman_paint_radial_new(&rdman, 100, h / 4, 70); |
160 grad_stop_init(text_stops, 0, 0.2, 0.9, 0.2, 1); | 162 grad_stop_init(text_stops, 0, 0.2, 0.9, 0.2, 1); |
161 grad_stop_init(text_stops + 1, 1, 0.9, 0.2, 0.2, 0.1); | 163 grad_stop_init(text_stops + 1, 1, 0.9, 0.2, 0.2, 0.1); |
162 paint_radial_stops(text_fill, 2, text_stops); | 164 paint_radial_stops(text_fill, 2, text_stops); |
163 rdman_paint_stroke(&rdman, text_stroke, text); | 165 rdman_paint_stroke(&rdman, text_stroke, text); |