Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
You could use fontforge to covert for example your TrueType or OpenType screen fonts to an
Adobe Type1 font and embed in your PostScript
Copy link to clipboard
Copied
You must, it seems to me, do one of the following:
- confine yourself to the base 14 fonts
- make a printer-specific EPS, using printer specific info (PPD) to get a list of fonts; use only these [not recommended, a printer specific EPS is going to really confuse]
- embed all fonts that you use
The fonts must be converted to PostScript form, which is a project many times the size of everything else you are doing I imagine, to support all font types. Converting type 1 (PFB) fonts is not hard, but it is a conversion process and does require some conversion based on knowledge of the PFB format. Alternatively use a library to do the font conversion. The OS doesn't provide a service to do it, unless you generate the EPS through printer escapes and GDI.
Copy link to clipboard
Copied
Actually, another possibility may occur: to outline the text, because the OS will return outlines. Bad idea, poor quality EPS, makes terrible PDFs (a key requirement for many).
Copy link to clipboard
Copied
less work, more happy... Embedding is probably something I don't want to take on right now.
As I mentioned at some point, I do already outline the text for CJK characters - essentially any character out of the ASCII range. It would be easy to do this for everything. I was hoping to preserve some measure of editablility.
Thanks very much for your input.
Copy link to clipboard
Copied
You might find the September 2002 issue (#19) of the Acumen Journal handy. It has an article ("Converting PFB Files to PostScript") that describes the use of Type 1 pfb files in PostScript; it includes a description of the pfb file format and even supplies and steps through ANSI C code that does the conversion.
The Journal is free for the downloading at
www.acumentraining.com/acumenjournal.html
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more