Commit 1a00f391 authored by Eric Domke's avatar Eric Domke
Browse files

Bug fixes: Gradients and Filters

- Support of generic fonts (serif, sans-serif, monospace)
- Initial support of filters
- Fixes to gradient rendering
parent 2187be3e
......@@ -275,6 +275,7 @@ namespace Svg
where (n is SvgContentNode || n is SvgTextBase) && !string.IsNullOrEmpty(n.Content)
select n).ToList();
// Individual character spacing
if (nodes.FirstOrDefault() is SvgContentNode && _x.Count > 1)
{
string ch;
......@@ -298,7 +299,9 @@ namespace Svg
}
}
// Calculate the bounds of the text
ISvgNode node;
var accumulateDims = true;
for (var i = 0; i < nodes.Count; i++)
{
node = nodes[i];
......@@ -316,10 +319,15 @@ namespace Svg
{
stringBounds = innerText.GetTextBounds(renderer).Bounds;
result.Nodes.Add(new NodeBounds() { Bounds = stringBounds, Node = node, xOffset = totalWidth });
if (innerText.Dx.Count == 1) totalWidth += innerText.Dx[0].ToDeviceValue(renderer, UnitRenderingType.Horizontal, this);
accumulateDims = accumulateDims && SvgUnitCollection.IsNullOrEmpty(innerText.X) && SvgUnitCollection.IsNullOrEmpty(innerText.Y);
if (accumulateDims && innerText.Dx.Count == 1) totalWidth += innerText.Dx[0].ToDeviceValue(renderer, UnitRenderingType.Horizontal, this);
}
if (accumulateDims)
{
totalHeight = Math.Max(totalHeight, stringBounds.Height);
totalWidth += stringBounds.Width;
}
totalHeight = Math.Max(totalHeight, stringBounds.Height);
totalWidth += stringBounds.Width;
}
}
result.Bounds = new SizeF(totalWidth, totalHeight);
......
......@@ -32,9 +32,16 @@ namespace SvgW3CTestRunner
try
{
var doc = SvgDocument.Open(_svgBasePath + fileName);
var img = new Bitmap(480, 360);
doc.Draw(img);
picSvg.Image = img;
if (fileName.StartsWith("__"))
{
picSvg.Image = doc.Draw();
}
else
{
var img = new Bitmap(480, 360);
doc.Draw(img);
picSvg.Image = img;
}
}
catch (Exception ex)
{
......
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