Server OS:
Centos 6.5, 32bit
ImageMagick Version:
Version: ImageMagick 6.5.4-7 2014-02-10 Q16 OpenMP http://www.imagemagick.org
PHP Version:
PHP 5.3.3 (cli) (built: Dec 11 2013 03:15:48)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
What I've done and tried to install fonts:
1. Create the file /home/username/.magick/type.xml with the correct font definitions. The file looks like this:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE typemap [
<!ELEMENT typemap (type)+>
<!ELEMENT type (#PCDATA)>
<!ELEMENT include (#PCDATA)>
<!ATTLIST type name CDATA #REQUIRED>
<!ATTLIST type fullname CDATA #IMPLIED>
<!ATTLIST type family CDATA #IMPLIED>
<!ATTLIST type foundry CDATA #IMPLIED>
<!ATTLIST type weight CDATA #IMPLIED>
<!ATTLIST type style CDATA #IMPLIED>
<!ATTLIST type stretch CDATA #IMPLIED>
<!ATTLIST type format CDATA #IMPLIED>
<!ATTLIST type metrics CDATA #IMPLIED>
<!ATTLIST type glyphs CDATA #REQUIRED>
<!ATTLIST type version CDATA #IMPLIED>
<!ATTLIST include file CDATA #REQUIRED>
]>
<typemap>
<type
format="ttf"
name="Lobster"
fullname="Lobster"
family="Lobster"
glyphs="/home/username/fonts/Lobster/Lobster.ttf"
style="normal"
stretch="normal"
weight="400"
/>
</typemap>
Code: Select all
<typemap>
<include file="type-ghostscript.xml" />
<include file="/home/username/.magick/type.xml" />
</typemap>
Code: Select all
$image = new Imagick();
$fonts = $image->queryfonts();
foreach($fonts as $font) {
echo $font . '<br />';
}
Code: Select all
[...]
Hershey-Plain-Triplex-Regular
Hershey-Script-Complex-Regular
Hershey-Script-Simplex-Regular
Lobster
MeriendaOne
NewCenturySchlbk-Bold
NewCenturySchlbk-BoldItalic
NewCenturySchlbk-Italic
NewCenturySchlbk-Roman
[...etc]
Code: Select all
Font: Lobster
family: Lobster
glyphs: /usr/share/nginx/.fonts/Lobster/Lobster.ttf
6. I've restarted the entire server, rebooted the php-fpm process, cleared caches and temp directories.
My PHP code I am testing with, and expecting the font to render is:
Code: Select all
//Setup SVG to be read by Imagick.
$SVG = '<?xml version="1.0" encoding="utf-8"?>';
$SVG .= '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">';
$SVG .= '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="158px" height="92px" viewBox="0 0 158 92" enable-background="new 0 0 158 92" xml:space="preserve">';
$SVG .= '<text transform="matrix(1 0 0 1 32 58)" font-family="Lobster" font-style="normal" font-size="20px" font-weight="400">Lobster</text>';
$SVG .= '</svg>';
$image = new Imagick();
//Convert SVG to JPG
$image->readImageBlob($SVG);
$image->setImageFormat("jpeg");
//Save the thumbnail.
$save_path = '/home/username/lobster.jpg';
$image->writeImage($save_path);
echo '<img src="lobster.jpg" alt="" /><br />';

Is there a known issue with Centos 6.5 and ImageMagick/PHP for SVG font rendering? I'm tried everything and I just cannot get this to work. Any help would be greatly appreciated!