diff options
Diffstat (limited to 'src/object')
| -rw-r--r-- | src/object/sp-flowtext.cpp | 20 | ||||
| -rw-r--r-- | src/object/sp-flowtext.h | 1 | ||||
| -rw-r--r-- | src/object/sp-text.cpp | 11 |
3 files changed, 28 insertions, 4 deletions
diff --git a/src/object/sp-flowtext.cpp b/src/object/sp-flowtext.cpp index 05e06cff5..a488e208b 100644 --- a/src/object/sp-flowtext.cpp +++ b/src/object/sp-flowtext.cpp @@ -688,6 +688,26 @@ SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p0, return ft_item; } +void SPFlowtext::fix_overflow_flowregion(bool inverse) +{ + SPObject *object = dynamic_cast<SPObject *>(this); + SPFlowregion *flowregion = nullptr; + for (auto child : object->childList(false)) { + SPFlowregion *flowregion = dynamic_cast<SPFlowregion *>(child); + if (flowregion) { + object = dynamic_cast<SPObject *>(flowregion); + for (auto childshapes : object->childList(false)) { + Geom::Scale scale = Geom::Scale(1000); //200? maybe find better way to fix overglow issue removing new lines... + if (inverse) { + scale = scale.inverse(); + } + SP_SHAPE(childshapes)->doWriteTransform(scale, nullptr, true); + } + break; + } + } +} + Geom::Affine SPFlowtext::set_transform (Geom::Affine const &xform) { if ((this->_optimizeScaledText && !xform.withoutTranslation().isNonzeroUniformScale()) diff --git a/src/object/sp-flowtext.h b/src/object/sp-flowtext.h index 386f0cc33..9baf64053 100644 --- a/src/object/sp-flowtext.h +++ b/src/object/sp-flowtext.h @@ -87,6 +87,7 @@ public: void update(SPCtx* ctx, unsigned int flags) override; void modified(unsigned int flags) override; + void fix_overflow_flowregion(bool inverse); Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, unsigned int flags) override; diff --git a/src/object/sp-text.cpp b/src/object/sp-text.cpp index 4dd5a9ff1..01e56633a 100644 --- a/src/object/sp-text.cpp +++ b/src/object/sp-text.cpp @@ -50,6 +50,7 @@ #include "sp-textpath.h" #include "sp-tref.h" #include "sp-tspan.h" +#include "sp-flowregion.h" #include "text-editing.h" @@ -390,9 +391,10 @@ void SPText::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape:: void SPText::hide_shape_inside() { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + SPText *text = dynamic_cast<SPText *>(this); + SPObject *object = dynamic_cast<SPObject *>(this); SPStyle *item_style = this->style; - if (item_style && prefs->getBool("/tools/text/use_svg2") && item_style->shape_inside.set) { + if (item_style && text && item_style->shape_inside.set) { SPCSSAttr *css_unset = sp_css_attr_from_style(item_style, SP_STYLE_FLAG_IFSET); css = sp_css_attr_from_style(item_style, SP_STYLE_FLAG_IFSET); sp_repr_css_unset_property(css_unset, "shape-inside"); @@ -405,8 +407,9 @@ void SPText::hide_shape_inside() void SPText::show_shape_inside() { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if (prefs->getBool("/tools/text/use_svg2") && css) { + SPText *text = dynamic_cast<SPText *>(this); + SPObject *object = dynamic_cast<SPObject *>(this); + if (text && css) { this->changeCSS(css, "style"); } } |
