Subversion Repositories planix.SVN

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
%    Copyright (C) 1990, 1992, 1997, 1999 Aladdin Enterprises.  All rights reserved.
2
% 
3
% This software is provided AS-IS with no warranty, either express or
4
% implied.
5
% 
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.
9
% 
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.
15
 
16
% $Id: pcharstr.ps,v 1.4 2002/02/21 21:49:28 giles Exp $
17
% pcharstr.ps
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.
21
 
22
% Load the Type 1 utilities.
23
(type1ops.ps) runlibfile
24
 
25
% Define the printing procedures for PostScript-like output.
26
/pcs_ps_dict mark
27
  /, {( ) print}
28
  /charname {==only}
29
  /csbegin {}
30
  /beginchars {(%---------------- CharStrings\n) print}
31
  /charbegin {==only}
32
  /char1 {( ) print ==only}
33
  /endchars {}
34
  /beginsubrs {(%---------------- Subrs\n) print}
35
  /subrbegin {=only}
36
  /endsubrs {}
37
  /beginboxes {(%---------------- Encoding & metrics\n) print}
38
  /notdefbox {}
39
  /boxbegin {=only ( ) print}
40
  /boxend {(\n) print}
41
  /endboxes {(%----------------\n) print}
42
.dicttomark readonly def
43
 
44
% Define the printing procedures for C-like output.
45
/pcs_c_dict mark
46
  /, {(, ) print}
47
  /charname {(") print =only (") print}
48
  /csbegin {counttomark =only ,}
49
  /beginchars {(\nconstdata int CSCharData[] = {\n) print}
50
  /charbegin {pop}
51
  /char1 {=only ,}
52
  /endchars {
53
    (-1\n};\nconstdata char *CSCharNames[] = {\n) print
54
    CharStrings {pop charname ,} forall (0\n};\n) print
55
  }
56
  /beginsubrs {(\nconstdata int CSSubrs[] = {\n) print}
57
  /subrbegin {pop}
58
  /endsubrs {(-1\n};\n) print}
59
  /beginboxes {(\nconstdata type1_box CSboxes[] = {\n) print}
60
  /notdefbox {(  {""},\n) print}
61
  /boxbegin {pop (  {) print}
62
  /boxend {(},) =}
63
  /endboxes {(  {0}\n};\n) print}
64
.dicttomark readonly def
65
 
66
/printcs
67
 { dup type /stringtype eq
68
    { printcs1 (\n) print }
69
    { ( ) print == }
70
   ifelse
71
 } bind def
72
/printcs1
73
 { save exch
74
   lenIV 0 ge {
75
     4330 exch dup length string .type1decrypt exch pop
76
     dup length lenIV sub lenIV exch getinterval
77
   } if
78
 
79
   mark exch charstack_read csbegin
80
   counttomark 1 sub -1 0 { index char1 } for
81
   cleartomark restore
82
 } bind def
83
 
84
/printfont
85
 { pcs_ps_dict
86
   /CSFormat where { pop CSFormat /C eq { pop pcs_c_dict } if } if
87
   begin
88
   currentfont begin Private begin 10 dict begin
89
 
90
	% Print the CharStrings and Subrs
91
 
92
   beginchars
93
   CharStrings { exch charbegin printcs } forall
94
   endchars
95
   /Subrs where
96
    { pop	% the dictionary
97
      beginsubrs
98
 
99
       { dup subrbegin
100
         Subrs exch get printcs
101
       } for
102
      endsubrs
103
    } if
104
 
105
	% Print the bounding boxes
106
 
107
   gsave nulldevice FontMatrix matrix invertmatrix concat
108
   beginboxes
109
 
110
    { dup Encoding exch get dup /.notdef eq
111
       { pop pop notdefbox
112
       }
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
118
         boxend
119
       }
120
      ifelse
121
    } for
122
   endboxes
123
   grestore
124
 
125
   end end end end
126
 } bind def