12

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!

Brian Armstrong
  • 19,707
  • 17
  • 115
  • 144
  • Not directly related to the question but since it's a google hit, here goes. If you're using one of the command-line tools such as `convert` or `composite` and are told that a font is not found, try specifying the full path to the font, e.g. `-font /usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf`. – Roman Starkov Dec 03 '13 at 18:55

4 Answers4

23

My fix for MacOS Yosemite:

$brew install gs

Problem solved (for me).

melbic
  • 11,988
  • 5
  • 33
  • 37
Mike Park
  • 1,965
  • 1
  • 14
  • 10
  • Anybody running into this problem in 2018 using Docker: Ensure you have "ghostscript" in your Dockerfile (either before you install ImageMagick, or if you are using rmagick, before your Gem install). That should take care of this error in your Docker container. – Dave Collins Feb 08 '19 at 21:09
10

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.

Brian Armstrong
  • 19,707
  • 17
  • 115
  • 144
  • I'm on Mountain Lion and "locate .pfb" returns 0 results. Any ideas? – Agis Dec 18 '12 at 15:24
  • 1
    Mountain Lion is missing ghostscript. http://stackoverflow.com/questions/13936256/imagemagick-error-while-running-convert-convert-unable-to-read-font – stevendaniels Nov 24 '13 at 08:37
3

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.

Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
digitalsanctum
  • 3,261
  • 4
  • 29
  • 43
  • Yep I went through that...it could be I'm missing some pre-reqs like freetype? Not sure. I tried installing freetype from source but I get a variety of errors I can figure out. The install guides I've seen for Ubuntu seem to indicate these are unnecessary though if you just install through apt-get and gem. Thanks for looking at it. – Brian Armstrong Jun 20 '09 at 20:15
  • 1
    this is a broken link – Raj Oct 03 '14 at 13:19
2

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

Emad
  • 4,110
  • 5
  • 30
  • 35