summaryrefslogtreecommitdiffstats
path: root/src/object/sp-text.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2019-09-13 08:28:04 +0000
committerTavmjong Bah <tavmjong@free.fr>2019-09-13 08:28:04 +0000
commitcd87d7599e1a6f61bb14e08f6e4a43a42a385c80 (patch)
treedf6969db4f36651656e3ef085a8a1ce905d5c88b /src/object/sp-text.cpp
parentfix crash in CanvasXYGrid::updateWidgets (diff)
downloadinkscape-cd87d7599e1a6f61bb14e08f6e4a43a42a385c80.tar.gz
inkscape-cd87d7599e1a6f61bb14e08f6e4a43a42a385c80.zip
A value of zero for 'inline-size' should act as if 'inline-size' is not set. Fixes #852.
Diffstat (limited to 'src/object/sp-text.cpp')
-rw-r--r--src/object/sp-text.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/object/sp-text.cpp b/src/object/sp-text.cpp
index 2ab4f96a3..91ca65170 100644
--- a/src/object/sp-text.cpp
+++ b/src/object/sp-text.cpp
@@ -166,7 +166,7 @@ void SPText::update(SPCtx *ctx, guint flags) {
attributes.update( em, ex, w, h );
// Set inline_size computed value if necessary (i.e. if unit is %).
- if (style->inline_size.set) {
+ if (has_inline_size()) {
if (style->inline_size.unit == SP_CSS_UNIT_PERCENT) {
if (is_horizontal()) {
style->inline_size.computed = style->inline_size.value * ictx->viewport.width();
@@ -554,7 +554,7 @@ void SPText::_buildLayoutInit()
}
}
- } else if (style->inline_size.set) {
+ } else if (has_inline_size()) {
layout.wrap_mode = Inkscape::Text::Layout::WRAP_INLINE_SIZE;
@@ -922,7 +922,8 @@ bool SPText::is_horizontal() const
bool SPText::has_inline_size() const
{
- return (style->inline_size.set);
+ // If inline size is '0' it is as if it is not set.
+ return (style->inline_size.set && style->inline_size.value != 0);
}
bool SPText::has_shape_inside() const
@@ -936,7 +937,7 @@ Geom::OptRect SPText::get_frame()
Geom::OptRect opt_frame;
Geom::Rect frame;
- if (style->inline_size.set) {
+ if (has_inline_size()) {
double inline_size = style->inline_size.computed;
unsigned mode = style->writing_mode.computed;
unsigned anchor = style->text_anchor.computed;