summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2019-09-07 19:26:35 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2019-09-07 21:48:33 +0000
commitaebf8e855097a4c2a7f11455596885f1633e3b1f (patch)
tree0e0ed893c634e5788c3630ed9fc208d31d1a5a9e /src
parentAllow transforms in SVG2 flow elements (diff)
downloadinkscape-aebf8e855097a4c2a7f11455596885f1633e3b1f.tar.gz
inkscape-aebf8e855097a4c2a7f11455596885f1633e3b1f.zip
Fix bugs appliing in fallback elements
Diffstat (limited to 'src')
-rw-r--r--src/extension/internal/svg.cpp2
-rw-r--r--src/style-internal.cpp3
-rw-r--r--src/ui/toolbar/text-toolbar.cpp15
-rw-r--r--src/ui/toolbar/text-toolbar.h2
4 files changed, 16 insertions, 6 deletions
diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp
index f5f22fe30..cee0936eb 100644
--- a/src/extension/internal/svg.cpp
+++ b/src/extension/internal/svg.cpp
@@ -454,7 +454,6 @@ static void insert_text_fallback( Inkscape::XML::Node *repr, SPDocument *doc, In
std::swap(attrs.dx, attrs.dy);
}
TextTagAttributes(attrs).writeTo(span_tspan);
- span_tspan->setAttribute("sodipodi:role", "line");
void *rawptr = nullptr;
Glib::ustring::iterator span_text_start_iter;
text->layout.getSourceOfCharacter(it, &rawptr, &span_text_start_iter);
@@ -497,6 +496,7 @@ static void insert_text_fallback( Inkscape::XML::Node *repr, SPDocument *doc, In
// Add tspan to document
line_tspan->appendChild(span_tspan);
+ line_tspan->setAttribute("sodipodi:role", "line");
Inkscape::GC::release(span_tspan);
}
diff --git a/src/style-internal.cpp b/src/style-internal.cpp
index 6a8ff6f89..939d63e53 100644
--- a/src/style-internal.cpp
+++ b/src/style-internal.cpp
@@ -1122,6 +1122,9 @@ SPIShapes::read( gchar const *str) {
// The object/repr this property is connected to..
SPObject* object = style->object;
+ if (!object) {
+ return;
+ }
SPDocument* document = object->document;
Inkscape::XML::Node *text_repr = object->getRepr();
diff --git a/src/ui/toolbar/text-toolbar.cpp b/src/ui/toolbar/text-toolbar.cpp
index 40067e960..90b9ebe90 100644
--- a/src/ui/toolbar/text-toolbar.cpp
+++ b/src/ui/toolbar/text-toolbar.cpp
@@ -1318,6 +1318,7 @@ TextToolbar::lineheight_value_changed()
sp_repr_css_attr_unref(cssfit);
}
// Only need to save for undo if a text item has been changed.
+ itemlist= selection->items();
bool modmade = false;
for (auto i : itemlist) {
SPText *text = dynamic_cast<SPText *>(i);
@@ -1526,7 +1527,7 @@ TextToolbar::lineheight_unit_changed(int /* Not Used */)
subselection_wrap_toggle(false);
sp_repr_css_attr_unref(cssfit);
}
-
+ itemlist= selection->items();
// Only need to save for undo if a text item has been changed.
bool modmade = false;
for (auto i : itemlist) {
@@ -1949,7 +1950,7 @@ void TextToolbar::selection_changed(Inkscape::Selection *selection) // don't bot
int unit = prefs->getInt("/options/font/unitType", SP_CSS_UNIT_PT);
double size = 0;
if (!size && _cusor_numbers != QUERY_STYLE_NOTHING) {
- size = sp_style_css_size_px_to_units(query_cursor.font_size.computed, unit);
+ size = sp_style_css_size_px_to_units(_query_cursor.font_size.computed, unit);
}
if (!size && result_numbers != QUERY_STYLE_NOTHING) {
size = sp_style_css_size_px_to_units(query.font_size.computed, unit);
@@ -2032,6 +2033,12 @@ void TextToolbar::selection_changed(Inkscape::Selection *selection) // don't bot
height = query_fallback.line_height.value;
line_height_unit = query_fallback.line_height.unit;
}
+
+ if (!height && _cusor_numbers != QUERY_STYLE_NOTHING) {
+ height = _query_cursor.line_height.value;
+ line_height_unit = _query_cursor.line_height.unit;
+ }
+
if (line_height_unit == SP_CSS_UNIT_PERCENT) {
height *= 100.0; // Inkscape store % as fraction in .value
}
@@ -2431,7 +2438,7 @@ void TextToolbar::subselection_changed(gpointer texttool)
//TODO: find a better way to init
_updating = true;
SPStyle query(SP_ACTIVE_DOCUMENT);
- query_cursor = query;
+ _query_cursor = query;
Inkscape::Text::Layout::iterator start_line = tc->text_sel_start;
start_line.thisStartOfLine();
if (tc->text_sel_start == start_line) {
@@ -2439,7 +2446,7 @@ void TextToolbar::subselection_changed(gpointer texttool)
} else {
tc->text_sel_start = prev;
}
- _cusor_numbers = sp_desktop_query_style(SP_ACTIVE_DESKTOP, &query_cursor, QUERY_STYLE_PROPERTY_FONTNUMBERS);
+ _cusor_numbers = sp_desktop_query_style(SP_ACTIVE_DESKTOP, &_query_cursor, QUERY_STYLE_PROPERTY_FONTNUMBERS);
tc->text_sel_start = start_selection;
_updating = false;
break;
diff --git a/src/ui/toolbar/text-toolbar.h b/src/ui/toolbar/text-toolbar.h
index c562627ef..5c4bf0bc8 100644
--- a/src/ui/toolbar/text-toolbar.h
+++ b/src/ui/toolbar/text-toolbar.h
@@ -104,7 +104,7 @@ private:
bool _fullsubselection;
bool _updating;
int _cusor_numbers;
- SPStyle query_cursor;
+ SPStyle _query_cursor;
double selection_fontsize;
sigc::connection c_selection_changed;
sigc::connection c_selection_modified;