-
Notifications
You must be signed in to change notification settings - Fork 80
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
Embedding SVG fonts in PDF/rlg #388
Comments
Thank you for raising your first issue! Your help to improve svglib is much appreciated! |
Also, if this is a limitation with |
I'm not sure fonts embedded in CSS are really supported in svglib. The README says: "CSS is supported, but the range of supported attributes is still limited." @claudep is the expert here. Typically you need to register fonts with reportlab, if you want to use them, see their docs and/or the test suite. |
I can confirm that embedded font definitions is not supported by svglib. svglib is extracting the font family names in svg files, then try to register them with Reportlab (some of that code is in https://github.com/deeplook/svglib/blob/master/svglib/fonts.py). So the path to the font file should be available on the current system. I don't see a ~simple way to workaround this for embedded fonts. |
If lilypond is an option for you, you can generate SVG output for it and throw it at svglib. It works with some minor glitch that could be worked around or fixed. I've even worked on it, but it will take me some while to find it again. Here is a (boring) example SVG and snapshot of the PDF: ![]() |
Hi, I am using
svglib
in order to embed a PDF (usingrebortlab
).The code looks like this:
I have a svg with an embedded font:
When it converts to a drawing object, I get messages like so:
(as described in #284)
I know that it is possible to suppress these warnings, but that is not so helpful since the resulting PDF does not look right at all. In this case, a specialized font is needed, and it does not work otherwise.
This is what it is supposed to look like:
![Correctly rendered](https://private-user-images.githubusercontent.com/6473114/274723226-8afdc9c3-9b1e-497b-896c-99d5e7040fa8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYxMDc1MDEsIm5iZiI6MTcyNjEwNzIwMSwicGF0aCI6Ii82NDczMTE0LzI3NDcyMzIyNi04YWZkYzljMy05YjFlLTQ5N2ItODk2Yy05OWQ1ZTcwNDBmYTgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkxMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MTJUMDIxMzIxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YzM5ODlmZTFlNjc5ODQzMTdjNTY2MmExODE2NTQwNjQzMjhiZDQ2MDI0YmI0NDcyYjg4ZDc4NTMzMzM2OTU1MSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.YUdNno08dVq0jKiwvxsJtMGL5ITgM4BFPSNjt03c1ec)
One font is used for the title, and a different, specialized font is used for "engraving" the notation.
Is there any way to embed the font data into the
rlg
object/PDF? If there is a way to render the text to a path, that would also be helpful as an alternative route to explore.Please advise,
Thanks!
The text was updated successfully, but these errors were encountered: