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

Error when svg file contains references to font with space in its name #374

Open
nyq opened this issue Mar 22, 2023 · 1 comment
Open

Error when svg file contains references to font with space in its name #374

nyq opened this issue Mar 22, 2023 · 1 comment

Comments

@nyq
Copy link

nyq commented Mar 22, 2023

When input SVG file refers to a font with a space in its name (e.g. "Cascadia Code"), calling svg2rlg results in Unable to find a suitable font for 'font-family:Cascadia Code', weight:normal, style:normal warning messages and the default font is used instead.

Specifically, what happens is that when the font name has a space in its name, convertFontFamily method of Svg2RlgAttributeConverter class located in svglib.py splits the input font name into multiple strings using space character as a delimiter (line 406), and then feeds these split strings into find_font method of FontMap class located in fonts.py, resulting in all calls to find_font failing (because it gets "Cascadia" and "Code" as separate inputs during two separate calls).

There are plenty of fonts with a space character in their name, even in standard Windows distribution, so using space character as a separator is not warranted and breaks the functionality.

@github-actions
Copy link

Thank you for raising your first issue! Your help to improve svglib is much appreciated!

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

No branches or pull requests

1 participant