diff options
author | Caleb Michael Moore <cmoore@src.gnome.org> | 2004-06-14 22:15:39 +0000 |
---|---|---|
committer | Caleb Michael Moore <cmoore@src.gnome.org> | 2004-06-14 22:15:39 +0000 |
commit | 11fa691a1c8e5195e2d6d6208533d0b12a41a2d4 (patch) | |
tree | 121bbecc8d15d05379153e3ae2cb4f167caaac0f | |
parent | 53da9b127d895aafa309f7dcdccdfa2f107990cf (diff) | |
download | librsvg-11fa691a1c8e5195e2d6d6208533d0b12a41a2d4.tar.gz |
more text fixes
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | rsvg-text-vectors.c | 17 | ||||
-rw-r--r-- | rsvg-text.c | 10 | ||||
-rw-r--r-- | rsvg-text.h | 4 |
4 files changed, 24 insertions, 11 deletions
@@ -1,3 +1,7 @@ +2004-06-15 Caleb Moore <c.moore@student.unsw.edu.au> + + * rsvg-text.c, rsvg-text-vectors.c: well, um, I've been doing a fair bit of tweaking. Mainly very late at night so my memory of it is far from complete. + 2004-06-13 Caleb Moore <c.moore@student.unsw.edu.au> * rsvg-shapes.c: Implemented markers for streight lines diff --git a/rsvg-text-vectors.c b/rsvg-text-vectors.c index 5b669c7a..3b29c053 100644 --- a/rsvg-text-vectors.c +++ b/rsvg-text-vectors.c @@ -56,6 +56,8 @@ struct _RenderCtx gboolean wrote; gdouble offset_x; gdouble offset_y; + gdouble position_x; + gdouble position_y; }; typedef void (* RsvgTextRenderFunc) (PangoFont *font, @@ -230,8 +232,8 @@ rsvg_text_vector_coords (RenderCtx *ctx, gdouble *x, gdouble *y) { - *x = ctx->offset_x + (double)vector->x / 64.; - *y = ctx->offset_y - (double)vector->y / 64.; + *x = ctx->offset_x + (double)vector->x / 64. + ctx->position_x; + *y = ctx->offset_y - (double)vector->y / 64. + ctx->position_y; } static void @@ -516,7 +518,7 @@ rsvg_text_layout_render (RsvgTextLayout *layout, gint anchoroffset; rsvg_text_layout_get_offsets (layout, &x, &y); - + x *= PANGO_SCALE; y *= PANGO_SCALE; @@ -555,7 +557,9 @@ void rsvg_text_render_text (RsvgHandle *ctx, RsvgState *state, const char *text, - const char *id) + const char *id, + gdouble x, + gdouble y) { RsvgTextLayout *layout; RenderCtx *render; @@ -565,7 +569,10 @@ rsvg_text_render_text (RsvgHandle *ctx, layout = rsvg_text_layout_new (ctx, state, text); render = rsvg_render_ctx_new (); - + + render->position_x = x; + render->position_y = y; + rsvg_text_layout_render (layout, rsvg_text_render_vectors, (gpointer)render); diff --git a/rsvg-text.c b/rsvg-text.c index 7fa8d3d2..7fa21ab9 100644 --- a/rsvg-text.c +++ b/rsvg-text.c @@ -77,6 +77,7 @@ typedef struct _RsvgSaxHandlerText { RsvgSaxHandler super; RsvgSaxHandler *parent; RsvgHandle *ctx; + gdouble x, y; } RsvgSaxHandlerText; static void @@ -278,7 +279,7 @@ rsvg_text_handler_characters (RsvgSaxHandler *self, const xmlChar *ch, int len) } if(g_getenv("RSVG_TEXT_VECTORS")) - rsvg_text_render_text (ctx, state, string, NULL); + rsvg_text_render_text (ctx, state, string, NULL, z->x, z->y); else rsvg_text_render_text_bitmap (ctx, state, string, NULL); @@ -377,7 +378,6 @@ rsvg_text_handler_end (RsvgSaxHandler *self, const xmlChar *name) void rsvg_start_text (RsvgHandle *ctx, RsvgPropertyBag *atts) { - double affine[6] ; double x, y, dx, dy; const char * klazz = NULL, * id = NULL, *value; RsvgState *state; @@ -414,9 +414,9 @@ rsvg_start_text (RsvgHandle *ctx, RsvgPropertyBag *atts) x += dx ; y += dy ; - art_affine_translate (affine, x, y); - art_affine_multiply (state->affine, affine, state->affine); - + handler->x = x; + handler->y = y; + handler->parent = ctx->handler; ctx->handler = &handler->super; } diff --git a/rsvg-text.h b/rsvg-text.h index 554b9673..5c3689ec 100644 --- a/rsvg-text.h +++ b/rsvg-text.h @@ -38,7 +38,9 @@ void rsvg_text_render_text (RsvgHandle *ctx, RsvgState *state, const char *text, - const char *id); + const char *id, + gdouble x, + gdouble y); G_END_DECLS |