how do I define fontfamily in svg

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
demonkey
Posts: 2
Joined: 2013-11-25T01:30:16-07:00
Authentication code: 6789

how do I define fontfamily in svg

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how do I define fontfamily in svg

Post 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?
demonkey
Posts: 2
Joined: 2013-11-25T01:30:16-07:00
Authentication code: 6789

Re: how do I define fontfamily in svg

Post 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? :)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how do I define fontfamily in svg

Post 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.
Post Reply