svg conversion and supported fonts

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
rs13
Posts: 65
Joined: 2009-01-15T12:57:26-07:00

svg conversion and supported fonts

Post by rs13 »

Hello,

I am converting svg image that has different text using different fonts using this command to png (other transformations are printer requirements so they have to be there):

"convert": "-background transparent -size 600x600 svg:- -units PixelsPerInch -density 300 -alpha off -fill #FFFFFE -opaque #FFFFFF -alpha on -bordercolor #FFFFFF -border 15 png:-"

The problem that I am having is that the converted png images end up in a different font. I am assuming this is because the font is not "supported" so the conversion substitutes the font. Questions that I have:

1. What fonts are supported when converting from svg to png?
2. I am seeing that if I let's say use just use 'Fantasy' font by itself, it converts properly. If I used two fonts in the svg image such as 'Fantasy' and 'Times Roman', everything gets converted to 'Times Roman'. What is the reason for that?
3. Does the conversion delegate my system is using matter in all of this?
I am currently on CentOS release 6.4 (Final)
and my delegate is

$ convert -list configure | grep DELEGATES
DELEGATES bzlib djvu mpeg fontconfig freetype jng jpeg lcms openexr pango png ps tiff x xml zlib

4. If the delegate matters, how do I change my system to use MSVG, RSVG or Inkscape? I could not find instructions anywhere how to do it for CentOS when I already have ImageMagick 6.8.7-1 2013-10-20 Q16 installed.

Thank you for all you help in advance.

Rob
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: svg conversion and supported fonts

Post by fmw42 »

4. If the delegate matters, how do I change my system to use MSVG, RSVG or Inkscape? I could not find instructions anywhere how to do it for CentOS when I already have ImageMagick 6.8.7-1 2013-10-20 Q16 installed.
I am not positive of this, but I believe that if IM finds Inkscape it will use it, if not, if it finds RSVG it will use that, otherwise it uses its own internal MSVG.

If run

convert -list format

the line with SVG should tell you which it is using. For example on my system


SVG SVG rw+ Scalable Vector Graphics (RSVG 2.36.4)
rs13
Posts: 65
Joined: 2009-01-15T12:57:26-07:00

Re: svg conversion and supported fonts

Post by rs13 »

Here is what I get:

[tango@centos ~]$ convert -list format | grep SVG
MSVG rw+ ImageMagick's own SVG internal renderer
SVG rw+ Scalable Vector Graphics (XML 2.7.6)
SVGZ rw+ Compressed Scalable Vector Graphics (XML 2.7.6)

It looks like it is using XML -- does that make sense. I am still clueless about the difference between each delegate and which one will help me most with my fonts issue.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: svg conversion and supported fonts

Post by fmw42 »

I believe that XML means the internal IM MSVG. You may get better results using RSVG or Inkscape. I hear that Inkscape is the best of the two. You need to install either and then recompile IM
rs13
Posts: 65
Joined: 2009-01-15T12:57:26-07:00

Re: svg conversion and supported fonts

Post by rs13 »

Thanks for the advice but where can I find the inkspace, how do I install and how do I recompile imageMagick. I did not install it from source but rather using yum pointing to latest CentOS packages.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: svg conversion and supported fonts

Post by fmw42 »

I am on a Mac. I do not know about Linux. See http://www.imagemagick.org/script/insta ... e.php#unix and http://www.imagemagick.org/script/advan ... lation.php. You can use Google to find Inkscape.
rs13
Posts: 65
Joined: 2009-01-15T12:57:26-07:00

Re: svg conversion and supported fonts

Post by rs13 »

Thank you for these links but isn't there an easier way such as adding the fonts at the system level to make them available to imageMagick as outlined here: http://www.webhostingtalk.com/showthread.php?t=589071

and here

http://stackoverflow.com/questions/2650 ... ize-a-font

I can't really rip up current ImageMagick from the production server just to change to a different delegate especially not knowing what fonts issue will it help me to solve, if any.

Thoughts?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: svg conversion and supported fonts

Post by snibgo »

"convert -list font" should show the available fonts. However, I suspect that lookups for SVG fonts don't go through exactly the same process as for annotate etc.

And it will depend on whether you use RSVG, etc. I don't know how Inkscape finds fonts.
rs13 wrote:If I used two fonts in the svg image such as 'Fantasy' and 'Times Roman', everything gets converted to 'Times Roman'. What is the reason for that?
I don't know. I suggest you show us the SVG. If it is small, paste it here between [ code ] and [ /code ] . If it is large, put it somewhere like dropbox.com and paste the URL here.
snibgo's IM pages: im.snibgo.com
rs13
Posts: 65
Joined: 2009-01-15T12:57:26-07:00

Re: svg conversion and supported fonts

Post by rs13 »

Here is the sample svg file that I am converting, basically having 9 text strings, each one using of the browser "safe" fonts:

Code: Select all

<svg id="abc" xmlns="https://www.w3.org/2000/svg" version="1.2" xmlns:xlink="https://www.w3.org/1999/xlink" ng-style="{width:(s.dim.w*zoom)+'px',height:(s.dim.h*zoom)+'px'}" ng-controller="surface" style="width: 2325px; height: 1047.7467811158797px;">↵	<g transform="translate(1162.5,523.8733905579398)">↵		<defs>↵			<clipPath id="id0.29726331401616335">↵					<path sa="d=m -233,-105 466,0 0,208 -466,0 z" transform="scale(4.989270386266094,4.989270386266094)" d="m -233,-105 466,0 0,208 -466,0 z"></path>↵			</clipPath>↵		    <linearGradient id="vertical" x1="0%" y1="0%" x2="0%" y2="100%">↵		      <stop offset="0%" style="stop-color:;stop-opacity:1"></stop>↵		      <stop offset="100%" style="stop-color:;stop-opacity:1"></stop>↵		    </linearGradient>↵		    <linearGradient id="horizontal" x1="0%" y1="0%" x2="100%" y2="0%">↵		      <stop offset="0%" style="stop-color:;stop-opacity:1"></stop>↵		      <stop offset="100%" style="stop-color:;stop-opacity:1"></stop>↵		    </linearGradient>↵			<radialGradient id="radial" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">↵	      		<stop offset="0%" style="stop-color:;stop-opacity:1"></stop>↵	      		<stop offset="100%" style="stop-color:;stop-opacity:1"></stop>↵	    	</radialGradient>	    ↵		</defs>↵		<g ng-switch="s.$design.background.color.style=='gradient'&&s.$design.background.value=='Colors'&&s.$design.background.color.type&&s.$design.background.color.from&&s.$design.background.color.to">↵			<!-- ngSwitchWhen: true -->↵		</g>↵		<g ng-switch="s.$design.background.color.style=='solid'&&s.$design.background.value=='Colors'&&s.$design.background.color.color">↵			<!-- ngSwitchWhen: true -->↵		</g>↵		<g clip-path="url(#id0.29726331401616335)">↵			<g ng-switch="" on="s.$design.background.value">↵				<!-- ngSwitchWhen: Theme --><image ng-switch-when="Theme" xlink:href="" sa="x=0;y=0;width=0;height=0;xlink:href=" x="0" y="0" width="0" height="0"></image>↵				<!-- ngSwitchWhen: Texture -->↵			</g>↵			<!-- ngRepeat: a in s.$design.layers track by $id($index) --><g ng-repeat="a in s.$design.layers track by $id($index)" ng-switch="a.type">↵				<!-- ngSwitchWhen: picture -->↵				<!-- ngSwitchWhen: text --><text ng-switch-when="text" ng-mouseover="select($index,false)" ng-click="select($index,true);changeOrder($event,true)" sa="id=text0;x=-1111.962615132372;y=-497.8198690746009;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844" style="font-weight:default;font-style:normal;text-decoration:default;font-family:helvetica;" id="text0" x="-1111.962615132372" y="-497.8198690746009" dy="118.04613733905579px" fill="#000000" font-size="129.72103004291844">Double-click to edit</text>↵			</g><g ng-repeat="a in s.$design.layers track by $id($index)" ng-switch="a.type">↵				<!-- ngSwitchWhen: picture -->↵				<!-- ngSwitchWhen: text --><text ng-switch-when="text" ng-mouseover="select($index,false)" ng-click="select($index,true);changeOrder($event,true)" sa="id=text1;x=-1108.8513285431836;y=-365.9545739499446;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844" style="font-weight:default;font-style:normal;text-decoration:default;font-family:arial black;" id="text1" x="-1108.8513285431836" y="-365.9545739499446" dy="118.04613733905579px" fill="#000000" font-size="129.72103004291844">Double-click to edit</text>↵			</g><g ng-repeat="a in s.$design.layers track by $id($index)" ng-switch="a.type">↵				<!-- ngSwitchWhen: picture -->↵				<!-- ngSwitchWhen: text --><text ng-switch-when="text" ng-mouseover="select($index,false)" ng-click="select($index,true);changeOrder($event,true)" sa="id=text2;x=-1123.4267251772194;y=-212.91290929256886;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844" style="font-weight:default;font-style:normal;text-decoration:default;font-family:comic sans ms;" id="text2" x="-1123.4267251772194" y="-212.91290929256886" dy="118.04613733905579px" fill="#000000" font-size="129.72103004291844">Double-click to edit</text>↵			</g><g ng-repeat="a in s.$design.layers track by $id($index)" ng-switch="a.type">↵				<!-- ngSwitchWhen: picture -->↵				<!-- ngSwitchWhen: text --><text ng-switch-when="text" ng-mouseover="select($index,false)" ng-click="select($index,true);changeOrder($event,true)" sa="id=text3;x=-1116.1390268602015;y=-89.0220379032647;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844" style="font-weight:default;font-style:normal;text-decoration:default;font-family:courier new;" id="text3" x="-1116.1390268602015" y="-89.0220379032647" dy="118.04613733905579px" fill="#000000" font-size="129.72103004291844">Double-click to edit</text>↵			</g><g ng-repeat="a in s.$design.layers track by $id($index)" ng-switch="a.type">↵				<!-- ngSwitchWhen: picture -->↵				<!-- ngSwitchWhen: text --><text ng-switch-when="text" ng-mouseover="select($index,false)" ng-click="select($index,true);changeOrder($event,true)" sa="id=text4;x=-1116.1390268602015;y=49.44423012007521;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844" style="font-weight:default;font-style:normal;text-decoration:default;font-family:georgia;" id="text4" x="-1116.1390268602015" y="49.44423012007521" dy="118.04613733905579px" fill="#000000" font-size="129.72103004291844">Double-click to edit</text>↵			</g><g ng-repeat="a in s.$design.layers track by $id($index)" ng-switch="a.type">↵				<!-- ngSwitchWhen: picture -->↵				<!-- ngSwitchWhen: text --><text ng-switch-when="text" ng-mouseover="select($index,false)" ng-click="select($index,true);changeOrder($event,true)" sa="id=text5;x=-1116.1390268602015;y=187.91049814341514;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844" style="font-weight:default;font-style:normal;text-decoration:default;font-family:impact;" id="text5" x="-1116.1390268602015" y="187.91049814341514" dy="118.04613733905579px" fill="#000000" font-size="129.72103004291844">Double-click to edit</text>↵			</g><g ng-repeat="a in s.$design.layers track by $id($index)" ng-switch="a.type">↵				<!-- ngSwitchWhen: picture -->↵				<!-- ngSwitchWhen: text --><text ng-switch-when="text" ng-mouseover="select($index,false)" ng-click="select($index,true);changeOrder($event,true)" sa="id=text6;x=-1116.1390268602015;y=333.6644644837729;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844" style="font-weight:default;font-style:normal;text-decoration:default;font-family:times;" id="text6" x="-1116.1390268602015" y="333.6644644837729" dy="118.04613733905579px" fill="#000000" font-size="129.72103004291844">Double-click to edit</text>↵			</g><g ng-repeat="a in s.$design.layers track by $id($index)" ng-switch="a.type">↵				<!-- ngSwitchWhen: picture -->↵				<!-- ngSwitchWhen: text --><text ng-switch-when="text" ng-mouseover="select($index,false)" ng-click="select($index,true);changeOrder($event,true)" sa="id=text7;x=-30.271977624535833;y=340.9521628007908;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844" style="font-weight:default;font-style:normal;text-decoration:default;font-family:trebuchet ms;" id="text7" x="-30.271977624535833" y="340.9521628007908" dy="118.04613733905579px" fill="#000000" font-size="129.72103004291844">Double-click to edit</text>↵			</g><g ng-repeat="a in s.$design.layers track by $id($index)" ng-switch="a.type">↵				<!-- ngSwitchWhen: picture -->↵				<!-- ngSwitchWhen: text --><text ng-switch-when="text" ng-mouseover="select($index,false)" ng-click="select($index,true);changeOrder($event,true)" sa="id=text8;x=-15.6965809905001;y=187.91049814341514;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844" style="font-weight:default;font-style:normal;text-decoration:default;font-family:sans-serif;" id="text8" x="-15.6965809905001" y="187.91049814341514" dy="118.04613733905579px" fill="#000000" font-size="129.72103004291844">Double-click to edit</text>↵			</g><g ng-repeat="a in s.$design.layers track by $id($index)" ng-switch="a.type">↵				<!-- ngSwitchWhen: picture -->↵				<!-- ngSwitchWhen: text --><text ng-switch-when="text" ng-mouseover="select($index,false)" ng-click="select($index,true);changeOrder($event,true)" sa="id=text9;x=28.029608911607237;y=-489.8454453392486;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844" style="font-weight:default;font-style:normal;text-decoration:default;font-family:palatino;" id="text9" x="28.029608911607237" y="-489.8454453392486" dy="118.04613733905579px" fill="#000000" font-size="129.72103004291844">Double-click to edit</text>↵			</g>↵		</g>↵	</g>↵</svg>
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: svg conversion and supported fonts

Post by snibgo »

It seems to work for me, IM v6.8.8-7 using RSVG on Windows 8.1.

Code: Select all

convert sample.svg sampleText.png
I get 3 warnings:

Code: Select all

** (convert.exe:5924): WARNING **: couldn't load font "helvetica Not-Rotated 103.7763671875", falling back to "Sans Not-Rotated 103.7763671875", expect ugly output.

** (convert.exe:5924): WARNING **: couldn't load font "times Not-Rotated 103.7763671875", falling back to "Sans Not-Rotated 103.7763671875", expect ugly output.


** (convert.exe:5924): WARNING **: couldn't load font "palatino Not-Rotated 103.7763671875", falling back to "Sans Not-Rotated 103.7763671875", expect ugly output.

If I change the three problem entries to:

Code: Select all

font-family:Arial;
font-family:palatino linotype;
font-family:times new roman;
... it converts without complaint. I would put the result up, but dropbox.com currently seems to have a problem.
snibgo's IM pages: im.snibgo.com
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: svg conversion and supported fonts

Post by snibgo »

snibgo's IM pages: im.snibgo.com
rs13
Posts: 65
Joined: 2009-01-15T12:57:26-07:00

Re: svg conversion and supported fonts

Post by rs13 »

Did you change the font name references in the svg itself?

Also, the output has the text cut off at the bottom and on the right where as the SVG image does not (see here http://sourcepin.com/text-sample.png). Does that mean that the font sizing is off? How one does control the size to make sure it matches what was designed in SVG and does not fall off the canvas?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: svg conversion and supported fonts

Post by snibgo »

rs13 wrote:Did you change the font name references in the svg itself?
Yes.

I have normalised the SVG layout to make it more readable, and numbered each text (1 to 10):

Code: Select all

<svg id="abc"
   xmlns="https://www.w3.org/2000/svg"
   version="1.2"
   xmlns:xlink="https://www.w3.org/1999/xlink"
   ng-style="{width:(s.dim.w*zoom)+'px',height:(s.dim.h*zoom)+'px'}"
   ng-controller="surface"
   style="width: 2325px; height: 1047.7467811158797px;">
  <g transform="translate(1162.5,523.8733905579398)">
    <defs>
      <clipPath id="id0.29726331401616335">
        <path sa="d=m -233,-105 466,0 0,208 -466,0 z"
           transform="scale(4.989270386266094,4.989270386266094)"
           d="m -233,-105 466,0 0,208 -466,0 z">
        </path>
      </clipPath>
      <linearGradient id="vertical"
         x1="0%"
         y1="0%"
         x2="0%"
         y2="100%">
        <stop offset="0%"
           style="stop-color:;stop-opacity:1">
        </stop>
        <stop offset="100%"
           style="stop-color:;stop-opacity:1">
        </stop>
      </linearGradient>
      <linearGradient id="horizontal"
         x1="0%"
         y1="0%"
         x2="100%"
         y2="0%">
        <stop offset="0%"
           style="stop-color:;stop-opacity:1">
        </stop>
        <stop offset="100%"
           style="stop-color:;stop-opacity:1">
        </stop>
      </linearGradient>
      <radialGradient id="radial"
         cx="50%"
         cy="50%"
         r="50%"
         fx="50%"
         fy="50%">
        <stop offset="0%"
           style="stop-color:;stop-opacity:1">
        </stop>
        <stop offset="100%"
           style="stop-color:;stop-opacity:1">
        </stop>
      </radialGradient>
    </defs>
    <g ng-switch="s.$design.background.color.style=='gradient'&&s.$design.background.value=='Colors'&&s.$design.background.color.type&&s.$design.background.color.from&&s.$design.background.color.to">
    </g>
    <g ng-switch="s.$design.background.color.style=='solid'&&s.$design.background.value=='Colors'&&s.$design.background.color.color">
    </g>
    <g clip-path="url(#id0.29726331401616335)">
      <g ng-switch=""
         on="s.$design.background.value">
        <image ng-switch-when="Theme"
           xlink:href=""
           sa="x=0;y=0;width=0;height=0;xlink:href="
           x="0"
           y="0"
           width="0"
           height="0">
        </image>
      </g>
      <g ng-repeat="a in s.$design.layers track by $id($index)"
         ng-switch="a.type">
        <text ng-switch-when="text"
           ng-mouseover="select($index,false)"
           ng-click="select($index,true);changeOrder($event,true)"
           sa="id=text0;x=-1111.962615132372;y=-497.8198690746009;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844"
           style="font-weight:default;font-style:normal;text-decoration:default;font-family:Arial;"
           id="text0"
           x="-1111.962615132372"
           y="-497.8198690746009"
           dy="118.04613733905579px"
           fill="#000000"
           font-size="129.72103004291844">Double-click to edit1</text>
      </g>
      <g ng-repeat="a in s.$design.layers track by $id($index)"
         ng-switch="a.type">
        <text ng-switch-when="text"
           ng-mouseover="select($index,false)"
           ng-click="select($index,true);changeOrder($event,true)"
           sa="id=text1;x=-1108.8513285431836;y=-365.9545739499446;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844"
           style="font-weight:default;font-style:normal;text-decoration:default;font-family:arial black;"
           id="text1"
           x="-1108.8513285431836"
           y="-365.9545739499446"
           dy="118.04613733905579px"
           fill="#000000"
           font-size="129.72103004291844">Double-click to edit2</text>
      </g>
      <g ng-repeat="a in s.$design.layers track by $id($index)"
         ng-switch="a.type">
        <text ng-switch-when="text"
           ng-mouseover="select($index,false)"
           ng-click="select($index,true);changeOrder($event,true)"
           sa="id=text2;x=-1123.4267251772194;y=-212.91290929256886;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844"
           style="font-weight:default;font-style:normal;text-decoration:default;font-family:comic sans ms;"
           id="text2"
           x="-1123.4267251772194"
           y="-212.91290929256886"
           dy="118.04613733905579px"
           fill="#000000"
           font-size="129.72103004291844">Double-click to edit3</text>
      </g>
      <g ng-repeat="a in s.$design.layers track by $id($index)"
         ng-switch="a.type">
        <text ng-switch-when="text"
           ng-mouseover="select($index,false)"
           ng-click="select($index,true);changeOrder($event,true)"
           sa="id=text3;x=-1116.1390268602015;y=-89.0220379032647;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844"
           style="font-weight:default;font-style:normal;text-decoration:default;font-family:courier new;"
           id="text3"
           x="-1116.1390268602015"
           y="-89.0220379032647"
           dy="118.04613733905579px"
           fill="#000000"
           font-size="129.72103004291844">Double-click to edit4</text>
      </g>
      <g ng-repeat="a in s.$design.layers track by $id($index)"
         ng-switch="a.type">
        <text ng-switch-when="text"
           ng-mouseover="select($index,false)"
           ng-click="select($index,true);changeOrder($event,true)"
           sa="id=text4;x=-1116.1390268602015;y=49.44423012007521;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844"
           style="font-weight:default;font-style:normal;text-decoration:default;font-family:georgia;"
           id="text4"
           x="-1116.1390268602015"
           y="49.44423012007521"
           dy="118.04613733905579px"
           fill="#000000"
           font-size="129.72103004291844">Double-click to edit5</text>
      </g>
      <g ng-repeat="a in s.$design.layers track by $id($index)"
         ng-switch="a.type">
        <text ng-switch-when="text"
           ng-mouseover="select($index,false)"
           ng-click="select($index,true);changeOrder($event,true)"
           sa="id=text5;x=-1116.1390268602015;y=187.91049814341514;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844"
           style="font-weight:default;font-style:normal;text-decoration:default;font-family:impact;"
           id="text5"
           x="-1116.1390268602015"
           y="187.91049814341514"
           dy="118.04613733905579px"
           fill="#000000"
           font-size="129.72103004291844">Double-click to edit6</text>
      </g>
      <g ng-repeat="a in s.$design.layers track by $id($index)"
         ng-switch="a.type">
        <text ng-switch-when="text"
           ng-mouseover="select($index,false)"
           ng-click="select($index,true);changeOrder($event,true)"
           sa="id=text6;x=-1116.1390268602015;y=333.6644644837729;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844"
           style="font-weight:default;font-style:normal;text-decoration:default;font-family:times new roman;"
           id="text6"
           x="-1116.1390268602015"
           y="333.6644644837729"
           dy="118.04613733905579px"
           fill="#000000"
           font-size="129.72103004291844">Double-click to edit7</text>
      </g>
      <g ng-repeat="a in s.$design.layers track by $id($index)"
         ng-switch="a.type">
        <text ng-switch-when="text"
           ng-mouseover="select($index,false)"
           ng-click="select($index,true);changeOrder($event,true)"
           sa="id=text7;x=-30.271977624535833;y=340.9521628007908;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844"
           style="font-weight:default;font-style:normal;text-decoration:default;font-family:trebuchet ms;"
           id="text7"
           x="-30.271977624535833"
           y="340.9521628007908"
           dy="118.04613733905579px"
           fill="#000000"
           font-size="129.72103004291844">8Double-click to edit8</text>
      </g>
      <g ng-repeat="a in s.$design.layers track by $id($index)"
         ng-switch="a.type">
        <text ng-switch-when="text"
           ng-mouseover="select($index,false)"
           ng-click="select($index,true);changeOrder($event,true)"
           sa="id=text8;x=-15.6965809905001;y=187.91049814341514;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844"
           style="font-weight:default;font-style:normal;text-decoration:default;font-family:sans-serif;"
           id="text8"
           x="-15.6965809905001"
           y="187.91049814341514"
           dy="118.04613733905579px"
           fill="#000000"
           font-size="129.72103004291844">9Double-click to edit9</text>
      </g>
      <g ng-repeat="a in s.$design.layers track by $id($index)"
         ng-switch="a.type">
        <text ng-switch-when="text"
           ng-mouseover="select($index,false)"
           ng-click="select($index,true);changeOrder($event,true)"
           sa="id=text9;x=28.029608911607237;y=-489.8454453392486;dy=118.04613733905579px;fill=#000000;font-size=129.72103004291844"
           style="font-weight:default;font-style:normal;text-decoration:default;font-family:palatino linotype;"
           id="text9"
           x="28.029608911607237"
           y="-489.8454453392486"
           dy="118.04613733905579px"
           fill="#000000"
           font-size="129.72103004291844">10Double-click to edit10</text>
      </g>
    </g>
  </g>
</svg>
The text at bottom-right is text 8. It is located at:
x = -30
y = 341 + 118 = 459

But it is in a group that is translated by 1162,524.

So it starts at 1132, 983. The font height is 130, so the bottom of the text will be at about 1113. This is more than the specified height of the document (1048), so we expect the bottom of the text to be trimmed by the document boundary.

The document size is specified as 2325x1048. Why does an IM conversion give 2523x933? I don't know. Perhaps the "ng-style" attribute.

Inkscape can't read this SVG file.
snibgo's IM pages: im.snibgo.com
rs13
Posts: 65
Joined: 2009-01-15T12:57:26-07:00

Re: svg conversion and supported fonts

Post by rs13 »

Hello,

I am sorry about the delay in responding. Thank you for explaining the svg - it makes a lot of sense. I also flagged ng-style attribute with engineering as that very well may be the reason for the cut off.

In terms of my original question of managing font support when converting svg to png, I found that adding the fonts at the system level to make them available to imageMagick as outlined here: http://www.webhostingtalk.com/showthread.php?t=589071

and

http://stackoverflow.com/questions/2650 ... ize-a-font

is the fastest solution here.

I can't really rip up current ImageMagick from the production server just to change to a different delegate especially not knowing what fonts issue will it help me to solve, if any. I followed those links and I am now able to control what fonts has imageMagick in scope and therefore supports when converting from svg to png. I hope others will find this insight useful.
Post Reply