summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2014-11-08 11:25:15 +0000
committertavmjong-free <tavmjong@free.fr>2014-11-08 11:25:15 +0000
commit965e178e307b4c82ad8b618cf6af6d3c3c31d2cb (patch)
tree0a25a1dac88b74cb72603631ea790539eb6d1917 /src
parenta little retouch to extension dpiswitcher (diff)
downloadinkscape-965e178e307b4c82ad8b618cf6af6d3c3c31d2cb.tar.gz
inkscape-965e178e307b4c82ad8b618cf6af6d3c3c31d2cb.zip
Black list some properties that shouldn't appear in default styles.
(bzr r13679)
Diffstat (limited to 'src')
-rw-r--r--src/selection-chemistry.cpp3
-rw-r--r--src/style.cpp39
-rw-r--r--src/style.h1
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp3
4 files changed, 44 insertions, 2 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index abc3b990c..d0ef0afea 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -1198,6 +1198,9 @@ take_style_from_item(SPObject *object)
}
}
+ // Remove black-listed properties (those that should not be used in a default style)
+ css = sp_css_attr_unset_blacklist(css);
+
if (!(dynamic_cast<SPText *>(object) || dynamic_cast<SPTSpan *>(object) || dynamic_cast<SPTRef *>(object) || dynamic_cast<SPString *>(object))) {
// do not copy text properties from non-text objects, it's confusing
css = sp_css_attr_unset_text(css);
diff --git a/src/style.cpp b/src/style.cpp
index e0c8536fc..a7e50b17a 100644
--- a/src/style.cpp
+++ b/src/style.cpp
@@ -1720,7 +1720,6 @@ sp_css_attr_unset_text(SPCSSAttr *css)
sp_repr_css_set_property(css, "font-family", NULL);
sp_repr_css_set_property(css, "text-indent", NULL);
sp_repr_css_set_property(css, "text-align", NULL);
- sp_repr_css_set_property(css, "text-decoration", NULL);
sp_repr_css_set_property(css, "line-height", NULL);
sp_repr_css_set_property(css, "letter-spacing", NULL);
sp_repr_css_set_property(css, "word-spacing", NULL);
@@ -1729,12 +1728,48 @@ sp_css_attr_unset_text(SPCSSAttr *css)
sp_repr_css_set_property(css, "block-progression", NULL);
sp_repr_css_set_property(css, "writing-mode", NULL);
sp_repr_css_set_property(css, "text-anchor", NULL);
- sp_repr_css_set_property(css, "white_space", NULL);
+ sp_repr_css_set_property(css, "white-space", NULL);
sp_repr_css_set_property(css, "kerning", NULL); // not implemented yet
sp_repr_css_set_property(css, "dominant-baseline", NULL); // not implemented yet
sp_repr_css_set_property(css, "alignment-baseline", NULL); // not implemented yet
sp_repr_css_set_property(css, "baseline-shift", NULL);
+ sp_repr_css_set_property(css, "text-decoration", NULL);
+ sp_repr_css_set_property(css, "text-decoration-line", NULL);
+ sp_repr_css_set_property(css, "text-decoration-color", NULL);
+ sp_repr_css_set_property(css, "text-decoration-style", NULL);
+
+ return css;
+}
+
+// ui/dialog/inkscape-preferences.cpp
+/**
+ * Unset properties that should not be set for default tool style.
+ * This list needs to be reviewed.
+ */
+SPCSSAttr *
+sp_css_attr_unset_blacklist(SPCSSAttr *css)
+{
+ sp_repr_css_set_property(css, "color", NULL);
+ sp_repr_css_set_property(css, "clip-rule", NULL);
+ sp_repr_css_set_property(css, "display", NULL);
+ sp_repr_css_set_property(css, "overflow", NULL);
+ sp_repr_css_set_property(css, "visibility", NULL);
+ sp_repr_css_set_property(css, "isolation", NULL);
+ sp_repr_css_set_property(css, "mix-blend-mode", NULL);
+ sp_repr_css_set_property(css, "color-interpolation", NULL);
+ sp_repr_css_set_property(css, "color-interpolation-filters", NULL);
+ sp_repr_css_set_property(css, "solid-color", NULL);
+ sp_repr_css_set_property(css, "solid-opacity", NULL);
+ sp_repr_css_set_property(css, "fill-rule", NULL);
+ sp_repr_css_set_property(css, "filter-blend-mode", NULL);
+ sp_repr_css_set_property(css, "filter-gaussianBlur-deviation", NULL);
+ sp_repr_css_set_property(css, "color-rendering", NULL);
+ sp_repr_css_set_property(css, "image-rendering", NULL);
+ sp_repr_css_set_property(css, "shape-rendering", NULL);
+ sp_repr_css_set_property(css, "text-rendering", NULL);
+ sp_repr_css_set_property(css, "enable-background", NULL);
+
return css;
}
diff --git a/src/style.h b/src/style.h
index a4c2b3043..1b1596458 100644
--- a/src/style.h
+++ b/src/style.h
@@ -314,6 +314,7 @@ double sp_style_css_size_units_to_px(double size, int unit); // No change?
SPCSSAttr *sp_css_attr_from_style (SPStyle const *const style, unsigned int flags);
SPCSSAttr *sp_css_attr_from_object(SPObject *object, unsigned int flags = SP_STYLE_FLAG_IFSET);
SPCSSAttr *sp_css_attr_unset_text(SPCSSAttr *css);
+SPCSSAttr *sp_css_attr_unset_blacklist(SPCSSAttr *css);
SPCSSAttr *sp_css_attr_unset_uris(SPCSSAttr *css);
SPCSSAttr *sp_css_attr_scale(SPCSSAttr *css, double ex);
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index a98494e18..75cfe5bfe 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -234,6 +234,9 @@ static void StyleFromSelectionToTool(Glib::ustring const &prefs_path, StyleSwatc
if (!css) return;
+ // remove black-listed properties
+ css = sp_css_attr_unset_blacklist (css);
+
// only store text style for the text tool
if (prefs_path != "/tools/text") {
css = sp_css_attr_unset_text (css);