diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp-text.cpp | 15 | ||||
| -rw-r--r-- | src/ui/dialog/text-edit.cpp | 15 |
2 files changed, 7 insertions, 23 deletions
diff --git a/src/sp-text.cpp b/src/sp-text.cpp index 9beb812f5..b066ca3de 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -93,14 +93,16 @@ void SPText::set(unsigned int key, const gchar* value) { } else { switch (key) { case SP_ATTR_SODIPODI_LINESPACING: - // convert deprecated tag to css - if (value) { + // convert deprecated tag to css... but only if 'line-height' missing. + if (value && !this->style->line_height.set) { this->style->line_height.set = TRUE; this->style->line_height.inherit = FALSE; this->style->line_height.normal = FALSE; this->style->line_height.unit = SP_CSS_UNIT_PERCENT; this->style->line_height.value = this->style->line_height.computed = sp_svg_read_percentage (value, 1.0); } + // Remove deprecated attribute + this->getRepr()->setAttribute("sodipodi:linespacing", NULL); this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_TEXT_LAYOUT_MODIFIED_FLAG); break; @@ -297,15 +299,6 @@ Inkscape::XML::Node *SPText::write(Inkscape::XML::Document *xml_doc, Inkscape::X this->attributes.writeTo(repr); this->rebuildLayout(); // copied from update(), see LP Bug 1339305 - // deprecated attribute, but keep it around for backwards compatibility - if (this->style->line_height.set && !this->style->line_height.inherit && !this->style->line_height.normal && this->style->line_height.unit == SP_CSS_UNIT_PERCENT) { - Inkscape::SVGOStringStream os; - os << (this->style->line_height.value * 100.0) << "%"; - this->getRepr()->setAttribute("sodipodi:linespacing", os.str().c_str()); - } else { - this->getRepr()->setAttribute("sodipodi:linespacing", NULL); - } - // SVG 2 Auto-wrapped text if( this->width.computed > 0.0 ) { sp_repr_set_svg_double(repr, "width", this->width.computed); diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 50c6c1553..9efbcf6a8 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -505,9 +505,7 @@ SPCSSAttr *TextEdit::fillTextStyle () sp_repr_css_set_property (css, "writing-mode", "tb"); } - // Note that SVG 1.1 does not support line-height; we set it for consistency, but also set - // sodipodi:linespacing for backwards compatibility; in 1.2 we use line-height for flowtext - + // Note that SVG 1.1 does not support line-height but we use it. const gchar *sstr = gtk_combo_box_text_get_active_text ((GtkComboBoxText *) spacing_combo); sp_repr_css_set_property (css, "line-height", sstr); @@ -542,18 +540,11 @@ void TextEdit::onApply() SPCSSAttr *css = fillTextStyle (); sp_desktop_set_style(desktop, css, true); - for(auto i=item_list.begin();i!=item_list.end();++i){ + for(auto i=item_list.begin();i!=item_list.end();++i){ // apply style to the reprs of all text objects in the selection - if (SP_IS_TEXT (*i)) { - - // backwards compatibility: - (*i)->getRepr()->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL)); - + if (SP_IS_TEXT (*i) || (SP_IS_FLOWTEXT (*i)) ) { ++items; } - else if (SP_IS_FLOWTEXT (*i)) - // no need to set sodipodi:linespacing, because Inkscape never supported it on flowtext - ++items; } if (items == 0) { |
