Page 1 of 1

how do I define fontfamily in svg

Posted: 2013-11-25T01:46:22-07:00
by demonkey
Dear.

I'm trying to Svg file to Png usign command line like "convert new.svg a.png".
All thing is working fine except font part.

I did
1.add type.xml my hosting locate with perl gen file, and then add custom font file.
/home/hosting_users/ME/.magic/type.xml
<type
format="ttf"
name="MyFont"
fullname="MyFont"
family="MyFont"
glyphs="/font/MyFontx.ttf"
/>

after that
convert -font MyFont -pointsize 90 testtext a.png <--- that's working very fine.

following is failed
=================new.svg file
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010 ... /svg10.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="600" height="600">
<text x="161px" y="84px" font-family="MyFont">asdf</text>
</svg>

convert new.svg a.png <--------------------a.png showing with default font. not MyFont :(

Please Let me know how custom font define in svg or other way.

Re: how do I define fontfamily in svg

Posted: 2013-11-25T12:58:20-07:00
by fmw42
This is more an SVG issue than one for Imagemagick. I suggest you look that up in the SVG docs or enquire on an SVG forum. Nevertheless, see http://www.w3.org/TR/SVG/fonts.html

What SVG renderer is being use by IM on your system.

check

convert -list format

and see what it says for SVG

is it XML, RSVG, or Inkscape?

Re: how do I define fontfamily in svg

Posted: 2013-11-25T20:21:08-07:00
by demonkey
Thanks for your reply :)

I've checked "format" of SVG on my hosting server.
SVG* SVG rw+ Scalable Vector Graphics (XML 2.6.26)
SVGZ* SVG rw+ Compressed Scalable Vector Graphics (XML 2.6.26)

Is this XML, right? :)

Re: how do I define fontfamily in svg

Posted: 2013-11-25T23:03:17-07:00
by fmw42
That means you are using the internal IM MSVG, which is the least accurate. The most accurate is inkscape. If you install inkscape or perhaps at least RSVG then you might get better results.