~ubuntu-branches/ubuntu/intrepid/ghostscript/intrepid-updates

« back to all changes in this revision

Viewing changes to examples/cjk/all_aj1.ps

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2007-08-13 21:49:58 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070813214958-ro9nbb3fmvzlr7q3
Tags: 8.61.dfsg.1~svn8187-0ubuntu1
New upstream release
o SVN snapshot rev 8187
o CJK patches from Koji Otani to fix several issues with CJK text
(should fix http://bugs.ghostscript.com/show_bug.cgi?id=689304).
These patches were also applied to ESP Ghostscript and having them
in Gutsy's GPL GS will avoide regressions against Feisty's ESP GS.
o Minor bug fixes from upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%!PS-Adobe-3.0
 
2
%%Title: Adobe-Japan1 CID-Keyed Fonts Character List
 
3
%%Creator: Taiji Yamada <taiji@aihara.co.jp> and gs-cjk project
 
4
%%Copyright: (C) 2001 Taiji Yamada and gs-cjk project
 
5
%%+ This script is part of GNU Ghostscript and is distributed under
 
6
%%+ the terms of the GNU General Public License. See the file COPYING
 
7
%%+ for more information.
 
8
%%Version: 1.0
 
9
%
 
10
% Usage:
 
11
%   gs [-sF=WadaMin-Regular] [-daffix [-sAF=HeiseiMin-W3]] \
 
12
%      [-dglyphshow- [-sI=Identity-H]] [-ddescent=200] all_aj1.ps
 
13
%
 
14
%%DocumentMedia: A4 595 842 0 white ()
 
15
%%EndComments
 
16
%%BeginProlog
 
17
 
 
18
/*gs-cjk (\
 
19
------------------------------------------------------------------------\n\
 
20
This is a script to test CJK fonts such as CID-keyed fonts.\n\
 
21
If you have not done CID-keyed fonts installation and definitions at\n\
 
22
/Resource/CMap and CIDFnmap or /Resource/CIDFont of ghostscript, then\n\
 
23
this script can't work correctly.\n\
 
24
For details, please see README at http://www.gyve.org/gs-cjk/supplement.\n\
 
25
 
 
26
If you throw this script into a printer, it requires PostScript 3\n\
 
27
printer and CID-keyed fonts specified in this script.\n\
 
28
------------------------------------------------------------------------\n) def
 
29
 
 
30
/notice*stdout 4 dict begin
 
31
  /*open {} def /*echo-n { =only } def /*echo { = } def /*close { flush } def
 
32
  currentdict
 
33
end def
 
34
 
 
35
/notice*page 5 dict begin
 
36
  /*y 750 def
 
37
  /*open {
 
38
    gsave initmatrix /Courier findfont 11 scalefont setfont 50 *y moveto
 
39
    *y 750 eq {
 
40
      *gs-cjk { (\n) search { *echo } { *echo-n exit } ifelse pop } loop
 
41
    } if
 
42
  } def
 
43
  /*echo-n { dup type /stringtype ne { dup length string cvs } if show } def
 
44
  /*echo { *echo-n /*y *y 11 sub def 50 *y moveto } def
 
45
  /*close { grestore } def
 
46
  currentdict
 
47
end def
 
48
 
 
49
/greeting*gs-cjk {
 
50
  product (Ghostscript) search not { pop } { pop pop pop QUIET not {
 
51
    notice*stdout begin
 
52
      *open
 
53
      *gs-cjk { (\n) search { *echo } { *echo-n exit } ifelse pop } loop
 
54
      *close
 
55
    end
 
56
  } if } ifelse
 
57
} bind def
 
58
greeting*gs-cjk
 
59
 
 
60
/*findfont {
 
61
  dup /Font resourcestatus { pop pop findfont } {
 
62
    notice*page begin
 
63
      *open
 
64
      (Error in findfont: ) *echo-n dup *echo
 
65
      *close
 
66
    end
 
67
    findfont
 
68
  } ifelse
 
69
} bind def
 
70
 
 
71
/*CIDFont*findresource {
 
72
  dup /CIDFont resourcestatus { pop pop /CIDFont findresource } {
 
73
    notice*page begin
 
74
      *open
 
75
      (Error in /CIDFont findresource: ) *echo-n dup *echo
 
76
      *close
 
77
    end
 
78
    /CIDFont findresource
 
79
  } ifelse
 
80
} bind def
 
81
 
 
82
/orighandleerror errordict /handleerror get def
 
83
errordict begin
 
84
  /handleerror {
 
85
    notice*page begin errordict begin $error begin
 
86
      *open
 
87
      (Error of ) *echo-n errorname dup length string cvs *echo
 
88
      *close
 
89
      showpage
 
90
    end end end
 
91
    orighandleerror
 
92
  } bind def
 
93
end
 
94
 
 
95
/title (Adobe-Japan1 CID-Keyed Fonts Character List) def
 
96
/PW 595 def
 
97
/PH 842 def
 
98
/LM 78 def
 
99
/TM 130 def
 
100
/RM 47 def
 
101
/BM 76 def
 
102
/NH 10 def
 
103
/NV 12 def
 
104
/RW PW LM RM add sub NH div def
 
105
/RH PH TM BM add sub NV div def
 
106
/FS RW 3 mul 4 div def
 
107
/AFS RW 1 mul 4 div def
 
108
/unknowndef { exch dup where { pop pop pop } { exch def } ifelse } bind def
 
109
/F (HeiseiKakuGo-W5) unknowndef
 
110
/affix false unknowndef
 
111
/AF (HeiseiMin-W3) unknowndef
 
112
/descent 130 unknowndef
 
113
/glyphshow- false unknowndef
 
114
/fss { exch *CIDFont*findresource exch scalefont setfont } bind def
 
115
/concats { % [str ...] concats str
 
116
  () exch dup length 1 sub -1 0 {
 
117
    1 index exch get dup type /stringtype ne { dup length string cvs } if
 
118
    3 -1 roll exch dup length 2 index length add string
 
119
    dup dup 4 2 roll copy length 4 -1 roll putinterval exch
 
120
  } for pop
 
121
} bind def
 
122
/composefontname { % font cmap composefontname font--cmap
 
123
  [ 2 index (--) 3 index ] concats dup 3 -1 roll [ 5 -1 roll ] composefont pop
 
124
} bind def
 
125
glyphshow- {
 
126
  /I (Identity-H) unknowndef
 
127
  /F F I composefontname def
 
128
  affix { /AF AF I composefontname def } if
 
129
  /fss { exch *findfont exch scalefont setfont } bind def
 
130
  /s 2 string def
 
131
} if
 
132
/glyphframe { % h oldx glyphframe -
 
133
  gsave 0 setlinewidth
 
134
  currentpoint pop sub exch dup 0 exch descent mul 1000 div neg rmoveto
 
135
  currentpoint 4 -2 roll rectstroke grestore
 
136
} bind def
 
137
/box { % llx lly urx ury box -
 
138
  3 index 3 index moveto exch 4 -1 roll sub 3 1 roll exch sub
 
139
  currentpoint 4 -2 roll rectstroke
 
140
} bind def
 
141
/charframe { % h string charframe -
 
142
  gsave 0 setlinewidth
 
143
  stringwidth pop exch dup 0 exch descent mul 1000 div neg rmoveto
 
144
  currentpoint 4 -2 roll rectstroke grestore
 
145
} bind def
 
146
/pathframe { % string pathframe -
 
147
  gsave 0 setlinewidth
 
148
  true charpath flattenpath pathbbox box grestore
 
149
} bind def
 
150
/np {
 
151
  /Helvetica findfont 11 scalefont setfont
 
152
  LM BM 11 2 mul sub moveto title show ( - ) show F show
 
153
  affix {
 
154
    gsave /Helvetica findfont 5 scalefont setfont ( and ) show AF show grestore
 
155
  } if
 
156
  PW RM sub BM 11 2 mul sub moveto p 3 string cvs show
 
157
  /p p 1 add def
 
158
  showpage
 
159
  /x LM def
 
160
  /y PH TM sub def
 
161
} bind def
 
162
/nb {
 
163
  /x x RW add def
 
164
  x PW RM sub ge {
 
165
    /x LM def
 
166
    /y y RH sub def
 
167
    y BM le {
 
168
      np
 
169
      /y PH TM sub def
 
170
    } if
 
171
  } if
 
172
} bind def
 
173
%%EndProlog
 
174
/x LM def
 
175
/y PH TM sub def
 
176
/p 1 def
 
177
[
 
178
  [0 8283]      % Adobe-Japan1-0
 
179
  [8284 8358]   % Adobe-Japan1-1
 
180
  [8359 8719]   % Adobe-Japan1-2
 
181
  [8720 9353]   % Adobe-Japan1-3
 
182
  [9354 15443]  % Adobe-Japan1-4
 
183
] {
 
184
  cvx exec 1 exch {
 
185
    /id exch def
 
186
    F FS fss
 
187
    x y FS sub moveto
 
188
    glyphshow- not {
 
189
      id glyphshow
 
190
      FS x glyphframe
 
191
    } {
 
192
      s 0 id 256 idiv put s 1 id 256 mod put
 
193
      FS s charframe
 
194
      s pathframe
 
195
      s show
 
196
    } ifelse
 
197
    affix {
 
198
      AF AFS fss
 
199
      x FS add y FS sub moveto
 
200
      glyphshow- not {
 
201
        id glyphshow
 
202
        AFS x FS add glyphframe
 
203
      } {
 
204
        AFS s charframe
 
205
        s pathframe
 
206
        s show
 
207
      } ifelse
 
208
    } if
 
209
    %
 
210
    /Times-Roman findfont 7 scalefont setfont
 
211
    x y FS sub FS descent mul 1000 div sub 7 sub moveto
 
212
    id 5 string cvs show
 
213
    nb
 
214
  } for
 
215
  np
 
216
} forall
 
217
%%Trailer
 
218
%%EOF