You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Many fonts invisible for Preview.app rendering PostScript

This has apparently been a problem awhile (2014):


https://discussions.apple.com/thread/5898288

https://discussions.apple.com/thread/6621258


But, it remains a problem. I got some help with a minimal PostScript example, say test.ps:


%!
/AmericanTypewriter findfont 12 scalefont setfont
100 400 moveto
(Hello! I'm AmericanTypewriter!) show
showpage


Fails with:

PostScript Conversion Warning
Converting the PostScript file “test.ps” produced the following warnings:

· AmericanTypewriter not found, using Courier.


Even worse:

%!
/AmericanTypewriter-Light findfont 12 scalefont setfont
100 400 moveto
(Hello! I'm AmericanTypewriter!) show
showpage


Gives no error, but uses an utterly incorrect font:


Likewise, for most user, system, etc. fonts. It appears that Preview.app's rendering engine doesn't do it.


Does anyone know how do better diagnose this? Does Preview.app use Ghostscript or Display PostScript, or something weirder to convert PostScript?


My setup: Catalina, 10.15.5, Retina 12-inch, 2017

Why it's a problem: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=41958

MacBook, macOS 10.15

Posted on Jun 21, 2020 12:46 AM

Reply
Question marked as Top-ranking reply

Posted on Jun 22, 2020 5:58 AM

Thanks for this! You've given me a work around: any fonts that I want to work with using Preview.app should be located in /Library/Fonts... easy enough! I can move them, but there's one remaining wrinkle. MacOS still doesn't like the font I want to use Hack, but I've got a work around for that too.


1) Install Hack in /Library/Fonts

2) Create `test.ps` as

%!
/Hack-Regular findfont 12 scalefont setfont
100 400 moveto
(Hello! I'm Hack Regular showing up in a PostScript file!) show
showpage

3) Try loading `test.ps` into Preview.app, new error

4) BUT! I have ghostscript (gs -v 9.52) installed and now `ps2pdf` creates a pdf that Preview.app happily opens with the correct font.


So, I can package this up as a script for a work around, no problem, but the moral of the story seems twofold:

  1. The current font management is a little delicate. Sometimes putting fonts in the standard location (/Library/Font) helps.
  2. Sometimes that's not enough, but in the absence of an Apple solution, ghostscript can bridge the gap.



Here's the script that solves my problem `print-preview.sh`

#!/bin/sh
PREVIEW_FILE=$(gmktemp --suffix=.ps)
cat >"$PREVIEW_FILE" && ps2pdf "$PREVIEW_FILE" "$PREVIEW_FILE.pdf" && \
    open "$PREVIEW_FILE.pdf" || \
      echo 'Print preview failed'


Similar questions

4 replies
Question marked as Top-ranking reply

Jun 22, 2020 5:58 AM in response to VikingOSX

Thanks for this! You've given me a work around: any fonts that I want to work with using Preview.app should be located in /Library/Fonts... easy enough! I can move them, but there's one remaining wrinkle. MacOS still doesn't like the font I want to use Hack, but I've got a work around for that too.


1) Install Hack in /Library/Fonts

2) Create `test.ps` as

%!
/Hack-Regular findfont 12 scalefont setfont
100 400 moveto
(Hello! I'm Hack Regular showing up in a PostScript file!) show
showpage

3) Try loading `test.ps` into Preview.app, new error

4) BUT! I have ghostscript (gs -v 9.52) installed and now `ps2pdf` creates a pdf that Preview.app happily opens with the correct font.


So, I can package this up as a script for a work around, no problem, but the moral of the story seems twofold:

  1. The current font management is a little delicate. Sometimes putting fonts in the standard location (/Library/Font) helps.
  2. Sometimes that's not enough, but in the absence of an Apple solution, ghostscript can bridge the gap.



Here's the script that solves my problem `print-preview.sh`

#!/bin/sh
PREVIEW_FILE=$(gmktemp --suffix=.ps)
cat >"$PREVIEW_FILE" && ps2pdf "$PREVIEW_FILE" "$PREVIEW_FILE.pdf" && \
    open "$PREVIEW_FILE.pdf" || \
      echo 'Print preview failed'


Jun 21, 2020 1:28 PM in response to VikingOSX

This seems like a step in the right direction, thank you! But, I had a few questions. Using these references, I found documentation for Quartz's PostScript converter, `GCPSConverter`, but I can't find PSNormalizer. Do you know where documentation might be?


I'm worried that if there's a problem with `GCPSConverter` it's a bit hopeless: the documentation from 2004 (!) says that it's an opaque type. And, there's no obvious way to correct the path where it looks for fonts. Do you know much about the font system? Maybe it's silently querying an older interface that was updated in Catalina? I think your "not aware of Apple's introduction of the Supplemental font location" seems promising!


I can't get this to work with user fonts either on Catalina. Can you?


References:


https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_ps_convert/dq_ps_convert.html#//apple_ref/doc/uid/TP30001066-CH215-TPXREF101


http://mirror.informatimago.com/next/developer.apple.com/documentation/GraphicsImaging/Reference/CGPSConverter/CGPSConverter.pdf

Jun 21, 2020 5:33 AM in response to cacology

In Mojave, the AmericanTypeWriter font is installed in /Library/Fonts, a normal font searching location by the operating system. On Catalina, and I am looking at Catalina 10.15.5, the AmericanTypeWriter font has been moved to /System/Library/Fonts/Supplemental folder. It is a TrueType container (ttc), and is the same version on both operating systems.


When I open the PS in Preview on Mojave, the text appears to be the specified font. On inspection of the PDF, it is still using the AmericanTypewriter-Light font reference with a /WinAnsiEncoding via Apple's PSNormalizer.framework. The PS becomes a PDF-1.3 version PDF. Here is what Adobe Acrobat Reader DC sees in its properties:




Now, let's take a look at Catalina 10.15.5. Identical PS file opened and converted in Preview appears different than how it appears on Mojave. On Catalina, this is also a v1.3 PDF. What is different is that on Mojave, the only producer was the PSNormalizer.framework that converts PS to PDF. This is also true on Catalina, and then for some reason, the PDF is further post-processed by the Apple Quartz PDF Context in append mode — after PSNormalizer is used. This may explain the visual difference in the rendered font on Catalina. There is nothing in the PDF referencing any other font than AmericanTypewriter-Light.


If one opens the PDF on Catalina with the current (20.009.20067) Adobe Acrobat Reader DC, one can see in the Font properties that Reader saw the request for AmericanTypewriter-Light, but used the built-in Type 1 PS multiple-master Adobe font to simulate AmericanTypewriter-Light font metrics — because it likely was not aware of Apple's introduction of the Supplemental font location, and could not find the font. Looks pretty close too.



I have Ghostscript v9.52 installed on both operating systems and there was no reference to it in either PDF produced by Preview. It is simply ignored by the old PDFKit and PSNormalizer frameworks.


Many fonts invisible for Preview.app rendering PostScript

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.