@font-face not included in SVGs
See original GitHub issueI’m currently attempting to render out some SVG graphs to JPEG. It works fine after inlining all styles, as there were some “insecure operation” warnings when trying to read from CSS, but one thing I just cannot get working is using web fonts in SVG.
I’ve tried both importing the fonts using @import
from Google Fonts, and defining the font with @font-face
.
I tried putting fontFamily: 'Roboto'
in the style
object of options, as well as inlining style={{fontFamily: 'Roboto'}}
directly on a <text>
SVG element, neither worked.
Probably worth mentioning I’m using React for this. I’m kinda running out of ideas. Any help?
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
svg @font-face works in svg but not when included in a page
I tried to circumvent the problem by defining the font in a separate stylesheet, and include it like this: <?xml-stylesheet type="text/css" href ...
Read more >Using Fonts in SVG - Vecta.io
There are 3 different ways to use fonts in SVG - SVG fonts (deprecated), web-safe fonts, and web fonts, each with pros and...
Read more >SVG fonts - SVG: Scalable Vector Graphics - MDN Web Docs
Following <font-face-src> is a <missing-glyph> element. This defines what should be displayed if a certain glyph is not found in the font and...
Read more >Using Custom Fonts With SVG in an Image Tag | CSS-Tricks
The idea is to have many SVGs that all share a single CSS or a single font file ... Each image is self-contained,...
Read more >Embedded fonts in SVG files not loaded - Prince forum
This only happens when SVG image is included with the <img> tag. However, if the SVG code is embedded directly into HTML, the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Found a workaround for this, posting in case anyone else has the same issue.
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.