Why your SVG text changes font when converted to PNG
Updated
The SVG looks right in the browser, but the PNG, JPG or WEBP comes out in Times or Arial. Nothing is wrong with the file: the renderer that made the image couldn't find the font the text asks for, so it used a fallback. Here is why it happens and the three reliable fixes.
Why the font disappears
An SVG names its font, it doesn't contain it: <text font-family="Inter, Arial, sans-serif"> means "use Inter if you have it". In a web page the browser finds Inter through the page's stylesheets. A converter has no such page:
- Browser-based converters draw the SVG as an image, and an SVG image is sealed off from the page: it can't use the page's fonts, and it doesn't fetch fonts from the web.
- Server tools (ImageMagick, librsvg, Inkscape on a server) can only use fonts installed on that machine.
- So the first family in the stack is skipped and the next one available — often a system serif — draws the text, with different widths, so lines can overflow or shift.
Bold text has its own trap: if only the regular weight is available, the renderer fakes bold by smearing the regular glyphs, which looks heavier and blurrier than the real bold.
1. Embed the font when you convert
The cleanest fix keeps your text as text: give the converter the font file, and it puts the font inside the SVG as a data URI right before drawing. The SVG Splice converter does this for you:
- Drop your SVGs, then open Fonts: it lists every font the files use and whether it is embedded.
- Upload the font files — a whole folder works, including the static and variable files Google Fonts downloads unzip to. The family, weight and italic are read from each font file, so file names don't matter.
- Or click Google Fonts next to a missing family to fetch exactly the weights your SVG uses.
- Only the faces the text uses are embedded, so a 50-file font folder doesn't bloat the conversion.
2. Embed the font in the SVG itself
To make the file render correctly everywhere, put an @font-face with the font as a base64 data URI in the SVG's <style>. It travels with the file, at the cost of a larger file (subset the font to the characters you use to keep it small):
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 80">
<style>
@font-face {
font-family: "Inter";
src: url(data:font/woff2;base64,d09GMgABAAAA...) format("woff2");
font-weight: 100 900;
}
</style>
<text x="20" y="50" font-family="Inter" font-weight="700">Hello</text>
</svg>A url() that points at a web address instead of a data URI won't load when the SVG is used as an image, so it doesn't solve the problem.
3. Convert the text to outlines
Design tools can turn text into paths ("Create outlines" in Illustrator, "Outline stroke" / "Flatten" in Figma, "Object to Path" in Inkscape). The result renders identically anywhere, but the text is no longer editable, selectable or readable by screen readers and search engines — keep an editable copy.
Which fix to use
- Converting to PNG, JPG or WEBP once: embed the font at conversion time.
- Shipping the SVG for others to use: embed a subset font in the SVG.
- Logos and artwork that never change: outline the text.