Commit 32ea4ec2 authored by Eric Domke's avatar Eric Domke
Browse files

Bug Fixes Prior to Work on Better CSS Support

parent ce8f2a64
...@@ -138,7 +138,7 @@ namespace Svg ...@@ -138,7 +138,7 @@ namespace Svg
{ {
if (this.Fill != null) if (this.Fill != null)
{ {
using (Brush brush = this.Fill.GetBrush(this, this.FillOpacity)) using (Brush brush = this.Fill.GetBrush(this, Math.Min(Math.Max(this.FillOpacity * this.Opacity, 0), 1)))
{ {
if (brush != null) if (brush != null)
{ {
...@@ -158,7 +158,7 @@ namespace Svg ...@@ -158,7 +158,7 @@ namespace Svg
if (this.Stroke != null) if (this.Stroke != null)
{ {
float strokeWidth = this.StrokeWidth.ToDeviceValue(this); float strokeWidth = this.StrokeWidth.ToDeviceValue(this);
using (var pen = new Pen(this.Stroke.GetBrush(this, this.StrokeOpacity), strokeWidth)) using (var pen = new Pen(this.Stroke.GetBrush(this, Math.Min(Math.Max(this.StrokeOpacity * this.Opacity, 0), 1)), strokeWidth))
{ {
if (this.StrokeDashArray != null && this.StrokeDashArray.Count > 0) if (this.StrokeDashArray != null && this.StrokeDashArray.Count > 0)
{ {
......
...@@ -81,6 +81,7 @@ namespace Svg ...@@ -81,6 +81,7 @@ namespace Svg
} }
else else
{ {
deferred.EnsureServer();
return deferred._concreteServer as T; return deferred._concreteServer as T;
} }
} }
......
...@@ -12,6 +12,7 @@ namespace Svg ...@@ -12,6 +12,7 @@ namespace Svg
[TypeConverter(typeof(SvgTextAnchorConverter))] [TypeConverter(typeof(SvgTextAnchorConverter))]
public enum SvgTextAnchor public enum SvgTextAnchor
{ {
inherit,
/// <summary> /// <summary>
/// The rendered characters are aligned such that the start of the text string is at the initial current text position. /// The rendered characters are aligned such that the start of the text string is at the initial current text position.
/// </summary> /// </summary>
......
...@@ -25,7 +25,7 @@ namespace Svg ...@@ -25,7 +25,7 @@ namespace Svg
private SvgUnitCollection _dx = new SvgUnitCollection(); private SvgUnitCollection _dx = new SvgUnitCollection();
private SvgUnit _letterSpacing; private SvgUnit _letterSpacing;
private SvgUnit _wordSpacing; private SvgUnit _wordSpacing;
private SvgTextAnchor _textAnchor = SvgTextAnchor.Start; private SvgTextAnchor _textAnchor = SvgTextAnchor.inherit;
private static readonly SvgRenderer _stringMeasure; private static readonly SvgRenderer _stringMeasure;
private const string DefaultFontFamily = "Times New Roman"; private const string DefaultFontFamily = "Times New Roman";
...@@ -196,7 +196,15 @@ namespace Svg ...@@ -196,7 +196,15 @@ namespace Svg
/// <value>The bounds.</value> /// <value>The bounds.</value>
public override System.Drawing.RectangleF Bounds public override System.Drawing.RectangleF Bounds
{ {
get { return this.Path.GetBounds(); } get
{
var path = this.Path;
foreach (var elem in this.Children.OfType<SvgVisualElement>())
{
path.AddPath(elem.Path, false);
}
return path.GetBounds();
}
} }
private static string ValidateFontFamily(string fontFamilyList) private static string ValidateFontFamily(string fontFamilyList)
...@@ -361,8 +369,10 @@ namespace Svg ...@@ -361,8 +369,10 @@ namespace Svg
_path = new GraphicsPath(); _path = new GraphicsPath();
_path.StartFigure(); _path.StartFigure();
var anchorElem = (from e in this.ParentsAndSelf.OfType<SvgTextBase>() where e.TextAnchor != SvgTextAnchor.inherit select e).FirstOrDefault();
// Determine the location of the start point // Determine the location of the start point
switch (this.TextAnchor) switch (anchorElem == null ? this.TextAnchor : anchorElem.TextAnchor)
{ {
case SvgTextAnchor.Middle: case SvgTextAnchor.Middle:
x -= (boundsData.Bounds.Width / 2); x -= (boundsData.Bounds.Width / 2);
......
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