Commit 7894ea9e authored by HeinrichAD's avatar HeinrichAD
Browse files

Add: shape-rendering; Fix: CurrentCulture

Fix:
Now the application make sure to set back the old culture even an error
occurred.
SvgColourConverter.ConvertFrom
SvgPathBuilder.ConvertTo
SvgDocument.Write
SvgExtentions.GetXML

Add:
Attribute: "shape-rendering"

Change:
- Many other properties were unknowingly overloaded. I changed them to
override.
- Some methods or structures need the [CLSCompliant(false)] Attribute.
For example the Enums.TryParse extension. This extension has the where
condition IConvertible. IConvertible is [CLSCompliant(false)] and that
the reason why it is correct to mark the Enums.TryParse extension also
as [CLSCompliant(false)].
- Property "float Opacity" in SvgElement was unknowingly overloaded in
SvgGradientStop as string [stop-opacity]. In the end this property was
only used as float. I changed the SvgGradientStop.Opacity property from
string to float and to override.
parent a1ff72df
......@@ -49,6 +49,8 @@ namespace Svg
var result = "";
var currentCulture = Thread.CurrentThread.CurrentCulture;
try
{
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
using (StringWriter str = new StringWriter())
{
......@@ -59,7 +61,12 @@ namespace Svg
}
}
}
finally
{
// Make sure to set back the old culture even an error occurred.
Thread.CurrentThread.CurrentCulture = currentCulture;
}
return result;
}
......@@ -73,7 +80,7 @@ namespace Svg
{
action(elem);
if(!(elem is SvgDocument)) //don't apply action to subtree of documents
if (!(elem is SvgDocument)) //don't apply action to subtree of documents
{
foreach (var element in elem.Children)
{
......@@ -84,7 +91,7 @@ namespace Svg
public static void ApplyRecursiveDepthFirst(this SvgElement elem, Action<SvgElement> action)
{
if(!(elem is SvgDocument)) //don't apply action to subtree of documents
if (!(elem is SvgDocument)) //don't apply action to subtree of documents
{
foreach (var element in elem.Children)
{
......
......@@ -133,6 +133,7 @@ namespace Svg.Text
}
}
[CLSCompliant(false)]
public struct TT_OFFSET_TABLE
{
public ushort uMajorVersion;
......@@ -143,6 +144,7 @@ namespace Svg.Text
public ushort uRangeShift;
}
[CLSCompliant(false)]
public struct TT_TABLE_DIRECTORY
{
public byte[] szTag;
......@@ -155,6 +157,7 @@ namespace Svg.Text
}
}
[CLSCompliant(false)]
public struct TT_NAME_TABLE_HEADER
{
public ushort uFSelector;
......@@ -162,6 +165,7 @@ namespace Svg.Text
public ushort uStorageOffset;
}
[CLSCompliant(false)]
public struct TT_NAME_RECORD
{
public ushort uPlatformID;
......
......@@ -62,7 +62,7 @@ namespace Svg
/// Indicates which font family is to be used to render the text.
/// </summary>
[SvgAttribute("font-family")]
public virtual string FontFamily
public override string FontFamily
{
get { return this.Attributes["font-family"] as string; }
set { this.Attributes["font-family"] = value; }
......@@ -72,7 +72,7 @@ namespace Svg
/// 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>
[SvgAttribute("font-size")]
public virtual SvgUnit FontSize
public override SvgUnit FontSize
{
get { return (this.Attributes["font-size"] == null) ? SvgUnit.Empty : (SvgUnit)this.Attributes["font-size"]; }
set { this.Attributes["font-size"] = value; }
......@@ -82,7 +82,7 @@ namespace Svg
/// Refers to the style of the font.
/// </summary>
[SvgAttribute("font-style")]
public virtual SvgFontStyle FontStyle
public override SvgFontStyle FontStyle
{
get { return (this.Attributes["font-style"] == null) ? SvgFontStyle.All : (SvgFontStyle)this.Attributes["font-style"]; }
set { this.Attributes["font-style"] = value; }
......@@ -92,7 +92,7 @@ namespace Svg
/// Refers to the varient of the font.
/// </summary>
[SvgAttribute("font-variant")]
public virtual SvgFontVariant FontVariant
public override SvgFontVariant FontVariant
{
get { return (this.Attributes["font-variant"] == null) ? SvgFontVariant.Inherit : (SvgFontVariant)this.Attributes["font-variant"]; }
set { this.Attributes["font-variant"] = value; }
......@@ -102,7 +102,7 @@ namespace Svg
/// Refers to the boldness of the font.
/// </summary>
[SvgAttribute("font-weight")]
public virtual SvgFontWeight FontWeight
public override SvgFontWeight FontWeight
{
get { return (this.Attributes["font-weight"] == null) ? SvgFontWeight.Inherit : (SvgFontWeight)this.Attributes["font-weight"]; }
set { this.Attributes["font-weight"] = value; }
......
......@@ -79,15 +79,6 @@ namespace Svg
return _path;
}
/// <summary>
/// Gets or sets a value to determine if anti-aliasing should occur when the element is being rendered.
/// </summary>
protected override bool RequiresSmoothRendering
{
get { return true; }
}
/// <summary>
/// Gets the bounds of the element.
/// </summary>
......
......@@ -13,10 +13,10 @@ namespace Svg
{
public abstract class SvgTextBase : SvgVisualElement
{
protected SvgUnitCollection _x = new SvgUnitCollection();
protected SvgUnitCollection _y = new SvgUnitCollection();
protected SvgUnitCollection _dy = new SvgUnitCollection();
protected SvgUnitCollection _dx = new SvgUnitCollection();
[CLSCompliant(false)] protected SvgUnitCollection _x = new SvgUnitCollection();
[CLSCompliant(false)] protected SvgUnitCollection _y = new SvgUnitCollection();
[CLSCompliant(false)] protected SvgUnitCollection _dy = new SvgUnitCollection();
[CLSCompliant(false)] protected SvgUnitCollection _dx = new SvgUnitCollection();
private string _rotate;
private List<float> _rotations = new List<float>();
......@@ -215,15 +215,6 @@ namespace Svg
return this.Text;
}
/// <summary>
/// Gets or sets a value to determine if anti-aliasing should occur when the element is being rendered.
/// </summary>
/// <value></value>
protected override bool RequiresSmoothRendering
{
get { return true; }
}
/// <summary>
/// Gets the bounds of the element.
/// </summary>
......
......@@ -34,7 +34,6 @@ namespace Svg.UnitTests
[TestMethod]
public void TestMultiThread()
{
bool valid = true;
Parallel.For(0, 10, (x) =>
{
LoadFile();
......
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