This project has moved and is read-only. For the latest updates, please go here.

Force Ghostscript to load all fonts

Aug 24, 2015 at 7:50 PM
Edited Aug 24, 2015 at 7:51 PM
I'm using Magick.NET-Q16-HDRI-AnyCPU and I'm setting the gs directory in code and pointing at gsdll32.dll. The project is an site.

I'm generating a png from a PDF with some custom fonts. I've installed the fonts on my system and ImageMagick/Ghostscript seems to render them all correctly except one. Is there a way in your API to pass command line params to gs? Specifically I want to try "-sFONTPATH=%windir%/fonts -dEmbedAllFonts=true"

Or better yet is there a way I can specify a font map using MagickNet?

Aug 24, 2015 at 10:20 PM
You can modify the Ghostscript options inside the delegates.xml file. Copy all the xml files from the following directory: %TEMP%\Magick.NET. to your own directory. Then edit the delegates.xml and add the extra options in all the 'ps:' decode entries. Make sure you call 'MagickNET.Initialize' with your new directory at the start of your program.

It is also possible that your machine just requires a reboot. This has solved many font issues for me and other users of Magick.NET
Aug 31, 2015 at 9:22 PM
Thanks for the info. I followed these steps successfully but some of the embedded fonts within my PDF still aren't rendering correctly. I'm sure it's an issue with Ghostscript and I'm working directly with it to identify the solution.
Sep 1, 2015 at 12:05 PM
Thank you for coming back to this thread. If you manage to resolve this with the Ghostscript team then please reply to this topic with the solution.
Oct 16, 2015 at 8:03 PM
Edited Oct 16, 2015 at 8:03 PM
After much troubleshooting I was able to get my output PNG to use all the appropriate fonts. It wasn't until I told Magick.NET to start logging errors (as described here) that it suddenly worked. And the error log is empty.

I have no idea what the cause was, but I'm pleased it's working.
Oct 16, 2015 at 8:48 PM
It sounds really strange that enabling logging solved it. That has nothing to do with Ghostscript. Maybe a reboot or a re installation of Ghostscript solved it?
Nov 16, 2016 at 5:42 PM
Hey guys.
It's an old question, but I faced the same problem here and solved it just changing the directory of the fonts path to C:\windows\fonts instead of %windir%\fonts.
If I'm correct, the problem is that the lib is trying to use %windir% as a variable (eg.: %i), it's causing the incorrect behavior.

I hope it helps.

Thank you!