Commit ec0cf19d authored by Eric Domke's avatar Eric Domke
Browse files

Serialization Bug Fixes

Added parameter to the SvgAttribute indicating whether the storage is
the _attribute dictionary.  If true, the output will only be serialized
only if the key is in the dictionary.  This structure is an alternate to
the SvgDefinitionDefaults class.
parent b86dfd73
...@@ -81,7 +81,14 @@ namespace Svg ...@@ -81,7 +81,14 @@ namespace Svg
public override string ToString() public override string ToString()
{ {
return (_serverLoaded ? _serverLoaded.ToString() : string.Format("deferred: {0}", this.DeferredId)); if (this.DeferredId == "currentColor")
{
return this.DeferredId;
}
else
{
return string.Format("url({0})", this.DeferredId);
}
} }
public static T TryGet<T>(SvgPaintServer server, SvgElement parent) where T : SvgPaintServer public static T TryGet<T>(SvgPaintServer server, SvgElement parent) where T : SvgPaintServer
......
...@@ -135,15 +135,22 @@ namespace Svg ...@@ -135,15 +135,22 @@ namespace Svg
if (destinationType == typeof(string)) if (destinationType == typeof(string))
{ {
//check for none //check for none
if (value == SvgPaintServer.None) return "none"; if (value == SvgPaintServer.None || value == SvgColourServer.None) return "none";
if (value == SvgColourServer.Inherit) return "inherit";
if (value == SvgColourServer.NotSet) return "";
var colourServer = value as SvgColourServer; var colourServer = value as SvgColourServer;
if (colourServer != null) if (colourServer != null)
{ {
return new SvgColourConverter().ConvertTo(colourServer.Colour, typeof(string)); return new SvgColourConverter().ConvertTo(colourServer.Colour, typeof(string));
} }
var deferred = value as SvgDeferredPaintServer;
if (deferred != null)
{
return deferred.ToString();
}
if (value != null) if (value != null)
{ {
return string.Format(CultureInfo.InvariantCulture, "url(#{0})", ((SvgPaintServer)value).ID); return string.Format(CultureInfo.InvariantCulture, "url(#{0})", ((SvgPaintServer)value).ID);
......
...@@ -22,7 +22,7 @@ namespace Svg ...@@ -22,7 +22,7 @@ namespace Svg
/// <summary> /// <summary>
/// Gets or sets a <see cref="SvgPathSegmentList"/> of path data. /// Gets or sets a <see cref="SvgPathSegmentList"/> of path data.
/// </summary> /// </summary>
[SvgAttribute("d")] [SvgAttribute("d", true)]
public SvgPathSegmentList PathData public SvgPathSegmentList PathData
{ {
get { return this.Attributes.GetAttribute<SvgPathSegmentList>("d"); } get { return this.Attributes.GetAttribute<SvgPathSegmentList>("d"); }
...@@ -37,7 +37,7 @@ namespace Svg ...@@ -37,7 +37,7 @@ namespace Svg
/// <summary> /// <summary>
/// Gets or sets the length of the path. /// Gets or sets the length of the path.
/// </summary> /// </summary>
[SvgAttribute("pathLength")] [SvgAttribute("pathLength", true)]
public float PathLength public float PathLength
{ {
get { return this.Attributes.GetAttribute<float>("pathLength"); } get { return this.Attributes.GetAttribute<float>("pathLength"); }
...@@ -48,7 +48,7 @@ namespace Svg ...@@ -48,7 +48,7 @@ namespace Svg
/// <summary> /// <summary>
/// Gets or sets the marker (end cap) of the path. /// Gets or sets the marker (end cap) of the path.
/// </summary> /// </summary>
[SvgAttribute("marker-end")] [SvgAttribute("marker-end", true)]
public Uri MarkerEnd public Uri MarkerEnd
{ {
get { return this.Attributes.GetAttribute<Uri>("marker-end"); } get { return this.Attributes.GetAttribute<Uri>("marker-end"); }
...@@ -59,7 +59,7 @@ namespace Svg ...@@ -59,7 +59,7 @@ namespace Svg
/// <summary> /// <summary>
/// Gets or sets the marker (start cap) of the path. /// Gets or sets the marker (start cap) of the path.
/// </summary> /// </summary>
[SvgAttribute("marker-mid")] [SvgAttribute("marker-mid", true)]
public Uri MarkerMid public Uri MarkerMid
{ {
get { return this.Attributes.GetAttribute<Uri>("marker-mid"); } get { return this.Attributes.GetAttribute<Uri>("marker-mid"); }
...@@ -70,7 +70,7 @@ namespace Svg ...@@ -70,7 +70,7 @@ namespace Svg
/// <summary> /// <summary>
/// Gets or sets the marker (start cap) of the path. /// Gets or sets the marker (start cap) of the path.
/// </summary> /// </summary>
[SvgAttribute("marker-start")] [SvgAttribute("marker-start", true)]
public Uri MarkerStart public Uri MarkerStart
{ {
get { return this.Attributes.GetAttribute<Uri>("marker-start"); } get { return this.Attributes.GetAttribute<Uri>("marker-start"); }
......
...@@ -26,6 +26,7 @@ namespace Svg ...@@ -26,6 +26,7 @@ namespace Svg
new KeyValuePair<string, string>(XLinkPrefix, XLinkNamespace), new KeyValuePair<string, string>(XLinkPrefix, XLinkNamespace),
new KeyValuePair<string, string>("xml", XmlNamespace) new KeyValuePair<string, string>("xml", XmlNamespace)
}; };
private bool _inAttrDictionary;
private string _name; private string _name;
private string _namespace; private string _namespace;
...@@ -80,6 +81,11 @@ namespace Svg ...@@ -80,6 +81,11 @@ namespace Svg
get { return this._namespace; } get { return this._namespace; }
} }
public bool InAttributeDictionary
{
get { return this._inAttrDictionary; }
}
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="SvgAttributeAttribute"/> class. /// Initializes a new instance of the <see cref="SvgAttributeAttribute"/> class.
/// </summary> /// </summary>
...@@ -98,6 +104,13 @@ namespace Svg ...@@ -98,6 +104,13 @@ namespace Svg
this._namespace = SvgNamespace; this._namespace = SvgNamespace;
} }
internal SvgAttributeAttribute(string name, bool inAttrDictionary)
{
this._name = name;
this._namespace = SvgNamespace;
this._inAttrDictionary = inAttrDictionary;
}
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="SvgAttributeAttribute"/> class with the specified SVG attribute name and namespace. /// Initializes a new instance of the <see cref="SvgAttributeAttribute"/> class with the specified SVG attribute name and namespace.
/// </summary> /// </summary>
......
...@@ -15,6 +15,8 @@ namespace Svg ...@@ -15,6 +15,8 @@ namespace Svg
static SvgDefaults() static SvgDefaults()
{ {
_defaults["d"] = "";
_defaults["viewBox"] = "0, 0, 0, 0"; _defaults["viewBox"] = "0, 0, 0, 0";
_defaults["visibility"] = "visible"; _defaults["visibility"] = "visible";
......
...@@ -559,13 +559,13 @@ namespace Svg ...@@ -559,13 +559,13 @@ namespace Svg
writer.WriteEndElement(); writer.WriteEndElement();
} }
} }
protected virtual void WriteAttributes(XmlTextWriter writer) protected virtual void WriteAttributes(XmlTextWriter writer)
{ {
//properties //properties
foreach (var attr in _svgPropertyAttributes) foreach (var attr in _svgPropertyAttributes)
{ {
if (attr.Property.Converter.CanConvertTo(typeof(string))) if (attr.Property.Converter.CanConvertTo(typeof(string)) &&
(!attr.Attribute.InAttributeDictionary || _attributes.ContainsKey(attr.Attribute.Name)))
{ {
object propertyValue = attr.Property.GetValue(this); object propertyValue = attr.Property.GetValue(this);
......
...@@ -36,7 +36,7 @@ namespace Svg ...@@ -36,7 +36,7 @@ namespace Svg
/// <summary> /// <summary>
/// Gets or sets the fill <see cref="SvgPaintServer"/> of this element. /// Gets or sets the fill <see cref="SvgPaintServer"/> of this element.
/// </summary> /// </summary>
[SvgAttribute("fill")] [SvgAttribute("fill", true)]
public virtual SvgPaintServer Fill public virtual SvgPaintServer Fill
{ {
get { return (this.Attributes["fill"] == null) ? SvgColourServer.NotSet : (SvgPaintServer)this.Attributes["fill"]; } get { return (this.Attributes["fill"] == null) ? SvgColourServer.NotSet : (SvgPaintServer)this.Attributes["fill"]; }
...@@ -46,14 +46,14 @@ namespace Svg ...@@ -46,14 +46,14 @@ namespace Svg
/// <summary> /// <summary>
/// Gets or sets the <see cref="SvgPaintServer"/> to be used when rendering a stroke around this element. /// Gets or sets the <see cref="SvgPaintServer"/> to be used when rendering a stroke around this element.
/// </summary> /// </summary>
[SvgAttribute("stroke")] [SvgAttribute("stroke", true)]
public virtual SvgPaintServer Stroke public virtual SvgPaintServer Stroke
{ {
get { return (this.Attributes["stroke"] == null) ? null : (SvgPaintServer)this.Attributes["stroke"]; } get { return (this.Attributes["stroke"] == null) ? null : (SvgPaintServer)this.Attributes["stroke"]; }
set { this.Attributes["stroke"] = value; } set { this.Attributes["stroke"] = value; }
} }
[SvgAttribute("fill-rule")] [SvgAttribute("fill-rule", true)]
public virtual SvgFillRule FillRule public virtual SvgFillRule FillRule
{ {
get { return (this.Attributes["fill-rule"] == null) ? SvgFillRule.NonZero : (SvgFillRule)this.Attributes["fill-rule"]; } get { return (this.Attributes["fill-rule"] == null) ? SvgFillRule.NonZero : (SvgFillRule)this.Attributes["fill-rule"]; }
...@@ -63,7 +63,7 @@ namespace Svg ...@@ -63,7 +63,7 @@ namespace Svg
/// <summary> /// <summary>
/// Gets or sets the opacity of this element's <see cref="Fill"/>. /// Gets or sets the opacity of this element's <see cref="Fill"/>.
/// </summary> /// </summary>
[SvgAttribute("fill-opacity")] [SvgAttribute("fill-opacity", true)]
public virtual float FillOpacity public virtual float FillOpacity
{ {
get { return (this.Attributes["fill-opacity"] == null) ? this.Opacity : (float)this.Attributes["fill-opacity"]; } get { return (this.Attributes["fill-opacity"] == null) ? this.Opacity : (float)this.Attributes["fill-opacity"]; }
...@@ -73,42 +73,42 @@ namespace Svg ...@@ -73,42 +73,42 @@ namespace Svg
/// <summary> /// <summary>
/// Gets or sets the width of the stroke (if the <see cref="Stroke"/> property has a valid value specified. /// Gets or sets the width of the stroke (if the <see cref="Stroke"/> property has a valid value specified.
/// </summary> /// </summary>
[SvgAttribute("stroke-width")] [SvgAttribute("stroke-width", true)]
public virtual SvgUnit StrokeWidth public virtual SvgUnit StrokeWidth
{ {
get { return (this.Attributes["stroke-width"] == null) ? new SvgUnit(1.0f) : (SvgUnit)this.Attributes["stroke-width"]; } get { return (this.Attributes["stroke-width"] == null) ? new SvgUnit(1.0f) : (SvgUnit)this.Attributes["stroke-width"]; }
set { this.Attributes["stroke-width"] = value; } set { this.Attributes["stroke-width"] = value; }
} }
[SvgAttribute("stroke-linecap")] [SvgAttribute("stroke-linecap", true)]
public virtual SvgStrokeLineCap StrokeLineCap public virtual SvgStrokeLineCap StrokeLineCap
{ {
get { return (this.Attributes["stroke-linecap"] == null) ? SvgStrokeLineCap.Butt : (SvgStrokeLineCap)this.Attributes["stroke-linecap"]; } get { return (this.Attributes["stroke-linecap"] == null) ? SvgStrokeLineCap.Butt : (SvgStrokeLineCap)this.Attributes["stroke-linecap"]; }
set { this.Attributes["stroke-linecap"] = value; } set { this.Attributes["stroke-linecap"] = value; }
} }
[SvgAttribute("stroke-linejoin")] [SvgAttribute("stroke-linejoin", true)]
public virtual SvgStrokeLineJoin StrokeLineJoin public virtual SvgStrokeLineJoin StrokeLineJoin
{ {
get { return (this.Attributes["stroke-linejoin"] == null) ? SvgStrokeLineJoin.Miter : (SvgStrokeLineJoin)this.Attributes["stroke-linejoin"]; } get { return (this.Attributes["stroke-linejoin"] == null) ? SvgStrokeLineJoin.Miter : (SvgStrokeLineJoin)this.Attributes["stroke-linejoin"]; }
set { this.Attributes["stroke-linejoin"] = value; } set { this.Attributes["stroke-linejoin"] = value; }
} }
[SvgAttribute("stroke-miterlimit")] [SvgAttribute("stroke-miterlimit", true)]
public virtual float StrokeMiterLimit public virtual float StrokeMiterLimit
{ {
get { return (this.Attributes["stroke-miterlimit"] == null) ? 4f : (float)this.Attributes["stroke-miterlimit"]; } get { return (this.Attributes["stroke-miterlimit"] == null) ? 4f : (float)this.Attributes["stroke-miterlimit"]; }
set { this.Attributes["stroke-miterlimit"] = value; } set { this.Attributes["stroke-miterlimit"] = value; }
} }
[SvgAttribute("stroke-dasharray")] [SvgAttribute("stroke-dasharray", true)]
public virtual SvgUnitCollection StrokeDashArray public virtual SvgUnitCollection StrokeDashArray
{ {
get { return this.Attributes["stroke-dasharray"] as SvgUnitCollection; } get { return this.Attributes["stroke-dasharray"] as SvgUnitCollection; }
set { this.Attributes["stroke-dasharray"] = value; } set { this.Attributes["stroke-dasharray"] = value; }
} }
[SvgAttribute("stroke-dashoffset")] [SvgAttribute("stroke-dashoffset", true)]
public virtual SvgUnit StrokeDashOffset public virtual SvgUnit StrokeDashOffset
{ {
get { return (this.Attributes["stroke-dashoffset"] == null) ? SvgUnit.Empty : (SvgUnit)this.Attributes["stroke-dashoffset"]; } get { return (this.Attributes["stroke-dashoffset"] == null) ? SvgUnit.Empty : (SvgUnit)this.Attributes["stroke-dashoffset"]; }
...@@ -118,7 +118,7 @@ namespace Svg ...@@ -118,7 +118,7 @@ namespace Svg
/// <summary> /// <summary>
/// Gets or sets the opacity of the stroke, if the <see cref="Stroke"/> property has been specified. 1.0 is fully opaque; 0.0 is transparent. /// Gets or sets the opacity of the stroke, if the <see cref="Stroke"/> property has been specified. 1.0 is fully opaque; 0.0 is transparent.
/// </summary> /// </summary>
[SvgAttribute("stroke-opacity")] [SvgAttribute("stroke-opacity", true)]
public virtual float StrokeOpacity public virtual float StrokeOpacity
{ {
get { return (this.Attributes["stroke-opacity"] == null) ? this.Opacity : (float)this.Attributes["stroke-opacity"]; } get { return (this.Attributes["stroke-opacity"] == null) ? this.Opacity : (float)this.Attributes["stroke-opacity"]; }
...@@ -129,7 +129,7 @@ namespace Svg ...@@ -129,7 +129,7 @@ namespace Svg
/// Gets or sets the colour of the gradient stop. /// Gets or sets the colour of the gradient stop.
/// </summary> /// </summary>
/// <remarks>Apparently this can be set on non-sensical elements. Don't ask; just check the tests.</remarks> /// <remarks>Apparently this can be set on non-sensical elements. Don't ask; just check the tests.</remarks>
[SvgAttribute("stop-color")] [SvgAttribute("stop-color", true)]
[TypeConverter(typeof(SvgPaintServerFactory))] [TypeConverter(typeof(SvgPaintServerFactory))]
public SvgPaintServer StopColor public SvgPaintServer StopColor
{ {
...@@ -140,7 +140,7 @@ namespace Svg ...@@ -140,7 +140,7 @@ namespace Svg
/// <summary> /// <summary>
/// Gets or sets the opacity of the element. 1.0 is fully opaque; 0.0 is transparent. /// Gets or sets the opacity of the element. 1.0 is fully opaque; 0.0 is transparent.
/// </summary> /// </summary>
[SvgAttribute("opacity")] [SvgAttribute("opacity", true)]
public virtual float Opacity public virtual float Opacity
{ {
get { return (this.Attributes["opacity"] == null) ? 1.0f : (float)this.Attributes["opacity"]; } get { return (this.Attributes["opacity"] == null) ? 1.0f : (float)this.Attributes["opacity"]; }
...@@ -150,7 +150,7 @@ namespace Svg ...@@ -150,7 +150,7 @@ namespace Svg
/// <summary> /// <summary>
/// Indicates which font family is to be used to render the text. /// Indicates which font family is to be used to render the text.
/// </summary> /// </summary>
[SvgAttribute("font-family")] [SvgAttribute("font-family", true)]
public virtual string FontFamily public virtual string FontFamily
{ {
get { return this.Attributes["font-family"] as string; } get { return this.Attributes["font-family"] as string; }
...@@ -160,7 +160,7 @@ namespace Svg ...@@ -160,7 +160,7 @@ namespace Svg
/// <summary> /// <summary>
/// Refers to the size of the font from baseline to baseline when multiple lines of text are set solid in a multiline layout environment. /// Refers to the size of the font from baseline to baseline when multiple lines of text are set solid in a multiline layout environment.
/// </summary> /// </summary>
[SvgAttribute("font-size")] [SvgAttribute("font-size", true)]
public virtual SvgUnit FontSize public virtual SvgUnit FontSize
{ {
get { return (this.Attributes["font-size"] == null) ? SvgUnit.Empty : (SvgUnit)this.Attributes["font-size"]; } get { return (this.Attributes["font-size"] == null) ? SvgUnit.Empty : (SvgUnit)this.Attributes["font-size"]; }
...@@ -170,7 +170,7 @@ namespace Svg ...@@ -170,7 +170,7 @@ namespace Svg
/// <summary> /// <summary>
/// Refers to the style of the font. /// Refers to the style of the font.
/// </summary> /// </summary>
[SvgAttribute("font-style")] [SvgAttribute("font-style", true)]
public virtual SvgFontStyle FontStyle public virtual SvgFontStyle FontStyle
{ {
get { return (this.Attributes["font-style"] == null) ? SvgFontStyle.inherit : (SvgFontStyle)this.Attributes["font-style"]; } get { return (this.Attributes["font-style"] == null) ? SvgFontStyle.inherit : (SvgFontStyle)this.Attributes["font-style"]; }
...@@ -180,7 +180,7 @@ namespace Svg ...@@ -180,7 +180,7 @@ namespace Svg
/// <summary> /// <summary>
/// Refers to the varient of the font. /// Refers to the varient of the font.
/// </summary> /// </summary>
[SvgAttribute("font-variant")] [SvgAttribute("font-variant", true)]
public virtual SvgFontVariant FontVariant public virtual SvgFontVariant FontVariant
{ {
get { return (this.Attributes["font-variant"] == null) ? SvgFontVariant.inherit : (SvgFontVariant)this.Attributes["font-variant"]; } get { return (this.Attributes["font-variant"] == null) ? SvgFontVariant.inherit : (SvgFontVariant)this.Attributes["font-variant"]; }
...@@ -190,7 +190,7 @@ namespace Svg ...@@ -190,7 +190,7 @@ namespace Svg
/// <summary> /// <summary>
/// Refers to the boldness of the font. /// Refers to the boldness of the font.
/// </summary> /// </summary>
[SvgAttribute("text-decoration")] [SvgAttribute("text-decoration", true)]
public virtual SvgTextDecoration TextDecoration public virtual SvgTextDecoration TextDecoration
{ {
get { return (this.Attributes["text-decoration"] == null) ? SvgTextDecoration.inherit : (SvgTextDecoration)this.Attributes["text-decoration"]; } get { return (this.Attributes["text-decoration"] == null) ? SvgTextDecoration.inherit : (SvgTextDecoration)this.Attributes["text-decoration"]; }
...@@ -200,7 +200,7 @@ namespace Svg ...@@ -200,7 +200,7 @@ namespace Svg
/// <summary> /// <summary>
/// Refers to the boldness of the font. /// Refers to the boldness of the font.
/// </summary> /// </summary>
[SvgAttribute("font-weight")] [SvgAttribute("font-weight", true)]
public virtual SvgFontWeight FontWeight public virtual SvgFontWeight FontWeight
{ {
get { return (this.Attributes["font-weight"] == null) ? SvgFontWeight.inherit : (SvgFontWeight)this.Attributes["font-weight"]; } get { return (this.Attributes["font-weight"] == null) ? SvgFontWeight.inherit : (SvgFontWeight)this.Attributes["font-weight"]; }
...@@ -220,7 +220,7 @@ namespace Svg ...@@ -220,7 +220,7 @@ namespace Svg
/// <summary> /// <summary>
/// Set all font information. /// Set all font information.
/// </summary> /// </summary>
[SvgAttribute("font")] [SvgAttribute("font", true)]
public virtual string Font public virtual string Font
{ {
get { return (this.Attributes["font"] == null ? "" : this.Attributes["font"] as string); } get { return (this.Attributes["font"] == null ? "" : this.Attributes["font"] as string); }
......
...@@ -15,44 +15,44 @@ namespace Svg ...@@ -15,44 +15,44 @@ namespace Svg
/// <summary> /// <summary>
/// Gets or sets a <see cref="SvgPathSegmentList"/> of path data. /// Gets or sets a <see cref="SvgPathSegmentList"/> of path data.
/// </summary> /// </summary>
[SvgAttribute("d")] [SvgAttribute("d", true)]
public SvgPathSegmentList PathData public SvgPathSegmentList PathData
{ {
get { return this.Attributes.GetAttribute<SvgPathSegmentList>("d"); } get { return this.Attributes.GetAttribute<SvgPathSegmentList>("d"); }
set { this.Attributes["d"] = value; } set { this.Attributes["d"] = value; }
} }
[SvgAttribute("glyph-name")] [SvgAttribute("glyph-name", true)]
public virtual string GlyphName public virtual string GlyphName
{ {
get { return this.Attributes["glyph-name"] as string; } get { return this.Attributes["glyph-name"] as string; }
set { this.Attributes["glyph-name"] = value; } set { this.Attributes["glyph-name"] = value; }
} }
[SvgAttribute("horiz-adv-x")] [SvgAttribute("horiz-adv-x", true)]
public float HorizAdvX public float HorizAdvX
{ {
get { return (this.Attributes["horiz-adv-x"] == null ? this.Parents.OfType<SvgFont>().First().HorizAdvX : (float)this.Attributes["horiz-adv-x"]); } get { return (this.Attributes["horiz-adv-x"] == null ? this.Parents.OfType<SvgFont>().First().HorizAdvX : (float)this.Attributes["horiz-adv-x"]); }
set { this.Attributes["horiz-adv-x"] = value; } set { this.Attributes["horiz-adv-x"] = value; }
} }
[SvgAttribute("unicode")] [SvgAttribute("unicode", true)]
public string Unicode public string Unicode
{ {
get { return this.Attributes["unicode"] as string; } get { return this.Attributes["unicode"] as string; }
set { this.Attributes["unicode"] = value; } set { this.Attributes["unicode"] = value; }
} }
[SvgAttribute("vert-adv-y")] [SvgAttribute("vert-adv-y", true)]
public float VertAdvY public float VertAdvY
{ {
get { return (this.Attributes["vert-adv-y"] == null ? this.Parents.OfType<SvgFont>().First().VertAdvY : (float)this.Attributes["vert-adv-y"]); } get { return (this.Attributes["vert-adv-y"] == null ? this.Parents.OfType<SvgFont>().First().VertAdvY : (float)this.Attributes["vert-adv-y"]); }
set { this.Attributes["vert-adv-y"] = value; } set { this.Attributes["vert-adv-y"] = value; }
} }
[SvgAttribute("vert-origin-x")] [SvgAttribute("vert-origin-x", true)]
public float VertOriginX public float VertOriginX
{ {
get { return (this.Attributes["vert-origin-x"] == null ? this.Parents.OfType<SvgFont>().First().VertOriginX : (float)this.Attributes["vert-origin-x"]); } get { return (this.Attributes["vert-origin-x"] == null ? this.Parents.OfType<SvgFont>().First().VertOriginX : (float)this.Attributes["vert-origin-x"]); }
set { this.Attributes["vert-origin-x"] = value; } set { this.Attributes["vert-origin-x"] = value; }
} }
[SvgAttribute("vert-origin-y")] [SvgAttribute("vert-origin-y", true)]
public float VertOriginY public float VertOriginY
{ {
get { return (this.Attributes["vert-origin-y"] == null ? this.Parents.OfType<SvgFont>().First().VertOriginY : (float)this.Attributes["vert-origin-y"]); } get { return (this.Attributes["vert-origin-y"] == null ? this.Parents.OfType<SvgFont>().First().VertOriginY : (float)this.Attributes["vert-origin-y"]); }
......
...@@ -27,7 +27,14 @@ namespace Svg.Transforms ...@@ -27,7 +27,14 @@ namespace Svg.Transforms
public override string WriteToString() public override string WriteToString()
{ {
return string.Format(CultureInfo.InvariantCulture, "skew({0}, {1})", this.AngleX, this.AngleY); if (this.AngleY == 0)
{
return string.Format(CultureInfo.InvariantCulture, "skewX({0})", this.AngleX);
}
else
{
return string.Format(CultureInfo.InvariantCulture, "skewY({0})", this.AngleY);
}
} }
public SvgSkew(float x, float y) public SvgSkew(float x, float y)
......
...@@ -71,9 +71,14 @@ namespace SvgW3CTestRunner ...@@ -71,9 +71,14 @@ namespace SvgW3CTestRunner
{ {
using(var memStream = new MemoryStream()) using(var memStream = new MemoryStream())
{ {
doc.Write(memStream); doc.Write(memStream);
memStream.Position = 0;
var reader = new StreamReader(memStream);
System.IO.File.WriteAllText(@"C:\test.xml", reader.ReadToEnd());
memStream.Position = 0; memStream.Position = 0;
doc = SvgDocument.Open<SvgDocument>(memStream); var baseUri = doc.BaseUri;
doc = SvgDocument.Open<SvgDocument>(memStream);
doc.BaseUri = baseUri;
if (fileName.StartsWith("__")) if (fileName.StartsWith("__"))
{ {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment