title: Imagick / ImagickDraw setFont and setFontFamily timing out
body: <p>I have a PHP script that uses Imagick/ImageMagick to dynamically build images as required using data from a database. This has been working fine for the last few years but I restarted (after installing some OSX updates) the hardware that the site is running on earlier and all of a sudden it now won't work.</p>
  
  <p>The Apache error_log file says the script is timing out on the line that calls setFont( 'Arial' ) on an ImagickDraw object. I have tried changing the parameter to the full path to the font file (/Library/Fonts/Arial.ttf) but it does the same. I have also tried copying the font file to the same folder as the PHP script and loading it in using './Arial.ttf' but still the same result. If I comment out the line then the script still times out when I pass the ImagickDraw object into an Imagick->annotate_image() method (which is when I'm guessing it tries to assign a default font or similar).</p>
  
  <p>After much Googling I have tried ...</p>
  
  <ul>
  <li>rebuilding the font cache on the OS by calling 'fc-cache'</li>
  <li>checking I have the correct path to the font file and that PHP can 'see' it by calling file_get_contents() on the local path and full path</li>
  <li>restarting the machine a few times</li>
  </ul>
  
  <p>... but these all still time out. It seemingly just has a problem loading the fonts. My test script is:</p>
  
  <pre><code>$settings = new ImagickDraw();
  $settings-&gt;setFillColor( '#92a7d2' );
  $settings-&gt;setFontSize( 36 );
  //$settings-&gt;setFont( '' ); // Throws an exception 'Can not set empty font' (as it should)
  //$settings-&gt;setFont( './Arial.ttf' ); // Times out
  //$settings-&gt;setFont( 'Arial' ); // Times out
  //$settings-&gt;setFont( "/Library/Fonts/Arial.ttf" ); // Times out
  //$settings-&gt;setFontFamily( 'Arial' ); // Times out
  </code></pre>
  
  <p>Even calling \Imagick::queryFonts("*") / php_imagick_check_font() times out.</p>
  
  <p>I'm at a loss now. It seems that it's to do with loading the fonts but I can't work out why and it seems odd that it should randomly appear like this.</p>
  
  <p>Any ideas?</p>
  
  <hr>
  
  <p>Result of <code>identify -list Configure | grep freetype</code> ...</p>
  
  <p>CFLAGS         -I/opt/local/include/libxml2 -I/opt/local/include/libpng16 -D_THREAD_SAFE -I/opt/local/include/OpenEXR -I/opt/local/include -I/opt/local/include/openjpeg-2.1 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include -I/opt/local/include   -pipe -Os -arch x86_64 -Wall -mtune=sandybridge -fexceptions -D_FORTIFY_SOURCE=0 -D_THREAD_SAFE -pthread -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
  DELEGATES      bzlib djvu mpeg fftw fontconfig freetype gslib jbig jng jpeg lcms lzma openexr openjp2 png ps tiff webp x xml zlib
  LIBS            -L/opt/local/lib -llcms2 -L/opt/local/lib -lfreetype   -L/opt/local/lib -lfftw3 -L/opt/local/lib -lfontconfig -lfreetype -lXext   -lSM -lICE -lX11  -lXt -L/opt/local/lib -llzma -lbz2 -L/opt/local/lib -lz -lltdl  -lm     </p>