Created xaml file contains wrong font path. This code
throws an exception "A Dos path must be rooted, for example, 'c:\'", because separator char must be '/' or "\\".
source file SharpVectors.Converters.XmlXamlWriter ln 503:
string fontUri = temp.ToLower();
fontUri = fontUri.Replace(_windowsDir, _windowsPath);
my bugfix:
string fontUri = temp.ToLower();
fontUri = fontUri.Replace(_windowsDir, _windowsPath).Replace('\\', '/');
But I'm not sure that's good enough.
I'm used this svg sample for testing.
BTW, You can't create xaml from this file, because some stop-element.offset in SVG is not defined, and code in SharpVectorModel\Fills\SvgStopElements.cs
public ISvgAnimatedNumber Offset
{
get
{
string attr = GetAttribute("offset").Trim();
if (attr.EndsWith("%"))
{
attr = attr.TrimEnd(new char[1]{'%'});
}
else
{
double tmp = SvgNumber.ParseNumber(attr) * 100;
attr = tmp.ToString(SvgNumber.Format);
}
return new SvgAnimatedNumber(attr);
}
}
throws an exception on SvgNumber.ParseNumber(attr), because attr is empty.
In code
public static double ParseNumber(string str)
{
try
{
return Double.Parse(str, SvgNumber.Format);
}
catch (Exception e)
{
throw new DomException(DomExceptionType.SyntaxErr,
"Input string was not in a correct format: " + str, e);
}
}
I change
return Double.Parse(str, SvgNumber.Format);
to
return string.IsNullOrEmpty(str) ? 0 : Double.Parse(str, SvgNumber.Format);
because I think if attribute is not defined, that's means that value equals 0 by default.
#### This work item was migrated from CodePlex
CodePlex work item ID: '1902'
Vote count: '2'
Hi,
Created xaml file contains wrong font path. This code