summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2017-10-16 09:39:26 +0000
committerTavmjong Bah <tavmjong@free.fr>2017-10-16 09:39:26 +0000
commit5c009e15be8446c010a4103a9626653c7819274a (patch)
treefdd71bdcb8c0d6b12748ed372431c125f9ffb638
parentFix link for FAQ entry on DPI change (diff)
downloadinkscape-5c009e15be8446c010a4103a9626653c7819274a.tar.gz
inkscape-5c009e15be8446c010a4103a9626653c7819274a.zip
Update properties for SVG 2 text. Partial work from Alex Roman
-rw-r--r--share/attributes/css_defaults8
-rw-r--r--share/attributes/cssprops12
-rwxr-xr-xshare/attributes/genMapDataCSS.pl18
-rw-r--r--share/attributes/svgprops14
-rw-r--r--src/attributes.cpp3
-rw-r--r--src/attributes.h3
-rw-r--r--src/style.cpp32
-rw-r--r--src/style.h5
-rw-r--r--testfiles/src/attributes-test.cpp5
9 files changed, 70 insertions, 30 deletions
diff --git a/share/attributes/css_defaults b/share/attributes/css_defaults
index ff9b39b6d..1a5c4ccf3 100644
--- a/share/attributes/css_defaults
+++ b/share/attributes/css_defaults
@@ -78,6 +78,8 @@
"image-rendering" - "auto" - "yes"
+"inline-size" - "0" - "no"
+
"isolation" - "auto" - "no"
"kerning" - "auto" - "yes"
@@ -116,12 +118,12 @@
"shape-margin" - "0" - "no"
-"shape-outside" - "auto" - "no"
-
-"shape-padding" - "none" - "no"
+"shape-padding" - "0" - "no"
"shape-rendering" - "auto" - "yes"
+"shape-subtract" - "auto" - "no"
+
"solid-color" - "#000000" - "no"
"solid-opacity" - "1" - "no"
diff --git a/share/attributes/cssprops b/share/attributes/cssprops
index 5e796235e..18f04ce3c 100644
--- a/share/attributes/cssprops
+++ b/share/attributes/cssprops
@@ -78,6 +78,8 @@
"image-rendering" - "pattern","image","feImage","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
+"inline-size" - "text"
+
"isolation" - "a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","circle","ellipse","image","line","path","polygon","polyline","rect","text","flowRoot","use"
"kerning" - "altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
@@ -112,16 +114,16 @@
"pointer-events" - "circle","ellipse","image","line","path","polygon","polyline","rect","text","flowRoot","use","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
-"shape-inside" - "altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan"
-
-"shape-margin" - "altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan"
+"shape-inside" - "text"
-"shape-outside" - "altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan"
+"shape-margin" - "text"
-"shape-padding" - "altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan"
+"shape-padding" - "text"
"shape-rendering" - "path","rect","circle","ellipse","line","polyline","polygon","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
+"shape-subtract" - "text"
+
"solid-color" - "a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","circle","ellipse","image","line","path","polygon","polyline","rect","text","flowRoot","use"
"solid-opacity" - "a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","circle","ellipse","image","line","path","polygon","polyline","rect","text","flowRoot","use"
diff --git a/share/attributes/genMapDataCSS.pl b/share/attributes/genMapDataCSS.pl
index a6f432a47..91d09e37b 100755
--- a/share/attributes/genMapDataCSS.pl
+++ b/share/attributes/genMapDataCSS.pl
@@ -215,22 +215,26 @@ push @{$properties{ "white-space" }->{elements}}, @text_content_elements;
$properties{ "white-space" }->{default} = "normal";
$properties{ "white-space" }->{inherit} = "yes";
-push @{$properties{ "shape-inside" }->{elements}}, @text_content_elements;
+push @{$properties{ "shape-inside" }->{elements}}, "text";
$properties{ "shape-inside" }->{default} = "auto";
$properties{ "shape-inside" }->{inherit} = "no";
-push @{$properties{ "shape-outside" }->{elements}}, @text_content_elements;
-$properties{ "shape-outside" }->{default} = "auto";
-$properties{ "shape-outside" }->{inherit} = "no";
+push @{$properties{ "shape-subtract" }->{elements}}, "text";
+$properties{ "shape-subtract" }->{default} = "auto";
+$properties{ "shape-subtract" }->{inherit} = "no";
-push @{$properties{ "shape-padding" }->{elements}}, @text_content_elements;
-$properties{ "shape-padding" }->{default} = "none";
+push @{$properties{ "shape-padding" }->{elements}}, "text";
+$properties{ "shape-padding" }->{default} = "0";
$properties{ "shape-padding" }->{inherit} = "no";
-push @{$properties{ "shape-margin" }->{elements}}, @text_content_elements;
+push @{$properties{ "shape-margin" }->{elements}}, "text";
$properties{ "shape-margin" }->{default} = "0";
$properties{ "shape-margin" }->{inherit} = "no";
+push @{$properties{ "inline-size" }->{elements}}, "text";
+$properties{ "inline-size" }->{default} = "0";
+$properties{ "inline-size" }->{inherit} = "no";
+
#CSS Text Level 3
push @{$properties{ "text-indent" }->{elements}}, @container_elements;
diff --git a/share/attributes/svgprops b/share/attributes/svgprops
index 810ad5661..fc2c01d9b 100644
--- a/share/attributes/svgprops
+++ b/share/attributes/svgprops
@@ -516,6 +516,8 @@
"image-rendering" - "pattern","image","feImage","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
+"inline-size" - "text"
+
"isolation" - "a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","circle","ellipse","image","line","path","polygon","polyline","rect","text","flowRoot","use"
"kerning" - "altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
@@ -524,7 +526,7 @@
"lighting-color" - "feDiffuseLighting","feSpecularLighting"
-"line-height" - "text","flowRoot","flowPara"
+"line-height" - "text","tspan","flowRoot","flowPara"
"marker" - "path","line","polyline","polygon","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
@@ -550,16 +552,16 @@
"pointer-events" - "circle","ellipse","image","line","path","polygon","polyline","rect","text","flowRoot","use","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
-"shape-inside" - "altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan"
-
-"shape-margin" - "altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan"
+"shape-inside" - "text"
-"shape-outside" - "altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan"
+"shape-margin" - "text"
-"shape-padding" - "altGlyph","textPath","text","tref","tspan","flowRoot","flowPara","flowSpan"
+"shape-padding" - "text"
"shape-rendering" - "path","rect","circle","ellipse","line","polyline","polygon","a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use"
+"shape-subtract" - "text"
+
"solid-color" - "a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","circle","ellipse","image","line","path","polygon","polyline","rect","text","flowRoot","use"
"solid-opacity" - "a","defs","glyph","g","marker","mask","missing-glyph","pattern","svg","switch","symbol","use","circle","ellipse","image","line","path","polygon","polyline","rect","text","flowRoot","use"
diff --git a/src/attributes.cpp b/src/attributes.cpp
index 9ba646ab4..6522563af 100644
--- a/src/attributes.cpp
+++ b/src/attributes.cpp
@@ -507,9 +507,10 @@ static SPStyleProp const props[] = {
/* SVG 2 Text Wrapping */
{SP_PROP_SHAPE_INSIDE, "shape-inside"},
- {SP_PROP_SHAPE_OUTSIDE, "shape-outside"},
+ {SP_PROP_SHAPE_SUBTRACT,"shape-subtract"},
{SP_PROP_SHAPE_PADDING, "shape-padding"},
{SP_PROP_SHAPE_MARGIN, "shape-margin"},
+ {SP_PROP_INLINE_SIZE, "inline-size"},
/* Text Decoration */
{SP_PROP_TEXT_DECORATION, "text-decoration"}, // CSS 2/CSS3-Shorthand
diff --git a/src/attributes.h b/src/attributes.h
index 3fee14133..a2c1c30f5 100644
--- a/src/attributes.h
+++ b/src/attributes.h
@@ -515,9 +515,10 @@ enum SPAttributeEnum {
/* SVG 2 Text Wrapping */
SP_PROP_SHAPE_INSIDE,
- SP_PROP_SHAPE_OUTSIDE,
+ SP_PROP_SHAPE_SUBTRACT,
SP_PROP_SHAPE_PADDING,
SP_PROP_SHAPE_MARGIN,
+ SP_PROP_INLINE_SIZE,
/* Text Decoration */
SP_PROP_TEXT_DECORATION, // CSS 2/CSS3-Shorthand
diff --git a/src/style.cpp b/src/style.cpp
index d5bbcd9ce..608cca1e6 100644
--- a/src/style.cpp
+++ b/src/style.cpp
@@ -134,9 +134,10 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) :
// SVG 2 Text Wrapping
shape_inside( "shape-inside" ), // SPIString
- //shape_outside( "shape-outside" ), // SPIString
+ shape_subtract( "shape-subtract" ), // SPIString
shape_padding( "shape-padding", 0.0 ), // SPILength for now
- //shape_margin( "shape-margin", 0.0 ), // SPILength for now
+ shape_margin( "shape-margin", 0.0 ), // SPILength for now
+ inline_size( "inline-size", 0.0 ), // SPILength for now
text_decoration(),
text_decoration_line(),
@@ -252,6 +253,8 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) :
stroke_width.setStylePointer( this );
stroke_dashoffset.setStylePointer( this );
shape_padding.setStylePointer( this );
+ shape_margin.setStylePointer( this );
+ inline_size.setStylePointer( this );
// Properties that depend on 'color'
text_decoration_color.setStylePointer( this );
@@ -323,7 +326,10 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) :
_properties.push_back( &white_space );
_properties.push_back( &shape_inside );
+ _properties.push_back( &shape_subtract );
_properties.push_back( &shape_padding );
+ _properties.push_back( &shape_margin );
+ _properties.push_back( &inline_size );
_properties.push_back( &clip_rule );
_properties.push_back( &display );
@@ -799,9 +805,18 @@ SPStyle::readIfUnset( gint id, gchar const *val, SPStyleSrc const &source ) {
case SP_PROP_SHAPE_INSIDE:
shape_inside.readIfUnset( val, source );
break;
+ case SP_PROP_SHAPE_SUBTRACT:
+ shape_subtract.readIfUnset( val, source );
+ break;
case SP_PROP_SHAPE_PADDING:
shape_padding.readIfUnset( val, source );
break;
+ case SP_PROP_SHAPE_MARGIN:
+ shape_margin.readIfUnset( val, source );
+ break;
+ case SP_PROP_INLINE_SIZE:
+ inline_size.readIfUnset( val, source );
+ break;
case SP_PROP_DOMINANT_BASELINE:
dominant_baseline.readIfUnset( val, source );
break;
@@ -1153,7 +1168,6 @@ SPStyle::_mergeDecl( CRDeclaration const *const decl, SPStyleSrc const &source
* convert to string. Alternatively, set from CRTerm directly rather
* than converting to string.
*/
-
guchar *const str_value_unsigned = cr_term_to_string(decl->value);
gchar *const str_value = reinterpret_cast<gchar *>(str_value_unsigned);
@@ -1720,9 +1734,18 @@ sp_style_unset_property_attrs(SPObject *o)
if (style->shape_inside.set) {
repr->setAttribute("shape-inside", NULL);
}
+ if (style->shape_subtract.set) {
+ repr->setAttribute("shape-subtract", NULL);
+ }
if (style->shape_padding.set) {
repr->setAttribute("shape-padding", NULL);
}
+ if (style->shape_margin.set) {
+ repr->setAttribute("shape-margin", NULL);
+ }
+ if (style->inline_size.set) {
+ repr->setAttribute("inline-size", NULL);
+ }
if (style->writing_mode.set) {
repr->setAttribute("writing-mode", NULL);
}
@@ -1815,7 +1838,10 @@ sp_css_attr_unset_text(SPCSSAttr *css)
sp_repr_css_set_property(css, "text-anchor", NULL);
sp_repr_css_set_property(css, "white-space", NULL);
sp_repr_css_set_property(css, "shape-inside", NULL);
+ sp_repr_css_set_property(css, "shape-subtract", NULL);
sp_repr_css_set_property(css, "shape-padding", NULL);
+ sp_repr_css_set_property(css, "shape-margin", NULL);
+ sp_repr_css_set_property(css, "inline-size", 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
diff --git a/src/style.h b/src/style.h
index 85d07b9ef..1b6ee2f47 100644
--- a/src/style.h
+++ b/src/style.h
@@ -166,9 +166,10 @@ public:
/** SVG2 Text Wrapping */
SPIString shape_inside;
- // SPIString shape_outside;
+ SPIString shape_subtract;
SPILength shape_padding;
- // SPILength shape_margin;
+ SPILength shape_margin;
+ SPILength inline_size;
/* Text Decoration ----------------------- */
diff --git a/testfiles/src/attributes-test.cpp b/testfiles/src/attributes-test.cpp
index f6881fc09..da9a8d592 100644
--- a/testfiles/src/attributes-test.cpp
+++ b/testfiles/src/attributes-test.cpp
@@ -51,7 +51,7 @@ std::vector<AttributeInfo> getKnownAttrs()
attindex.html lacks attributeName, begin, additive, font, marker;
I've added these manually.
- SVG 2: white-space, shape-inside, shape-outside, shape-padding, shape-margin
+ SVG 2: white-space, shape-inside, shape-subtrace, shape-padding, shape-margin
*/
AttributeInfo all_attrs[] = {
AttributeInfo("attributeName", true),
@@ -174,6 +174,7 @@ std::vector<AttributeInfo> getKnownAttrs()
AttributeInfo("image-rendering", true),
AttributeInfo("in", true),
AttributeInfo("in2", true),
+ AttributeInfo("inline-size", true),
AttributeInfo("intercept", true),
AttributeInfo("isolation", true),
AttributeInfo("k", true),
@@ -274,7 +275,7 @@ std::vector<AttributeInfo> getKnownAttrs()
AttributeInfo("seed", true),
AttributeInfo("shape-inside", true),
AttributeInfo("shape-margin", true),
- AttributeInfo("shape-outside", true),
+ AttributeInfo("shape-subtract", true),
AttributeInfo("shape-padding", true),
AttributeInfo("shape-rendering", true),
AttributeInfo("slope", true),