834 |
} |
} |
835 |
|
|
836 |
void |
void |
837 |
GFContextShowTextAtPoint (GFContextRef context, float x, float y, char *string, |
GFContextShowTextAtPoint (GFContextRef context, float x, float y, |
838 |
int string_length) |
char *string, int string_length) |
839 |
{ |
{ |
840 |
GFGStateRef state = context->gstate; |
GFGStateRef state = context->gstate; |
841 |
struct glyph *glyph; |
struct glyph *glyph; |
853 |
x1 = (int) context->origin.x + context->size.width; |
x1 = (int) context->origin.x + context->size.width; |
854 |
y1 = (int) context->origin.y + context->size.height; |
y1 = (int) context->origin.y + context->size.height; |
855 |
|
|
856 |
rowstride = context->size.width * (context->n_components + 1) |
rowstride = context->size.width * (context->n_components) |
857 |
* context->n_bits_per_component / 8; |
* context->n_bits_per_component / 8; |
858 |
|
|
859 |
render = art_render_new (x0, y0, x1 - x0, y1 - y0, context->dst_buffer, |
render = art_render_new (x0, y0, x1 - x0, y1 - y0, context->dst_buffer, |
860 |
rowstride, 3, 8, ART_ALPHA_SEPARATE, ART_ALPHA_LAST, NULL); |
rowstride, 3, 8, ART_ALPHA_SEPARATE, |
861 |
(*state->fill_space->render_fn) (state->fill_space, |
ART_ALPHA_LAST, NULL); |
862 |
state->fill_color, render); |
paintserver_invoke (context, state->fill_space, render); |
863 |
art_render_mask_solid (render, 0x10000); |
art_render_mask_solid (render, 0x10000); |
864 |
|
|
865 |
x0 = (int) glyph_xy[0] + x; |
x0 = (int) glyph_xy[0] + x; |
866 |
|
#if 0 |
867 |
y0 = (int) glyph_xy[1] + MIN (0, context->size.height - y) |
y0 = (int) glyph_xy[1] + MIN (0, context->size.height - y) |
868 |
- (glyph->height - glyph->underline_position) + glyph->underline_thickness; |
- (glyph->height - glyph->underline_position) |
869 |
|
+ glyph->underline_thickness; |
870 |
|
#else |
871 |
|
y0 = (int) glyph_xy[1] + y; |
872 |
|
#endif |
873 |
x1 = (int) x0 + glyph->width; |
x1 = (int) x0 + glyph->width; |
874 |
y1 = (int) y0 + glyph->height; |
y1 = (int) y0 + glyph->height; |
875 |
|
|
876 |
art_render_mask (render, x0, y0, x1, y1, glyph->buf, glyph->rowstride); |
art_render_mask (render, x0, y0, x1, y1, glyph->buf, glyph->rowstride); |
877 |
art_render_invoke (render); |
art_render_invoke (render); |
878 |
|
paintserver_free (context, state->fill_space); |
879 |
} |
} |
880 |
|
|
881 |
|
GFSize |
882 |
|
GFContextMeasureText (GFContextRef context, char *string, int string_length) |
883 |
|
{ |
884 |
|
GFGStateRef state = context->gstate; |
885 |
|
int glyph_xy[2], dim [2]; |
886 |
|
|
887 |
|
render_string (state->font_handle, string, string_length, |
888 |
|
state->font_size, state->font_size, |
889 |
|
state->ctm, glyph_xy, 0, dim); |
890 |
|
return GFSizeMake (dim [0], dim [1]); |
891 |
|
} |
892 |
|
|
893 |
|
|