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
{
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)
{
......@@ -158,7 +158,7 @@ namespace Svg
if (this.Stroke != null)
{
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)
{
......
......@@ -81,6 +81,7 @@ namespace Svg
}
else
{
deferred.EnsureServer();
return deferred._concreteServer as T;
}
}
......
......@@ -12,6 +12,7 @@ namespace Svg
[TypeConverter(typeof(SvgTextAnchorConverter))]
public enum SvgTextAnchor
{
inherit,
/// <summary>
/// The rendered characters are aligned such that the start of the text string is at the initial current text position.
/// </summary>
......
......@@ -25,7 +25,7 @@ namespace Svg
private SvgUnitCollection _dx = new SvgUnitCollection();
private SvgUnit _letterSpacing;
private SvgUnit _wordSpacing;
private SvgTextAnchor _textAnchor = SvgTextAnchor.Start;
private SvgTextAnchor _textAnchor = SvgTextAnchor.inherit;
private static readonly SvgRenderer _stringMeasure;
private const string DefaultFontFamily = "Times New Roman";
......@@ -196,7 +196,15 @@ namespace Svg
/// <value>The bounds.</value>
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)
......@@ -361,8 +369,10 @@ namespace Svg
_path = new GraphicsPath();
_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
switch (this.TextAnchor)
switch (anchorElem == null ? this.TextAnchor : anchorElem.TextAnchor)
{
case SvgTextAnchor.Middle:
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