[dia] [transform] svg: import transformation from <text transform="...">



commit e59b01e9d90ba0556dfb04de205c6830870bedfd
Author: Hans Breuer <hans breuer org>
Date:   Thu Oct 9 19:28:24 2014 +0200

    [transform] svg: import transformation from <text transform="...">
    
    With the last commit implementing "Standard - Text"::transform() text
    transformation is much easier and more correct.

 plug-ins/svg/svg-import.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/plug-ins/svg/svg-import.c b/plug-ins/svg/svg-import.c
index 8aba3b6..eb6e7a7 100644
--- a/plug-ins/svg/svg-import.c
+++ b/plug-ins/svg/svg-import.c
@@ -785,8 +785,6 @@ read_text_svg(xmlNodePtr node, DiaSvgStyle *parent_style,
       multiline = NULL;
     }
     if(str || multiline) {
-      if (matrix)
-       transform_point (&point, matrix);
       new_obj = otype->ops->create(&point, otype->default_user_data,
                                 &h1, &h2);
       list = g_list_append (list, new_obj);
@@ -813,13 +811,8 @@ read_text_svg(xmlNodePtr node, DiaSvgStyle *parent_style,
        /* font-size should be the line-height according to SVG spec,
         * but see node_set_text_style() - round-trip first */
        real font_scale = dia_font_get_height (prop->attr.font) / dia_font_get_size (prop->attr.font);
-       if (matrix) /* ToDo: more text transform - or not at all? */
-         transform_length (&font_height, matrix);
         prop->attr.height = font_height * font_scale;
       } else {
-        real fh = gs->font_height;
-       if (matrix)
-         transform_length (&fh, matrix);
        prop->attr.height = gs->font_height;
       }
       /* when operating with default values foreground and background are intentionally swapped
@@ -843,6 +836,10 @@ read_text_svg(xmlNodePtr node, DiaSvgStyle *parent_style,
       }
       new_obj->ops->set_props(new_obj, props);
       prop_list_free(props);
+      if (matrix) {
+       g_return_val_if_fail (new_obj->ops->transform, list);
+       new_obj->ops->transform(new_obj, matrix);
+      }
     }
     if (gs->font)
       dia_font_unref (gs->font);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]