Page 1 of 2

How to find fonts

Posted: 2010-05-15T23:18:33-07:00
by perl@nevcal.com
Given an error like the following, what must I tweak to help it find the fonts? Or, if someone can explain how to get gs and imagemagick working together on Win7 64-bit, with 64-bit versions of both applications, that would probably help.

Magick: unable to read font `C:\Program Files\ImageMagick-6.6.1-Q16\config\@ghostscript_font_path@n021003l.pfb' @ error/annotate.c/RenderFreetype/1056.

Re: How to find fonts

Posted: 2010-05-15T23:31:16-07:00
by fmw42
Not an expert on this, but it looks like one or both of two things. First you need to install the ghostscript fonts and edit your configuration file to point to those fonts. Second you may need freetype delegate library installed. I assume you are installing from source and not binary.

My configuration file looks like the following (I am on a Mac):

./configure CPPFLAGS='-I/opt/local/include' LDFLAGS='-L/opt/local/lib' \
--enable-delegate-build --enable-shared --disable-static \
--with-modules --with-quantum-depth=16 --with-gslib --without-wmf \
--disable-silent-rules --disable-dependency-tracking \
--with-gs-font-dir=/opt/local/share/ghostscript/fonts/ --with-lqr


see http://www.imagemagick.org/download/delegates/ but I would search Google for more current delegates

To find your delegates, type

convert -list configure

look for line starting with DELEGATES as per mine:

DELEGATES bzlib fftw fontconfig freetype gs jpeg jng jp2 lcms lqr mpeg openexr png rsvg tiff x11 xml zlib

Re: How to find fonts

Posted: 2010-05-15T23:36:36-07:00
by perl@nevcal.com
On Windows, "all" the delegates are bundled in the binary installer. All except Ghostscript, it seems. And I think from something I read or tried, that the PCL delegate is not bundled with the Windows binary installer either.

I suspect the reasoning is something like.... Windows "distributions" don't include any of the IM delegates, because those are all open source. Windows users are used to binary installers. Windows users are not used to having to install multiple packages to get a particular functionality.

However, by not bundling Ghostscript or PCL delegates, that's where the problems arise.

I have installed Ghostscript, but apparently IM doesn't properly invoke it.

Re: How to find fonts

Posted: 2010-05-15T23:38:54-07:00
by perl@nevcal.com
Oh, and so because I use a binary distribution, I don't run "configure", so I'd need to know what to edit in the delegate files, I guess.

Re: How to find fonts

Posted: 2010-05-15T23:39:32-07:00
by fmw42
I have installed Ghostscript, but apparently IM doesn't properly invoke it.
Did you get theh Ghostscript fonts and put them in the appropriate location and change your ./configuration file to tell IM where they are located?

Re: How to find fonts

Posted: 2010-05-15T23:40:26-07:00
by fmw42
perl@nevcal.com wrote:Oh, and so because I use a binary distribution, I don't run "configure", so I'd need to know what to edit in the delegate files, I guess.

Sorry I cannot help further. You will need help from a Windows user or one of the IM folks.

Re: How to find fonts

Posted: 2010-05-15T23:42:40-07:00
by fmw42
You might find some further help at http://www.imagemagick.org/download/www ... ation.html

Re: How to find fonts

Posted: 2010-05-16T00:09:00-07:00
by perl@nevcal.com
Thanks for trying to help.

I wonder if the developers are tracking changes to Ghostscript... apparently they Ghostscript people have moved the fonts from a directory, to a .dll that contains a "read only file system" of the font files. If IM is attempting to read the files, that would now fail, because they aren't there... but I'm sure I don't know what to do to resolve it.

Re: How to find fonts

Posted: 2010-05-16T00:15:34-07:00
by fmw42
Hopefully, tomorrow or Monday a Windows user or one of the IM folks can point you in the right direction.

Re: How to find fonts

Posted: 2010-09-19T19:12:10-07:00
by perl@nevcal.com
Sadly, four months of tomorrows, and still no help for Windows 7 64-bit IM + Ghostscript. It is four months, because I was out of town most of that time, and away from this 64-bit Windows 7 computer, and couldn't have responded to any help, but none came, either. Is there anyone that understands this stuff?

I just installed the latest version of ImageMagick, and imdisplay reports that it can't find the delegate, and the convert command

"C:\Program Files\ImageMagick-6.6.4-Q8\convert.exe" xc:white -resize 2456x3000! ( -size 787x300 pattern:checkerboard -threshold 50% -repage 2456x3000+1669+2100 ) -compose multiply -flatten ( -size 787x300 -font Times-Roman -gravity west "label:Lorem ipsum dolor\nsit amet, consectetur\nadipisicing elit, sed\ndo eiusmod tempor" -trim +repage -gravity center -extent 787x300 -repage 2456x3000+1669+2400 ) -compose multiply -flatten ( -size 787x300 -font Times-Roman -gravity west" label:Lorem ipsum dolor sit amet, consectetur\nadipisicing elit, sed do eiusmod tempor" -trim +repage -gravity center -extent 787x300 -repage 2456x3000+1669+2700 ) -compose multiply -flatten -density 300 -compress group4 d:\temp\label-temp.tif

reports

Magick: unable to read font `@ghostscript_font_path@n021003l.pfb' @ error/annotate.c/RenderFreetype/1056.
Magick: `%s' (%d) "gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g228x24 "-sOutputFile=d:/temp/magick-4Gdb0K6x" "-fd:/temp/magick-SHtBGtdW" "-fd:/temp/magick-vDhGkTXb" @ error/utility.c/SystemCommand/2093.
Magick: `%s' (%d) "gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g228x24 "-sOutputFile=d:/temp/magick-4Gdb0K6x" "-fd:/temp/magick-SHtBGtdW" "-fd:/temp/magick-vDhGkTXb" -c showpage @ error/utility.c/SystemCommand/2093.
Magick: Postscript delegate failed `d:/temp/magick-XgC-q77J': No such file or directory @ error/ps.c/ReadPSImage/779.
(this is the first group of errors, and they get repeated with minor variations)

It seems that maybe @ghostscript_font_path@ should have gotten substituted by something real, or do I need to install something else, besides Ghostscript 8.71 64-bit version, and IM 6.64-4 64-bit version?

Curiously, gswin32c.exe is referenced, but is not found, on my system it is at

C:\Program Files\gs\gs8.71\bin\gswin32c.exe

Not sure what the difference is between gswin32.exe and gswin32c.exe, both exist, together with a 12MB gsdll32.dll in the same directory, and an 8KB gsdll32.lib as well.

Re: How to find fonts

Posted: 2010-09-19T19:46:02-07:00
by perl@nevcal.com
Found this on sourceforge's ghostscript forum:
Starting with 8.64, the fonts are compiled into the dll, so you don't need to install them unless you want to access them from another application.
Dunno if this is the problem IM is having finding fonts, or if there are other problems too. The fonts are available, but where to put them on a Win7 64-bit machine so that IM would find them?

Re: How to find fonts

Posted: 2010-09-20T03:21:07-07:00
by Drarakel
In your case, Ghostscript apparently isn't found at all.
Normally, ImageMagick tries to access the Ghostscript DLL by searching the Ghostscript entries in the Windows registry. If that doesn't work, IM calls "gswin32c.exe".
Adding the "gs\gs8.71\bin" directory (or whatever it's called on your system) to your PATH variable could help.

Your command line from above looks a bit complicated for a test.. So, better try to convert e.g. a PDF/PS file to a JPG first or something like that - without additional options. If that works (and Ghostscript is found), then you could try a (simple) command with a font.
I think, on Windows, ImageMagick takes the fonts from the normal Windows Fonts directory first. Other fonts are taken from Ghostscript. For me, that usually works. (But I don't use many.)
(By the way: "xc:white -resize 2456x3000!" looks odd. Why not using "-size 2456x3000 xc:white"?)

That being said, such a command with "-font Times-Roman" first failed on my system, too. I got loads of these "unable to read font" messages. (But the Ghostscript DLL is accessed on my system. I'm getting different errors if I 'hide' the DLL.)

Oh, and.. In my debug output, I have also such messages (if IM can't read this Times-Roman font):

Code: Select all

2010-09-20T12:16:12+02:00 0:00.906 0.672u 6.6.4 Exception Magick[1624]: constitute.c/ReadImage/595/Exception
  Coder (PNM) generated an image despite an error (405), notify the developers
Magick: unable to read font `@ghostscript_font_path@n021003l.pfb' @ error/annotate.c/RenderFreetype/1056.
...
Solution on my system:
It works with that font (without error) if I copy an old package of the Ghostscript fonts to a gs\fonts subdirectory. But that works only if IM can access the Windows registry. (My Ghostscript 8.71 installation specifies a "GS_LIB" value with that directory.)
Of course, with Win7, that could be a bit more difficult. (I'm still on Windows XP.) :)

Re: How to find fonts

Posted: 2010-09-20T14:46:10-07:00
by perl@nevcal.com
Drarakel, thanks for your response.

I added
C:\Program Files\gs\gs8.71\bin
to my path, and now I only get one error repeated many, many times:

Magick: unable to read font `@ghostscript_font_path@n021003l.pfb' @ error/annotate.c/RenderFreetype/1056.

So I tried adding instead
C:\Program Files\gs\gs8.71\bin
to the path, and that produced exactly the same results.

Reinstalling IM after adding the above to the path didn't help the test command either... but something of the above did help imdisplay to display PDF files, which didn't work before. And yes, a convert file.pdf file.jpg now works, and didn't before.

So my big long command is a command that is a test command in software I wrote to do certain image manipulation operations for me. If that command works, so will my needed image manipulations. But, sadly, that command still doesn't work, as reported just above.

Any more clues or suggestions?

Re: How to find fonts

Posted: 2010-09-20T15:46:40-07:00
by perl@nevcal.com
Drarakel wrote:Solution on my system:
It works with that font (without error) if I copy an old package of the Ghostscript fonts to a gs\fonts subdirectory. But that works only if IM can access the Windows registry. (My Ghostscript 8.71 installation specifies a "GS_LIB" value with that directory.)
Of course, with Win7, that could be a bit more difficult. (I'm still on Windows XP.) :)
So is the set of Ghostscript fonts changed? Is there no longer one called Times Roman in the embedded DLL fonts? From the following, it looks like there is... but I don't know how to interpret @ghostscript_font_path@ that also appears in the error message.
identify -list font
...
Font: Times-Roman
family: Times
style: Normal
stretch: Normal
weight: 400
glyphs: @ghostscript_font_path@n021003l.pfb

Path: Windows Fonts
...

Re: How to find fonts

Posted: 2010-09-20T17:50:18-07:00
by Drarakel
perl@nevcal.com wrote:I added
C:\Program Files\gs\gs8.71\bin
...
So I tried adding instead
C:\Program Files\gs\gs8.71\bin
I don't see a difference?
But, well, at least this worked for you and IM has access to the Ghostscript directory.
perl@nevcal.com wrote:and now I only get one error repeated many, many times:

Magick: unable to read font `@ghostscript_font_path@n021003l.pfb' @ error/annotate.c/RenderFreetype/1056.
Yeah, I had this, too. If you have the repeated errors, it means that IM can access the gsdll32.dll. But this special font apparently can't be read correctly. Or maybe the font is indeed missing in the latest DLL? I don't know.

On my system, I fixed it by using this fonts package here:
http://sourceforge.net/projects/gs-fonts/
I copied the fonts to my 'gs\fonts' directory. This directory apparently has precedence over the Ghostscript DLL. But as I said, it works only if IM can access the registry entries for Ghostscript (on my system, it's 'HKEY_LOCAL_MACHINE\SOFTWARE\GPL Ghostscript\8.71'). Here, the path to this GS fonts directory is specified. (Theoretically, it should also be possible to add a GS_LIB environment variable with the fonts path instead of using the registry. But that didn't work on my system..)

If everything works like it should, then the output from "convert -list font" also changes a bit (IM replaces '@ghostscript_font_path@' with this directory). I then get (on a german Windows XP):

Code: Select all

  Font: Times-Roman
    family: Times
    style: Normal
    stretch: Normal
    weight: 400
    glyphs: C:\Programme\gs\fonts\n021003l.pfb
So, you should test such a GS fonts package. And try if you can get IM to read the registry entries. Perhaps you have to add some permissions on Windows 7.

If that doesn't work, then you should be able to modify the 'type-ghostscript.xml' file in your IM config directory. Here, in the line with "Times-Roman", replace the two "@ghostscript_font_path@" with absolute paths to your GS fonts directory (e.g. "C:\Program Files\gs\fonts\").