You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If one creates SvgText element at runtime it's OwnerDocument property will be Null. Afterwards trying to access Bounds property will throw "Object reference not set to an instance of an object.", because ValidateFontFamily expects "SvgDocument doc" not to be null.
var svgText = new SvgText("Hello World!"); // This line will throw "Object reference not set to an instance of an object." exception. var textWidth = svgText.Bounds.Width;
So we need to modify ValidateFontFamily method (line 436 of SvgElementStyle.cs) to check for doc not being null:
if (doc != null && doc.FontDefns().TryGetValue(f, out sFaces)) return sFaces;
I created a Pull Request #333 to resolve this issue.
Thanks
The text was updated successfully, but these errors were encountered:
Hi,
If one creates SvgText element at runtime it's OwnerDocument property will be Null. Afterwards trying to access Bounds property will throw "Object reference not set to an instance of an object.", because ValidateFontFamily expects "SvgDocument doc" not to be null.
var svgText = new SvgText("Hello World!");
// This line will throw "Object reference not set to an instance of an object." exception.
var textWidth = svgText.Bounds.Width;
So we need to modify ValidateFontFamily method (line 436 of SvgElementStyle.cs) to check for doc not being null:
if (doc != null && doc.FontDefns().TryGetValue(f, out sFaces)) return sFaces;
I created a Pull Request #333 to resolve this issue.
Thanks
The text was updated successfully, but these errors were encountered: