SVG to png font madness

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
doyley3
Posts: 23
Joined: 2014-02-11T09:52:48-07:00
Authentication code: 6789

SVG to png font madness

Post by doyley3 »

I have custom fonts installed on my shared server that are present in convert -list font.
Font: AmaticSC
family: Amatic SC
style: Undefined
stretch: Undefined
weight: 0
glyphs: /home/under/www/devel/jb_fonts/AmaticSC-Regular.ttf

I have a functioning type.xml in $HOME/.magick (thank you Anthony for the script) that is present first in the list on convert -list font | grep Path:
My delegates are: DELEGATES bzlib djvu fontconfig freetype gvc jpeg jng jp2 lcms lqr openexr png rsvg tiff x11 xml wmf zlib

If I run convert -font AmaticSC -pointsize 72 label:Rhiannon test.png I get correct custom font in test.png

If I create an svg using that font - the output from Illustrator is this:
<text transform="matrix(1 0 0 1 42.2021 279.9727)" fill="#2B2A2B" font-family="'AmaticSC-Regular'" font-size="24">Rhiannon</text>

So when I run convert /home/under/www/testsite/test.svg test.png - I just get a default Arial font in the png. No errors.

I've tried changing the svg code to font-family="AmaticSC" (and removing single quotes) - but I cannot get the font in the final png.

I will donate a kidney to anyone who can help.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: SVG to png font madness

Post by snibgo »

family: Amatic SC
The family name seems to contain a space.

You have tried font-family= with the partial filename and with the font name (without a space). Have you tried

Code: Select all

font-family="Amatic SC"
One double-quote at each end.

Also check that you don't also have a "style=" in the text tag, which might override the "font-family=".
snibgo's IM pages: im.snibgo.com
Post Reply