Skip to main content
Participant
August 13, 2013
Question

Which fonts work in postscript files?

  • August 13, 2013
  • 1 reply
  • 4098 views

I think this must be pretty basic stuff, but an area of confusion for me…

On a W7 system I have many fonts.  Some are .ttf, some .ttc, some .otf.  I need to generate a PS file with text in it.  Let's say that onscreen I create a text area and I choose Arial.  Using various system calls and parsing font files, etc. I can find the Postscript name, ArialMT.  So, I write my PS file as follows (greatly simplified):

/ArialMT findfont  

24 scalefont

setfont         

newpath

0 640 moveto

(ABCDEFGHIJKLMNOPQRSTUVWXYZ) show

%%EOF

However, if I choose Taz font onscreen and find the Postscript name Taz, when I write this file the output is rendered using Courier (default) font.

/Taz findfont  

24 scalefont

setfont         

newpath

0 640 moveto

(ABCDEFGHIJKLMNOPQRSTUVWXYZ) show

%%EOF

My question:  how can I tell (from font file info or something) that Arial will work, but Taz won't?  That is, I can get PostScript names for many fonts, but few work in my PS file, so how do I know or determine which ones can be used?   

I understand that I can re-encode and embed fonts in the file.  That is a topic for another thread.

I also understand that I can put font outlines in the file, which precludes editing.  This something I would do if I knew the chosen font would not work.

Thanks for any help.

This topic has been closed for replies.

1 reply

Participating Frequently
August 14, 2013

The below will print all the fonts:

%!

/x 72 def

/y 738 def

/fs 10 def

/Helvetica fs selectfont

(*) {x y moveto show /y y fs sub def y 36 lt {showpage /y 738 def}if} 256 string /Font resourceforall

showpage

Legend
August 14, 2013

I'm assume you're making a PS file to send to a printer. In this case the answer is: the list of fonts in the printer are those that came with it. Refer to the printer's documentation. There are 14 fonts likely to be found in all printers (Helvetica, Times, Courier families and Symbol with ZapfDingbats). Many fonts have a standard 35 set. You can get the list with the code posted of course, but it may include some rather strange aliases and internal fonts.

Participant
August 14, 2013

Hi Abeddie & Test (or do you go by your middle name?), 

Thanks, the PS code helps a bit, but not quite what I'm looking for. 

I have a Win32 app.  The user picks the font to display text onscreen and then may wish to export it.   Among other types, I generate PS output (actually an EPS file).  The target is not necessarliy a printer.  The application generates graphics as well as text and many users export as EPS for inclusion in other documents. I would like to be able to alert the user if the font he has chosen for onscreen display cannot be used in the PS output.  Is there a way to do that?

Perhaps a bit simplistic and maybe I'm going about this all wrong.  I already put font outlines into the file for CJK text.  But for other charsets I would like the files to be editable.  Should I just bite the bullet and learn how to embed fonts?  Any pointers on that?

Thanks!