Code

Super duper mega (fun!) commit: replaced encoding=utf-8 with fileencoding=utf-8 in...
[inkscape.git] / src / text-chemistry.cpp
index 9cce92ef8ca4400f7a016282baf8148e61f9800c..cc02c656e350b397dad443592c222ca25c606945 100644 (file)
@@ -417,6 +417,10 @@ text_unflow ()
 
         SPItem *flowtext = SP_ITEM(items->data);
 
+        // we discard transform when unflowing, but we must preserve expansion which is visible as
+        // font size multiplier
+        double ex = (flowtext->transform).descrim();
+
         if (sp_te_get_string_multiline(flowtext) == NULL) { // flowtext is empty
             continue;
         }
@@ -429,11 +433,11 @@ text_unflow ()
         rtext->setAttribute("style", SP_OBJECT_REPR(flowtext)->attribute("style")); // fixme: transfer style attrs too; and from descendants
 
         NRRect bbox;
-        sp_item_invoke_bbox(SP_ITEM(flowtext), &bbox, from_2geom(sp_item_i2doc_affine(SP_ITEM(flowtext))), TRUE);
-        NR::Point xy(bbox.x0, bbox.y0);
-        if (xy[NR::X] != 1e18 && xy[NR::Y] != 1e18) {
-            sp_repr_set_svg_double(rtext, "x", xy[NR::X]);
-            sp_repr_set_svg_double(rtext, "y", xy[NR::Y]);
+        sp_item_invoke_bbox(SP_ITEM(flowtext), &bbox, sp_item_i2doc_affine(SP_ITEM(flowtext)), TRUE);
+        Geom::Point xy(bbox.x0, bbox.y0);
+        if (xy[Geom::X] != 1e18 && xy[Geom::Y] != 1e18) {
+            sp_repr_set_svg_double(rtext, "x", xy[Geom::X]);
+            sp_repr_set_svg_double(rtext, "y", xy[Geom::Y]);
         }
 
         /* Create <tspan> */
@@ -449,6 +453,9 @@ text_unflow ()
         SP_OBJECT_REPR(SP_OBJECT_PARENT(flowtext))->appendChild(rtext);
         SPObject *text_object = doc->getObjectByRepr(rtext);
 
+        // restore the font size multiplier from the flowtext's transform
+        SP_TEXT(text_object)->_adjustFontsizeRecursive(SP_ITEM(text_object), ex);
+
         new_objs = g_slist_prepend (new_objs, text_object);
         old_objs = g_slist_prepend (old_objs, flowtext);
 
@@ -546,4 +553,4 @@ flowtext_to_text()
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :