summaryrefslogtreecommitdiff
path: root/toolbin/genfontmap.ps
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2013-07-23 16:24:19 +0100
committerChris Liddell <chris.liddell@artifex.com>2015-07-20 18:21:17 +0100
commit6948650efd3fb9e2a70b8cf16aca57e9d0b7eb0a (patch)
tree5c2a1c671c1d4521f8a770d1e69e3d4342718030 /toolbin/genfontmap.ps
parent7fd9e0be26e67c36f87733bc89ea07dc26d9f839 (diff)
downloadghostpdl-6948650efd3fb9e2a70b8cf16aca57e9d0b7eb0a.tar.gz
Commit of build_consolidation branch
Squashed into one commit (see branch for details of the evolution of the branch). This brings gpcl6 and gxps into the Ghostscript build system, and a shared set of graphics library object files for all the interpreters. Also, brings the same configuration options to the pcl and xps products as we have for Ghostscript.
Diffstat (limited to 'toolbin/genfontmap.ps')
-rw-r--r--toolbin/genfontmap.ps68
1 files changed, 68 insertions, 0 deletions
diff --git a/toolbin/genfontmap.ps b/toolbin/genfontmap.ps
new file mode 100644
index 000000000..f1d7ab170
--- /dev/null
+++ b/toolbin/genfontmap.ps
@@ -0,0 +1,68 @@
+%!PS
+% Copyright (C) 2001-2012 Artifex Software, Inc.
+% All Rights Reserved.
+%
+% This software is provided AS-IS with no warranty, either express or
+% implied.
+%
+% This software is distributed under license and may not be copied,
+% modified or distributed except as expressly authorized under the terms
+% of the license contained in the file LICENSE in this distribution.
+%
+% Refer to licensing information at http://www.artifex.com or contact
+% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
+% CA 94903, U.S.A., +1(415)492-9861, for further information.
+%
+
+% Create a Fontmap format file after scanning the FONTPATH directories
+%
+% Example usage:
+% windows: gswin32c -q -sFONTPATH=c:/windows/fonts genfontmap.ps > myFontmap
+%
+% unix: gs -q -sFONTPATH=/usr/local/fonts genfontmap.ps > myFontmap
+%
+% The myFontmap file created by the above can be renamed to Fontmap and
+% placed in the LIBPATH directory.
+
+/=error { (%stderr) (w) file exch writestring } def
+
+% First make sure there is a FONTPATH defined
+FONTPATH length 0 eq {
+ (\n Specify a FONTPATH using -sFONTPATH or GS_FONTPATH in order to\n) =error
+ ( generate a Fontmap file from the fonts found in those folders.\n\n) =error
+ flush quit
+} if
+
+QUIET not {
+ (\n You must use the '-q' option in order to generate a clean Fontmap.\n\n) =error
+ flush quit
+} if
+
+% -------------------------------------------------------------------------
+
+/Initial_count Fontmap length def
+
+( ) cvn findfont pop % force the scan
+
+% Create an array so we can sort it
+
+Fontmap { [ 3 1 roll ] } forall
+count array astore
+
+% sort the array
+{ 0 get 100 string cvs exch 0 get 100 string cvs gt } .sort
+
+% Now print it out in Fontmap format
+(% This Fontmap generated by genfontmap.ps\n) =
+{
+ dup 0 get % get the name of the font
+ % Since the name might be Unicode, write it as a string
+ 100 string cvs ==only
+ ( ) print 1 get 0 get ==only ( ;) =
+} forall
+flush
+
+(\ngenfontmap completed OK. ) =error
+Fontmap length Initial_count sub 10 string cvs =error
+( new fonts added.\n\n) =error
+quit