Code

Fixed problem when swatches were larger than provided area
[inkscape.git] / src / sp-flowtext.cpp
index f54e60dab578434ba9160f32a9f2d75e044c494e..e078013aa6ecd6cbb6adbc989e81b08d4e5218bb 100644 (file)
@@ -284,7 +284,7 @@ sp_flowtext_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
             Inkscape::XML::Node *c_repr = NULL;
             if ( SP_IS_FLOWDIV(child) || SP_IS_FLOWPARA(child) || SP_IS_FLOWREGION(child) || SP_IS_FLOWREGIONEXCLUDE(child)) {
                 c_repr = child->updateRepr(NULL, flags);
-            } 
+            }
             if ( c_repr ) l = g_slist_prepend(l, c_repr);
         }
         while ( l ) {
@@ -311,6 +311,21 @@ sp_flowtext_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform,
 {
     SPFlowtext *group = SP_FLOWTEXT(item);
     group->layout.getBoundingBox(bbox, transform);
+
+    // Add stroke width
+    SPStyle* style=SP_OBJECT_STYLE (item);
+    if (style->stroke.type != SP_PAINT_TYPE_NONE) {
+        double const scale = expansion(transform);
+        if ( fabs(style->stroke_width.computed * scale) > 0.01 ) { // sinon c'est 0=oon veut pas de bord
+            double const width = MAX(0.125, style->stroke_width.computed * scale);
+            if ( fabs(bbox->x1 - bbox->x0) > -0.00001 && fabs(bbox->y1 - bbox->y0) > -0.00001 ) {
+                bbox->x0-=0.5*width;
+                bbox->x1+=0.5*width;
+                bbox->y0-=0.5*width;
+                bbox->y1+=0.5*width;
+            }
+        }
+    }
 }
 
 static void
@@ -338,9 +353,9 @@ static gchar *sp_flowtext_description(SPItem *item)
     Inkscape::Text::Layout const &layout = SP_FLOWTEXT(item)->layout;
     int const nChars = layout.iteratorToCharIndex(layout.end());
     if (SP_FLOWTEXT(item)->has_internal_frame())
-        return g_strdup_printf(_("<b>Flowed text</b> (%d characters)"), nChars);
-    else 
-        return g_strdup_printf(_("<b>Linked flowed text</b> (%d characters)"), nChars);
+        return g_strdup_printf(ngettext("<b>Flowed text</b> (%d character)", "<b>Flowed text</b> (%d characters)", nChars), nChars);
+    else
+        return g_strdup_printf(ngettext("<b>Linked flowed text</b> (%d character)", "<b>Linked flowed text</b> (%d characters)", nChars), nChars);
 }
 
 static NRArenaItem *
@@ -412,7 +427,7 @@ void SPFlowtext::_buildLayoutInput(SPObject *root, Shape const *exclusion_shape,
             }
             if (with_indent)
                 layout.appendText(SP_STRING(child)->string, root->style, child, &pi);
-            else 
+            else
                 layout.appendText(SP_STRING(child)->string, root->style, child);
         } else if (SP_IS_FLOWREGION(child)) {
             std::vector<Shape*> const &computed = SP_FLOWREGION(child)->computed;