8

In Ghostscript, on a windows xp pc with an inkjet printer, how can I see a sample of the fonts available on my system? I need to know what they are called to invoke them, and it would be useful to know what substitutions are made.

Kurt Pfeifle
  • 12,411
  • 2
  • 54
  • 71
Harry Weston
  • 217
  • 2
  • 8
  • 1
    Those 4 folks who voted to move the question to stackoverflow clearly had no clue about this question being PostScript related, or had no clue about PostScript's nature as a Turing-complete programming language.... :-( – Kurt Pfeifle Jan 18 '12 at 18:41

2 Answers2

9

(*) {==} 256 string /Font resourceforall will pipe a list of all the fonts available to stdout.

Instead of a simple {==} for the proc argument to resourceforall you could supply a more complex routine to print a page of output using the font. Eg:

%!
(*) {cvn findfont 20 scalefont setfont
10 10 moveto (ABCDEFGHIJKLMNOPQRSTUVWXYZ) show showpage}
256 string /Font resourceforall

Or even:

%!
(*) {dup cvn findfont 20 scalefont setfont
10 100 moveto show 
10 10 moveto (ABCDEFGHIJKLMNOPQRSTUVWXYZ) show showpage}
256 string /Font resourceforall

You can make it as pretty as you like, or until you get bored.....

Kurt Pfeifle
  • 12,411
  • 2
  • 54
  • 71
KenS
  • 306
  • 3
  • 5
  • how can one use this answer, by calling `gs`? – Ant6n Oct 10 '16 at 07:00
  • 2
    @Ant6n yes, just call `gs -c '(*) {==} 256 string /Font resourceforall'` or save the above codes into a ps file and run `gs file.ps` – kralyk Jan 08 '19 at 14:19
  • or `gs -q -dNODISPLAY -dBATCH -c '(*) {cvn ==} 256 string /Font resourceforall'` if you want the clean list of names to stdout – scruss Jul 09 '22 at 18:26
3

It is there in the book I am using, to learn from and as a reference: "Postscript by Example" by Henry McGilpin and Mary Campione, Addison Wesley, 1992; ISBN 0-201-63228-4, Chapter 14 page 553, which has a dozen or so pages, 6 plus programs, on this very subject.

I got a download of the programs from the site and the file labelled "FONTS6.PS" is exactly what I want.

Simon Sheehan
  • 9,114
  • 12
  • 52
  • 71
Harry Weston
  • 217
  • 2
  • 8
  • The site link is long gone, but the Internet Archive has a mirror with downloadable files: [Download PostScript Code Archives](https://web.archive.org/web/20150121062930/http://www.trilithon.com/pagesproducts/postscriptcode.html). The example (named `PostDisk/14_9to5/fonts6.ps` in the Unix archive) typesets the font names in two unsorted columns, perhaps too narrow for modern long font names – scruss Jul 09 '22 at 18:04