summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2018-12-12 11:46:46 +0000
committerTavmjong Bah <tavmjong@free.fr>2018-12-12 11:46:46 +0000
commit2d7e60aef4b3e03ba6d82abc80932969ce0f639f (patch)
treea1085f9fdf8e1a201197427a29d84d52b707eebe /src
parentReduce code redundancy. (diff)
downloadinkscape-2d7e60aef4b3e03ba6d82abc80932969ce0f639f.tar.gz
inkscape-2d7e60aef4b3e03ba6d82abc80932969ce0f639f.zip
Finish implementation of 'text-decoration-fill' and 'text-decoration-stroke'.
Diffstat (limited to 'src')
-rw-r--r--src/display/nr-style.cpp20
-rw-r--r--src/style.cpp4
-rw-r--r--src/style.h2
3 files changed, 20 insertions, 6 deletions
diff --git a/src/display/nr-style.cpp b/src/display/nr-style.cpp
index 541e7b11a..1832a5f51 100644
--- a/src/display/nr-style.cpp
+++ b/src/display/nr-style.cpp
@@ -268,10 +268,13 @@ void NRStyle::set(SPStyle *style, SPStyle *context_style)
text_decoration_stroke.opacity = SP_SCALE24_TO_FLOAT(style_td->stroke_opacity.value);
text_decoration_stroke_width = style_td->stroke_width.computed;
- if( style->text_decoration_color.set ||
- style->text_decoration_color.inherit ||
- style->text_decoration_color.currentcolor ) {
-
+ // Priority is given in order:
+ // * text_decoration_fill
+ // * text_decoration_color (only if fill set)
+ // * fill
+ if (style_td->text_decoration_fill.set) {
+ text_decoration_fill.set(&(style_td->text_decoration_fill));
+ } else if (style_td->text_decoration_color.set) {
if(style->fill.isPaintserver() || style->fill.isColor()) {
// SVG sets color specifically
text_decoration_fill.set(style->text_decoration_color.value.color);
@@ -279,7 +282,14 @@ void NRStyle::set(SPStyle *style, SPStyle *context_style)
// No decoration fill because no text fill
text_decoration_fill.clear();
}
+ } else {
+ // Pick color/pattern from text
+ text_decoration_fill.set(&(style_td->fill));
+ }
+ if (style_td->text_decoration_stroke.set) {
+ text_decoration_stroke.set(&(style_td->text_decoration_stroke));
+ } else if (style_td->text_decoration_color.set) {
if(style->stroke.isPaintserver() || style->stroke.isColor()) {
// SVG sets color specifically
text_decoration_stroke.set(style->text_decoration_color.value.color);
@@ -287,10 +297,8 @@ void NRStyle::set(SPStyle *style, SPStyle *context_style)
// No decoration stroke because no text stroke
text_decoration_stroke.clear();
}
-
} else {
// Pick color/pattern from text
- text_decoration_fill.set(&(style_td->fill));
text_decoration_stroke.set(&(style_td->stroke));
}
diff --git a/src/style.cpp b/src/style.cpp
index aa3efa630..203abc608 100644
--- a/src/style.cpp
+++ b/src/style.cpp
@@ -115,6 +115,8 @@ class SPStylePropHelper {
REGISTER_PROPERTY(SP_PROP_TEXT_DECORATION_LINE, text_decoration_line, "text-decoration-line");
REGISTER_PROPERTY(SP_PROP_TEXT_DECORATION_STYLE, text_decoration_style, "text-decoration-style");
REGISTER_PROPERTY(SP_PROP_TEXT_DECORATION_COLOR, text_decoration_color, "text-decoration-color");
+ REGISTER_PROPERTY(SP_PROP_TEXT_DECORATION_FILL, text_decoration_fill, "text-decoration-fill");
+ REGISTER_PROPERTY(SP_PROP_TEXT_DECORATION_STROKE, text_decoration_stroke, "text-decoration-stroke");
REGISTER_PROPERTY(SP_PROP_LETTER_SPACING, letter_spacing, "letter-spacing");
REGISTER_PROPERTY(SP_PROP_WORD_SPACING, word_spacing, "word-spacing");
@@ -332,6 +334,8 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) :
text_decoration_line(),
text_decoration_style(),
text_decoration_color( "text-decoration-color" ), // SPIColor
+ text_decoration_fill( "text-decoration-fill" ), // SPIPaint
+ text_decoration_stroke("text-decoration-stroke" ), // SPIPaint
// General visual properties
clip_rule( "clip-rule", enum_clip_rule, SP_WIND_RULE_NONZERO ),
diff --git a/src/style.h b/src/style.h
index 47874096a..a4e816014 100644
--- a/src/style.h
+++ b/src/style.h
@@ -186,6 +186,8 @@ public:
SPITextDecorationLine text_decoration_line;
SPITextDecorationStyle text_decoration_style; // SPIEnum? Only one can be set at time.
SPIColor text_decoration_color;
+ SPIPaint text_decoration_fill;
+ SPIPaint text_decoration_stroke;
// used to implement text_decoration, not saved to or read from SVG file
SPITextDecorationData text_decoration_data;