svg2pdf icon indicating copy to clipboard operation
svg2pdf copied to clipboard

Font: should not fallback for the whole text

Open bczhc opened this issue 1 month ago • 1 comments

There's a very simplified svg:

<svg xmlns="http://www.w3.org/2000/svg" width="100mm" height="30mm" viewBox="0 0 100 30">
<text x="28.026342" y="12.053369" font-family="DejaVu Serif" font-size="4.23333">Deja Vu Serif/中文</text>
</svg>

Now on my system there's DejaVu Serif installed, and you can see obviously this font won't contain Chinese characters. So here, when I run svg2pdf it will report Warning (in usvg::text:183): Fallback from DejaVu Serif to FZKai-Z03., Later, open the produced PDF, a font fallback on this whole line was observed:

Image

Expected result (English keeps DejaVu Serif and Chinese fallbacks to Noto CJK:

Image

rsvg-convert and inkscape, or directly opening the svg with browsers, do this well, so I suppose this is an svg2pdf bug.

Version: svg2pdf-cli 0.13.0

I noticed #65, just not seeing the same issue got filed. Feel free to close this in favor of that.

--

p.s. From my experience with this project, I found svg2pdf works much much better with clipping/masking than inkscape and rsvg-convert!!

bczhc avatar Nov 10 '25 02:11 bczhc