Tutorial :ImageMagickError unable to read font `(null)': `(null)'



Question:

I've been getting this error for a while on my production server (Ubuntu running ImageMagick, Rmagick, etc).

From Googling around it seems to be not finding the right fonts to use, and this needs to be set correctly in

sudo nano /usr/lib/ImageMagick-6.3.7/config/type-ghostscript.xml  

When I open up this file it lists a bunch of fonts in this directory

/usr/share/fonts/type1/gsfonts/  

They all exist. I've tried changing the owner and permissions on those fonts. Doesn't seem to help.

Has anyone encountered this and been able to fix it? Thanks!


Solution:1

My fix for MacOS Yosemite:

$brew install gs  

Problem solved (for me).


Solution:2

Finally solved it after MONTHS!!

Answer was here: http://rubyforge.org/forum/forum.php?thread_id=8742&forum_id=4402

Had to compile imagemagick with the "--with-gs-font-dir=/where/your/gs/fonts/live" flag

did a "locate .pfb" to find where they were. for me it was "--with-gs-font-dir=/usr/share/fonts/type1/gsfonts" on ubuntu

Complete steps below. Note I had to use the "â€"disable-openmp" flag also due to another bizarre error described here: http://computerplumber.com/2009/01/installing-rmagick-28-gem-on-hardy/

# remove in case you already installed imagemagick from apt-get  sudo apt-get remove imagemagick  sudo apt-get install libperl-dev gcc libjpeg62-dev libbz2-dev libtiff4-dev libwmf-dev libz-dev libpng12-dev libx11-dev libxt-dev libxext-dev libxml2-dev libfreetype6-dev liblcms1-dev libexif-dev perl libjasper-dev libltdl3-dev graphviz gs-gpl pkg-config    #get image magick from source and compile it  cd ~/sources  wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz  tar xvfz ImageMagick.tar.gz  cd ImageMagick-6.5.4-2  ./configure --disable-openmp --with-gs-font-dir=/usr/share/fonts/type1/gsfonts  make  sudo make install    #reinstall rmagick gem  sudo gem uninstall rmagick  sudo gem install rmagick  

This has been possibly the worst install experience I've ever encountered in my life due to this and numerous other bugs. Shame on imagemagick and rmagick.


Solution:3

Easy fix, go to http://sourceforge.net/projects/gs-fonts/?source=dlp download the fonts and copy them to /usr/local/share/ghostscript/fonts


Solution:4

Try this: http://rmagick.rubyforge.org/install-faq.html#fonts

RMagick relies entirely on ImageMagick for font management. The problem must ly with the configuration of ImageMagick. To see how ImageMagick is configured for fonts, use this command:

 convert -list font  

The output will show you the fonts that ImageMagick knows to use. That list may not include every font installed on your system!

Look for the lines that start with "Glyphs:". These are the fonts which you can use with your current installation/configuration of RMagick.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »