diff --git a/Source/Document Structure/SvgUse.cs b/Source/Document Structure/SvgUse.cs index dc49aaf1a3694320818134de5cff0f10b524cfce..5448ec23046043ec436342946b206cffb9ee9dd5 100644 --- a/Source/Document Structure/SvgUse.cs +++ b/Source/Document Structure/SvgUse.cs @@ -80,6 +80,9 @@ namespace Svg { var origParent = element.Parent; element._parent = this; + // as the new parent may have other styles that are inherited, + // we have to redraw the paths for the children + element.InvalidateChildPaths(); element.RenderElement(renderer); element._parent = origParent; } diff --git a/Source/SvgElement.cs b/Source/SvgElement.cs index c746afa783e13b5936b222e4c4029f46f49eeaac..a419eb3bd060529031091f3f959030dc56e6e205 100644 --- a/Source/SvgElement.cs +++ b/Source/SvgElement.cs @@ -377,9 +377,9 @@ namespace Svg } /// - /// Gets or sets the text anchor. + /// Gets or sets the space handling. /// - /// The text anchor. + /// The space handling. [SvgAttribute("space", SvgAttributeAttribute.XmlNamespace)] public virtual XmlSpaceHandling SpaceHandling { diff --git a/Source/SvgElementStyle.cs b/Source/SvgElementStyle.cs index cd9c1f527d872772f5b3e683c8da0d90ee635e46..626736c01a158c39b87dc9976d294157197691f4 100644 --- a/Source/SvgElementStyle.cs +++ b/Source/SvgElementStyle.cs @@ -26,6 +26,18 @@ namespace Svg set { this._dirty = value; } } + /// + /// Force recreation of the paths for the element and it's children. + /// + public void InvalidateChildPaths() + { + this.IsPathDirty = true; + foreach (SvgElement element in this.Children) + { + element.InvalidateChildPaths(); + } + } + protected static float FixOpacityValue(float value) { const float max = 1.0f; @@ -157,6 +169,26 @@ namespace Svg set { this.Attributes["shape-rendering"] = value; } } + /// + /// Gets or sets the text anchor. + /// + [SvgAttribute("text-anchor", true)] + public virtual SvgTextAnchor TextAnchor + { + get { return this.Attributes.GetInheritedAttribute("text-anchor"); } + set { this.Attributes["text-anchor"] = value; this.IsPathDirty = true; } + } + + /// + /// Specifies dominant-baseline positioning of text. + /// + [SvgAttribute("baseline-shift", true)] + public virtual string BaselineShift + { + get { return this.Attributes.GetInheritedAttribute("baseline-shift"); } + set { this.Attributes["baseline-shift"] = value; this.IsPathDirty = true; } + } + /// /// Indicates which font family is to be used to render the text. /// diff --git a/Source/Text/SvgTextBase.cs b/Source/Text/SvgTextBase.cs index 98acf1d7f99293d385aad712abb907832e313d3d..b478f6b08e20e7084bf37a58a29668c72d8b1981 100644 --- a/Source/Text/SvgTextBase.cs +++ b/Source/Text/SvgTextBase.cs @@ -38,24 +38,6 @@ namespace Svg } } - /// - /// Gets or sets the text anchor. - /// - /// The text anchor. - [SvgAttribute("text-anchor", true)] - public virtual SvgTextAnchor TextAnchor - { - get { return (this.Attributes["text-anchor"] == null) ? SvgTextAnchor.Inherit : (SvgTextAnchor)this.Attributes["text-anchor"]; } - set { this.Attributes["text-anchor"] = value; this.IsPathDirty = true; } - } - - [SvgAttribute("baseline-shift", true)] - public virtual string BaselineShift - { - get { return this.Attributes["baseline-shift"] as string; } - set { this.Attributes["baseline-shift"] = value; this.IsPathDirty = true; } - } - public override XmlSpaceHandling SpaceHandling { get { return base.SpaceHandling; } diff --git a/Tests/W3CTestSuite/PassingTests.txt b/Tests/W3CTestSuite/PassingTests.txt index 14d53762c4e9ff62bdc8bcbd0d8b4342f9c48c81..181ee86cbceb4b31d2418b77d69d5507c573f06d 100644 --- a/Tests/W3CTestSuite/PassingTests.txt +++ b/Tests/W3CTestSuite/PassingTests.txt @@ -163,11 +163,13 @@ text-text-08-b.svg text-text-09-t.svg text-text-10-t.svg text-text-11-t.svg +text-text-12-t.svg text-tref-01-b.svg text-tspan-01-b.svg text-ws-01-t.svg text-ws-02-t.svg text-ws-03-t.svg +types-basic-01-f.svg painting-stroke-02-t.svg coords-viewattr-04-f.svg fonts-desc-01-t.svg diff --git a/Tests/W3CTestSuite/png/__Flag_of_the_United_States.png b/Tests/W3CTestSuite/png/__Flag_of_the_United_States.png new file mode 100644 index 0000000000000000000000000000000000000000..f16b669148dcc19aa2424212555674c7b2ac195e Binary files /dev/null and b/Tests/W3CTestSuite/png/__Flag_of_the_United_States.png differ diff --git a/Tests/W3CTestSuite/svg/__Flag_of_the_United_States.svg b/Tests/W3CTestSuite/svg/__Flag_of_the_United_States.svg new file mode 100644 index 0000000000000000000000000000000000000000..c31e8959470952661ede314f9b5d3f7d91f36e5d --- /dev/null +++ b/Tests/W3CTestSuite/svg/__Flag_of_the_United_States.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file