1 % Copyright (C) 1990, 1992, 1997, 1999 Aladdin Enterprises. All rights reserved.
3 % This software is provided AS-IS with no warranty, either express or
6 % This software is distributed under license and may not be copied,
7 % modified or distributed except as expressly authorized under the terms
8 % of the license contained in the file LICENSE in this distribution.
10 % For more information about licensing, please refer to
11 % http://www.ghostscript.com/licensing/. For information on
12 % commercial licensing, go to http://www.artifex.com/licensing/ or
13 % contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14 % San Rafael, CA 94903, U.S.A., +1(415)492-9861.
16 % $Id: pcharstr.ps,v 1.4 2002/02/21 21:49:28 giles Exp $
18 % Print the CharStrings and Subrs (if present) from a Type 1 font,
19 % in either a PostScript-like or a C-compatible form,
20 % depending on whether CSFormat is defined as /PS or /C.
22 % Load the Type 1 utilities.
23 (type1ops.ps) runlibfile
25 % Define the printing procedures for PostScript-like output.
30 /beginchars {(%---------------- CharStrings\n) print}
32 /char1 {( ) print ==only}
34 /beginsubrs {(%---------------- Subrs\n) print}
37 /beginboxes {(%---------------- Encoding & metrics\n) print}
39 /boxbegin {=only ( ) print}
41 /endboxes {(%----------------\n) print}
42 .dicttomark readonly def
44 % Define the printing procedures for C-like output.
47 /charname {(") print =only (") print}
48 /csbegin {counttomark =only ,}
49 /beginchars {(\nconstdata int CSCharData[] = {\n) print}
53 (-1\n};\nconstdata char *CSCharNames[] = {\n) print
54 CharStrings {pop charname ,} forall (0\n};\n) print
56 /beginsubrs {(\nconstdata int CSSubrs[] = {\n) print}
58 /endsubrs {(-1\n};\n) print}
59 /beginboxes {(\nconstdata type1_box CSboxes[] = {\n) print}
60 /notdefbox {( {""},\n) print}
61 /boxbegin {pop ( {) print}
63 /endboxes {( {0}\n};\n) print}
64 .dicttomark readonly def
67 { dup type /stringtype eq
68 { printcs1 (\n) print }
75 4330 exch dup length string .type1decrypt exch pop
76 dup length lenIV sub lenIV exch getinterval
78 0 () /SubFileDecode filter
79 mark exch charstack_read csbegin
80 counttomark 1 sub -1 0 { index char1 } for
86 /CSFormat where { pop CSFormat /C eq { pop pcs_c_dict } if } if
88 currentfont begin Private begin 10 dict begin
90 % Print the CharStrings and Subrs
93 CharStrings { exch charbegin printcs } forall
96 { pop % the dictionary
98 0 1 Subrs length 1 sub
100 Subrs exch get printcs
105 % Print the bounding boxes
107 gsave nulldevice FontMatrix matrix invertmatrix concat
109 0 1 Encoding length 1 sub
110 { dup Encoding exch get dup /.notdef eq
113 { 1 index boxbegin charname ,
114 ( ) dup 0 4 -1 roll put
115 newpath 0 0 moveto false charpath
116 pathbbox ({) print 4 -1 roll =only ,
117 3 -1 roll =only , exch =only , =only (}) print