comparison etc/mule/m2ps.ps @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents
children
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
1 %!PS
2 %% PostScript Header for use by m2ps Ver.2.2
3 %% Copyright (C) 1992 Free Software Foundation, Inc.
4 %%
5 %% This file is part of Mule (MULtilingual Enhancement of GNU Emacs).
6 %%
7 %% Mule is free software distributed in the form of patches to GNU Emacs.
8 %% You can redistribute it and/or modify
9 %% it under the terms of the GNU General Public License as published by
10 %% the Free Software Foundation; either version 1, or (at your option)
11 %% any later version.
12 %%
13 %% Mule is distributed in the hope that it will be useful,
14 %% but WITHOUT ANY WARRANTY; without even the implied warranty of
15 %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 %% GNU General Public License for more details.
17 %%
18 %% You should have received a copy of the GNU General Public License
19 %% along with GNU Emacs; see the file COPYING. If not, write to
20 %% the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21 %%
22 %% 92.10.8 written by K.Handa <handa@etl.go.jp>
23 %% 92.12.15 modified by K.Handa <handa@etl.go.jp>
24 %% Support composite character.
25
26 /Mydict 200 dict def % define a working dictionary
27 Mydict begin % start using it.
28
29 %%%% Font Manipulation
30
31 /imagemaskmatrix [0 0 0 0 0 0] def
32
33 /BuildGlyphDefault { % fontdict charname BuildGlyphDefault -
34 0 begin
35 1 index /CharData get exch get /ch exch def
36 /FontSize get /fs exch def
37 ch 0 get fs div 0 ch 1 4 getinterval { fs div } forall setcachedevice
38 ch 5 get ch 6 get 2 copy
39 0 gt exch 0 gt and {
40 true
41 imagemaskmatrix
42 dup 0 fs put dup 3 fs neg put
43 dup 4 ch 7 get put dup 5 ch 8 get put
44 ch 9 1 getinterval cvx
45 imagemask
46 } {
47 pop pop
48 } ifelse
49 end
50 } bind def
51
52 /BuildGlyphNoCache { % fontdict charname BuildGlyphNoCache -
53 0 begin
54 1 index /CharData get exch get /ch exch def
55 /FontSize get /fs exch def
56 ch 0 get fs div 0 setcharwidth
57 ch 5 get ch 6 get 2 copy
58 0 gt exch 0 gt and {
59 true
60 imagemaskmatrix
61 dup 0 fs put dup 3 fs neg put
62 dup 4 ch 7 get put dup 5 ch 8 get put
63 ch 9 1 getinterval cvx
64 imagemask
65 } {
66 pop pop
67 } ifelse
68 end
69 } bind def
70
71 /BuildGlyphDefault load 0 6 dict put
72 /BuildGlyphNoCache load 0 6 dict put
73
74 /work 4 string def
75
76 /nf { % font fontname fsize bbox rel cache nf - % NEWFONT
77 13 dict begin
78 /FontType 3 def
79 %ifelse
80 { /BuildGlyph { BuildGlyphDefault } def }
81 { /BuildGlyph { BuildGlyphNoCache } def }
82 ifelse
83 /Relative exch def
84 /FontBBox exch def
85 /FontSize exch def
86 /FontMatrix [1 0 0 1 0 0] def
87 /Encoding 256 array %def
88 dup 0 1 255 {
89 dup (XXX) cvs
90 (CXXX) work copy pop
91 work exch 1 exch putinterval
92 work cvn
93 put dup
94 } for pop
95 def
96 /CharData 256 dict def
97 /BuildChar {
98 1 index /Encoding get exch get
99 1 index /BuildGlyph get exec
100 } def
101 dup currentdict
102 end
103 definefont pop
104 findfont FontScale scalefont def
105 } bind def
106
107 /g { % charname chardata g - % NEWGLYPH
108 currentfont begin
109 CharData begin def end
110 end
111 } bind def
112
113 /f { % font f - % SETFONT
114 setfont
115 } bind def
116
117 %%%% Page Control
118 /bp { % - bp - % BEGIN OF PAGE
119 ShortMemory { save /SaveImage exch def } if
120 erasepage
121 /y TopMargin def
122 LeftMargin y moveto
123 } bind def
124
125 /ep { % - ep - % END OF PAGE
126 copypage
127 ShortMemory { SaveImage restore } if
128 } bind def
129
130 %%%% Miscellaneous Routines for reducing traffic
131
132 /r { % x r - % MOVE RIGHT
133 0 rmoveto
134 } bind def
135
136 /n { % - n - % NEWLINE
137 /y y LinePitch sub def LeftMargin y moveto
138 } bind def
139
140 /s { % string s - % SHOW STRING
141 show
142 } bind def
143
144 /cs1 { % string cs1 - % SHOW COMP-CHAR
145 dup 0 get /ch exch def
146 currentfont /CharData get currentfont /Encoding get ch get get
147 dup 2 get /lly exch def
148 4 get /ury exch def
149 currentfont /Relative get /rel exch def
150 ury rel lt { /ury rel def } if
151 lly 0 gt { /lly 0 def } if
152 currentpoint /yy exch def /xx exch def
153 show
154 } bind def
155
156 /cs2 { % string cs2 - % SHOW COMP-CHAR
157 gsave
158 dup 0 get /ch exch def
159 currentfont /FontSize get /fs exch def
160 currentfont /CharData get currentfont /Encoding get ch get get
161 dup 2 get /llyy exch def
162 4 get /uryy exch def
163 xx yy moveto
164 llyy rel ge {
165 0 ury llyy sub 1 add fs div FontScale mul rmoveto
166 /ury ury llyy sub uryy add 1 add def
167 } { uryy 0 le {
168 0 lly uryy sub 1 sub fs div FontScale mul rmoveto
169 /lly lly uryy sub llyy add 1 sub def
170 } {
171 uryy ury gt { /ury uryy def } if
172 llyy lly lt { /lly llyy def } if
173 } ifelse } ifelse
174 show
175 grestore
176 } bind def
177
178 /cs3 { % string cs3 - % SHOW COMP-CHAR
179 gsave
180 xx yy moveto show
181 grestore
182 } bind def
183
184 end % end of Mydict