Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception: "Font '?' cannot be found" #548

Closed
gvheertum opened this issue Aug 10, 2019 · 2 comments · Fixed by #550
Closed

Exception: "Font '?' cannot be found" #548

gvheertum opened this issue Aug 10, 2019 · 2 comments · Fixed by #550

Comments

@gvheertum
Copy link
Member

gvheertum commented Aug 10, 2019

Description

When using font-familty in a SVG document, MacOs might fail with an exception "Font '?' cannot be found' when calling the Draw function. This seems to happen when text are getting rendered, svg files without text do not cause issues.

The GDI+ library is loaded correctly (the GDI+ compat check states that it can be loaded and the Exception seems to come from within the GDI+ libraries.

Exception has occurred: CLR/System.ArgumentException
Exception thrown: 'System.ArgumentException' in System.Drawing.Common.dll: 'Font '?' cannot be found.'
at System.Drawing.FontFamily.GetGdipGenericSansSerif()
at System.Drawing.FontFamily.get_GenericSansSerif()
at Svg.SvgElement.ValidateFontFamily(String fontFamilyList, SvgDocument doc) in /Users/gertjan/Development/SVG/Source/SvgElementStyle.cs:line 461

The exception seems not to be really caused by the font that cannot be found, but the error seems to be thrown from SvgElement.ValidateFontFamily, the throwing code is:
return System.Drawing.FontFamily.GenericSansSerif;, so I assume there might be a problem with the Generic font enumeration in the GDI+ library.

Not sure if the problem is really in the SVG lib, but for documentation purposes this ticket might be relevant.

Example data

Problem occurs in every SVG that has a font described in the document. This includes SVG files in the UnitTest project (like Resources\Issue_Threading\TestFile.svg).

This issue might also occur on Linux systems.

Used Versions

Used the master branch from this repository in the state of August 10th 2019. Running on MacOs Mojave 10.14.6 on .Net Core 2.2 and using the suggested gdi+ replacement package for Mac.

Exception encountered while running unit tests from the unit test project.

@gvheertum
Copy link
Member Author

Logged this for reference purposes. Since I am primarily working on MacOs (and I believe I am a minority under the developers here), I'll look into this. Ofcourse, I won't refuse any assistance from Mac/Linux users involved/interested.

This might explain why I had quite a large set of tests failing in the past on Mac. I thought it was due to some rendering issues (because the equality checks did sometimes fail) or some other issues, but possibly the font issue might been here for quite some time.

@gvheertum
Copy link
Member Author

Found that the used core compat package on Mac was not the most recent version, updating to 5.8.64 from 5.6.20 solved this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant