Page 1 of 1
[Windows] Imagemagick lists my TTF font but does not use it
Posted: 2014-06-24T17:04:15-07:00
by stokecn
An alternate title might be "How can I map a font file to an arbitrary font name/family?"
I am converting SVG to PNG in a Windows environment.
When I attempt to convert my SVG to PNG, ImageMagick returns:
Code: Select all
** (convert.exe:2488): WARNING **: couldn't load font "'ArialMT' Not-Rotated 8.7
998046875", falling back to "Sans Not-Rotated 8.7998046875", expect ugly output.
However, with "convert -list font" I see:
Code: Select all
Path: C:\Program Files\ImageMagick-6.8.9-Q16\type.xml
Font: ArialMT
family: ArialMT
style: Normal
stretch: Normal
weight: 0
glyphs: C:\Program Files\ImageMagick-6.8.9-Q16\arial.ttf
Is ImageMagick trying to tell me that it's missing a dependency/delegate? Or do I simply need to resolve some error in my configuration?
I have other, minor questions, but they may remain unasked if I can't resolve this issue.
Re: [Windows] Imagemagick lists my TTF font but does not use
Posted: 2014-06-24T17:39:25-07:00
by snibgo
"convert -list font" isn't relevant. For SVG, I believe the only important factor is whether the font is installed on Windows.
The error message suggests your SVG file has too many quotes. If that's not the problem, paste your SVG here, between [ code ] and [ /code ].
Re: [Windows] Imagemagick lists my TTF font but does not use
Posted: 2014-06-24T21:05:14-07:00
by stokecn
Here's a simplified version that still produces the error (below).
However, It's not quite that simple. The SVGs are saved by illustrators from Adobe Illustrator. I'm afraid that posting the full SVG would only be a distraction, but the font-family attribute values in the SVG actually reference a fontName saved by Illustrator. Illustrator saves font resource data like this:
Code: Select all
<rdf:Description rdf:about=""
xmlns:xmpTPg="http://ns.adobe.com/xap/1.0/t/pg/"
xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#"
xmlns:stFnt="http://ns.adobe.com/xap/1.0/sType/Font#"
xmlns:xmpG="http://ns.adobe.com/xap/1.0/g/">
<xmpTPg:Fonts>
<rdf:Bag>
<rdf:li rdf:parseType="Resource">
<stFnt:fontName>ArialMT</stFnt:fontName>
<stFnt:fontFamily>Arial</stFnt:fontFamily>
<stFnt:fontFace>Regular</stFnt:fontFace>
<stFnt:fontType>Open Type</stFnt:fontType>
<stFnt:versionString>Version 3.00</stFnt:versionString>
<stFnt:composite>False</stFnt:composite>
<stFnt:fontFileName>arial.ttf</stFnt:fontFileName>
</rdf:li>
It seems unlikely that the font attribute values in the SVG will ever resolve to system/installed fonts.
I can edit the SVGs at conversion so I can produce an SVG that will make IM happy. I just need to know how to ensure that convert can use exactly the opentype or type 1 fonts that I need (assuming it can).
Here's the SVG. Like I said, this still produces the error for me.
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
x="0px" y="0px" width="837.727px"
height="143.14px" viewBox="0 0 837.727 143.14"
enable-background="new 0 0 837.727 143.14"
xml:space="preserve">
<g id="g3301" >
<rect id="rect3303" x="8.86" y="7.732" fill="#D1D3D4" width="822.681" height="47.938"/>
<text font-family="ArialMT" y="104.26884" font-size="18"/>
<text font-family="ArialMT" x="40" y="100" font-size="16.5"> Helvetica, Medium </text>
<text font-family="ArialMT" font-size="18"/>
<text id="text3343" font-family="Arial-BoldMT"
x="50" y="36" font-size="16.5"> NAME, WEIGHT </text>
<text id="text3345" font-family="Arial-BoldMT" y="36" x="475" font-size="16.5"> EXAMPLE TEXT </text>
<g id="g3347">
<text font-family="ArialMT" font-size="18"/>
<text font-family="Helvetica"
x="300" y="100"
font-size="16.5"> Create and Run a Test Case to Execute the Sequence File </text>
</g>
<g id="g3387">
<path id="path3389" fill="#D1D3D4"
d="M827.227,10.5v122.14H10.5V10.5H827.227 M837.727,0H0v143.14h837.727V0L837.727,0z"/>
</g>
<line id="line3391" fill="none" stroke="#D1D3D4"
stroke-width="7" stroke-miterlimit="10"
x1="308.86" y1="0" x2="308.86" y2="143.14"/>
<line id="line3393" fill="none" stroke="#FFFFFF"
stroke-width="2" stroke-miterlimit="10"
x1="308.86" y1="5.922" x2="308.86" y2="50.412"/>
</g>
</svg>
Re: [Windows] Imagemagick lists my TTF font but does not use
Posted: 2014-06-25T05:29:17-07:00
by snibgo
Hmm, okay. Your SVG looks valid. When I convert it, I get a similar warning to you because my Windows doesn't have fonts named ArialMT, Arial-BoldMT or Helvetica. When I manually change the font family to fonts I do have, it converts without warnings.
If I understand you correctly, the SVG font-family should be translated according to your Illustrator font resource data, so "ArialMT" becomes "Arial".
IM won't do this translation for you. I would hope that Illustrator has an option to save the SVG without needing a further translation. The other option would be to write a script or program that read the Illustrator font resource data and translated the SVG file.
Re: [Windows] Imagemagick lists my TTF font but does not use
Posted: 2014-06-25T11:06:47-07:00
by stokecn
snibgo wrote:The other option would be to write a script or program that read the Illustrator font resource data and translated the SVG file.
For the record, this works. I can apply an XSLT to produce an SVG that uses the installed font families. I was hoping to be able to map fonts and avoid this because it puts me at the mercy of Windows font weirdness. (Weirdness is perhaps too strong, but it's not as transparent as a fonts.conf.)
snibgo wrote:I would hope that Illustrator has an option to save the SVG without needing a further translation.
Possibly, but I'd be surprised if anything other than embedding the font works as expected (not sure how IM behaves in that case - haven't tried it). At any rate, changing the process won't affect the existing files.
Thanks you for your help.
Re: [Windows] Imagemagick lists my TTF font but does not use
Posted: 2014-06-25T11:29:28-07:00
by snibgo
Pleasure. (Note to self: must look into XSLT.)
I should mention that IM uses type.xml for its own operations such as "-annotate" so it could be used to translate font names for those operations. But it isn't (as far as I know) used for SVG.
Re: [Windows] Imagemagick lists my TTF font but does not use it
Posted: 2015-10-14T20:17:29-07:00
by Juantxo
I had the same error.
Adobe illustrator does not insert the right windows font name and add apostrophe you must delete.
In my case I had:
"'CenturyGhotic'"
I searched my installed windows fonts for the real name of the font.( Control Panel\All Control Panel Items\Fonts)
It was:
"Century Ghotic" with an extra space.
I suppose your real name will be "Arial MT"