Commit da02167c authored by Tobias Oort's avatar Tobias Oort
Browse files

Added support for dx and dy properties for text. A bit of plumbing was already...

Added support for dx and dy properties for text. A bit of plumbing was already in place so I completed that.
http://www.w3.org/TR/SVG11/text.html#TextElementDXAttribute
http://www.w3.org/TR/SVG11/text.html#TextElementDYAttribute
parent fe32d9ae
...@@ -19,6 +19,8 @@ namespace Svg ...@@ -19,6 +19,8 @@ namespace Svg
{ {
private SvgUnit _x; private SvgUnit _x;
private SvgUnit _y; private SvgUnit _y;
private SvgUnit _dy;
private SvgUnit _dx;
private SvgUnit _letterSpacing; private SvgUnit _letterSpacing;
private SvgUnit _wordSpacing; private SvgUnit _wordSpacing;
private SvgUnit _fontSize; private SvgUnit _fontSize;
...@@ -47,6 +49,8 @@ namespace Svg ...@@ -47,6 +49,8 @@ namespace Svg
{ {
this._fontFamily = DefaultFontFamily; this._fontFamily = DefaultFontFamily;
this._fontSize = new SvgUnit(0.0f); this._fontSize = new SvgUnit(0.0f);
this._dy = new SvgUnit(0.0f);
this._dx = new SvgUnit(0.0f);
} }
/// <summary> /// <summary>
...@@ -97,6 +101,25 @@ namespace Svg ...@@ -97,6 +101,25 @@ namespace Svg
} }
} }
/// <summary>
/// Gets or sets the dX.
/// </summary>
/// <value>The dX.</value>
[SvgAttribute("dx")]
public virtual SvgUnit Dx
{
get { return this._dx; }
set
{
if (_dx != value)
{
this._dx = value;
this.IsPathDirty = true;
OnAttributeChanged(new AttributeEventArgs { Attribute = "dx", Value = value });
}
}
}
/// <summary> /// <summary>
/// Gets or sets the Y. /// Gets or sets the Y.
/// </summary> /// </summary>
...@@ -116,6 +139,25 @@ namespace Svg ...@@ -116,6 +139,25 @@ namespace Svg
} }
} }
/// <summary>
/// Gets or sets the dY.
/// </summary>
/// <value>The dY.</value>
[SvgAttribute("dy")]
public virtual SvgUnit Dy
{
get { return this._dy; }
set
{
if (_dy != value)
{
this._dy = value;
this.IsPathDirty = true;
OnAttributeChanged(new AttributeEventArgs { Attribute = "dy", Value = value });
}
}
}
/// <summary> /// <summary>
/// Specifies spacing behavior between text characters. /// Specifies spacing behavior between text characters.
/// </summary> /// </summary>
...@@ -290,7 +332,7 @@ namespace Svg ...@@ -290,7 +332,7 @@ namespace Svg
_path.StartFigure(); _path.StartFigure();
if (!string.IsNullOrEmpty(this.Text)) if (!string.IsNullOrEmpty(this.Text))
DrawString(_path, this.X, this.Y, SvgUnit.Empty, SvgUnit.Empty, font, fontSize, this.Text); DrawString(_path, this.X, this.Y, this.Dx, this.Dy, font, fontSize, this.Text);
foreach (var tspan in this.Children.Where(x => x is SvgTextSpan).Select(x => x as SvgTextSpan)) foreach (var tspan in this.Children.Where(x => x is SvgTextSpan).Select(x => x as SvgTextSpan))
{ {
......
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