1 : |
ktanaka |
1.1 |
(defun jis3ps (kustr psfile) |
2 : |
|
|
(lets ((standard-output (outopen (stream psfile))) |
3 : |
|
|
(tag 'mincho-patch)(col 12)(line 8) |
4 : |
|
|
(scale (fix (times 160.0 (max (//$ 9.0 (float col)) |
5 : |
|
|
(//$ 6.0 (float line)))))) |
6 : |
|
|
(i nil)(j nil)(page nil)(last nil)(outlines) |
7 : |
|
|
(next nil)(nextnext nil)(x1 nil)(y1 nil)(x2 nil)(y2 nil)(skelton) |
8 : |
|
|
(minchowidth 10.0) |
9 : |
|
|
(tateyokoratio 0.3) |
10 : |
|
|
(hirawidth 0.35) |
11 : |
|
|
(tatekazari 1.8) |
12 : |
|
|
(kazariheight 1.8) |
13 : |
|
|
(tomeheight 2.4) |
14 : |
|
|
(date (date-time))) |
15 : |
|
|
(do ((i 1 (1+ i)) |
16 : |
|
|
(dig2 (make-string 2))) |
17 : |
|
|
((> i 94)(setq outlines (nreverse outlines))) |
18 : |
|
|
(sset dig2 0 (+ 48 (quotient i 10))) |
19 : |
|
|
(sset dig2 1 (+ 48 (remainder i 10))) |
20 : |
|
|
(push (intern (symbol (string-append "1-" kustr "-" dig2))) outlines)) |
21 : |
|
|
(format "%!/n%%BoundingBox: 95 195 /c /c/n" |
22 : |
|
|
(plus 105 (fix (times 0.001 scale (- (* line 500) 100)))) |
23 : |
|
|
(plus 205 (fix (times 0.001 scale (- (* col 500) 100))))) |
24 : |
|
|
(lets ((s (inopen (stream "/home/mari/kanji/lib/psfiles/compfont.ps"))) |
25 : |
|
|
(err:end-of-file #'(lambda (x (y))(throw 'eof)))) |
26 : |
|
|
(catch 'eof (loop (princ (readline s))(terpri)))) |
27 : |
|
|
(format "%!/n50 50 translate/n0.001 /c mul dup scale/n" scale) |
28 : |
|
|
(format "//Helvetica findfont 140 scalefont setfont/n") |
29 : |
|
|
(do ((i 0 (1+ i))) |
30 : |
|
|
((greaterp i 11)) |
31 : |
|
|
(format "-200 /c moveto (/c) show/n" (plus 180 (times i 500)) |
32 : |
|
|
(cond ((lessp i 10) |
33 : |
|
|
(string-append "0" (number-image i))) |
34 : |
|
|
(t i)))) |
35 : |
|
|
(do ((i 1 (1+ i))) |
36 : |
|
|
((greaterp i 7)) |
37 : |
|
|
(format "/c -140 moveto (/c) show/n" |
38 : |
|
|
(plus 160 (times i 500)) (times 12 i))) |
39 : |
|
|
(format "0 -140 moveto (/c) show/n" (string-append "1" kustr)) |
40 : |
|
|
(format "3000 -280 moveto (/c-/c-/c /c:/c) show/n" |
41 : |
|
|
(substring date 0 2) |
42 : |
|
|
(substring date 2 4)(substring date 4 6) |
43 : |
|
|
(substring date 6 8)(substring date 8 10)) |
44 : |
|
|
(format "//Wadalab-mincho-10 CompNF/n") |
45 : |
|
|
(format "//Wadalab-mincho-10 findfont 400 scalefont setfont/n") |
46 : |
|
|
; (break) |
47 : |
|
|
(setq i 1 j 0 page 1) |
48 : |
|
|
(format "0 500 translate/n") |
49 : |
|
|
(do |
50 : |
|
|
((ol outlines (cdr ol)) |
51 : |
|
|
(l nil)) |
52 : |
|
|
((atom ol)) |
53 : |
|
|
(princ ";" terminal-output) |
54 : |
|
|
; (princ (gccount) terminal-output) |
55 : |
|
|
(print (car ol) terminal-output) |
56 : |
|
|
(setq l |
57 : |
|
|
(let ((err:argument-type #'(lambda (x (y))(throw 'err))) |
58 : |
|
|
(err:number-of-arguments #'(lambda (x (y))(throw 'err))) |
59 : |
|
|
(err:unbound-variable #'(lambda (x (y))(throw 'err))) |
60 : |
|
|
(err:undefined-function #'(lambda (x (y))(throw 'err))) |
61 : |
|
|
(err:zero-division #'(lambda (x (y))(throw 'err)))) |
62 : |
|
|
(catch 'err |
63 : |
|
|
(skelton2list (setq skelton (normkanji (rm-limit (applykanji (car ol) tag)))) tag)))) |
64 : |
|
|
(cond |
65 : |
|
|
((atom l) |
66 : |
|
|
(format "0 setlinewidth newpath 0 0 moveto 400 0 lineto/n") |
67 : |
|
|
(format "400 400 lineto 0 400 lineto 0 0 lineto stroke/n")) |
68 : |
|
|
(t |
69 : |
|
|
(format "0 setlinewidth newpath 0 0 moveto 400 0 lineto/n") |
70 : |
|
|
(format "400 400 lineto 0 400 lineto 0 0 lineto stroke/n") |
71 : |
|
|
(setq hints (type1hints skelton tag)) |
72 : |
|
|
(setq type1 (out2type1 l hints)) |
73 : |
|
|
(cond ((and (= 2 (string-length (car ol))) |
74 : |
|
|
(logand 128 (sref (car ol) 0))) |
75 : |
|
|
(setq kstr (long-hex-image |
76 : |
|
|
(plus (logand 127 (sref (car ol) 1)) |
77 : |
|
|
(times 256 (logand 127 (sref (car ol) 0))))))) |
78 : |
|
|
((and (= 7 (string-length (car ol))) |
79 : |
|
|
(string-equal (substring (car ol) 0 2) "1-")) |
80 : |
|
|
(setq kstr |
81 : |
|
|
(long-hex-image |
82 : |
|
|
(plus (logand 127 (plus 32 (number-value (substring (car ol) 5 7)))) |
83 : |
|
|
(times 256 (logand 127 (plus 32 (number-value (substring (car ol) 2 4))))))))) |
84 : |
|
|
(t |
85 : |
|
|
(setq kstr "2121"))) |
86 : |
|
|
(princ type1) |
87 : |
|
|
(format " </c> CompD/n" kstr) |
88 : |
|
|
(format "0 70 moveto </c> show/n" kstr))) |
89 : |
|
|
(setq i (1+ i)) |
90 : |
|
|
(cond ((eq i col) |
91 : |
|
|
(format "500 /c translate/n" (* -500 (1- col))) |
92 : |
|
|
(setq i 0) |
93 : |
|
|
(setq j (1+ j))) |
94 : |
|
|
(t (format "0 500 translate/n")))) |
95 : |
|
|
(format "showpage/n")))) |
96 : |
|
|
(defun jis3-ku (kustr) |
97 : |
|
|
(do ((i 1 (1+ i)) |
98 : |
|
|
(dig2 (make-string 2)) |
99 : |
|
|
(ret)) |
100 : |
|
|
((> i 94)(nreverse ret)) |
101 : |
|
|
(sset dig2 0 (+ 48 (quotient i 10))) |
102 : |
|
|
(sset dig2 1 (+ 48 (remainder i 10))) |
103 : |
|
|
(push (intern (symbol (string-append "1-" kustr "-" dig2))) ret))) |
104 : |
|
|
(defun rec_boundp (l) |
105 : |
|
|
(cond ((symbolp l)(and (boundp l) (rec_boundp (eval l)))) |
106 : |
|
|
((consp l) |
107 : |
|
|
(or (not (symbolp (car l))) |
108 : |
|
|
(do ((ll (cdr l)(cdr ll))) |
109 : |
|
|
((atom ll) t) |
110 : |
|
|
(or (rec_boundp (car ll))(exit nil))))) |
111 : |
|
|
(t))) |
112 : |
|
|
(defun check-ku (kustr) |
113 : |
|
|
(do ((l (jis3-ku kustr) (cdr l))) |
114 : |
|
|
((atom l)) |
115 : |
|
|
(or (rec_boundp (car l))(format ";/c/n" (car l))))) |
116 : |
|
|
|
117 : |
|
|
(defun check-bushu (kustr) |
118 : |
|
|
(do ((l (jis3-ku kustr) (cdr l))(a)) |
119 : |
|
|
((atom l)) |
120 : |
|
|
(and (symbolp (setq a (eval (car l))))(format ";/c,/c/n" (car l) a)))) |
121 : |
|
|
|
122 : |
|
|
(defun makeku (kanjis type filespec dig) |
123 : |
|
|
(lets ((filename (string-append filespec (long-hex-image dig) ".ps"))) |
124 : |
|
|
(format ";/c/n" filename) |
125 : |
|
|
(out-to-ps-all (nreverse kanjis) type filename nil 12 8 nil))) |
126 : |
|
|
(defun jis-ku (ku type filename) |
127 : |
|
|
(do ((j #x21 (1+ j))(ret)(str (make-string 2)(make-string 2))) |
128 : |
|
|
((greaterp j #x7e) |
129 : |
|
|
(out-to-ps-all (nreverse ret) type filename nil 12 8 nil)) |
130 : |
|
|
(sset str 0 (logor #x80 ku))(sset str 1 (logor #x80 j)) |
131 : |
|
|
(push (intern (symbol str)) ret))) |
132 : |
|
|
(defun jis-ku-3 (ku type filename) |
133 : |
|
|
(out-to-ps-all (jis3-ku ku) type filename nil 12 8 nil)) |
134 : |
|
|
(defun makeallkanji (type filespec) |
135 : |
|
|
(lets ((ret)) |
136 : |
|
|
(do ((i #x30 (1+ i))) |
137 : |
|
|
((greaterp i #x4e)) |
138 : |
|
|
(do ((j #x21 (1+ j))(str (make-string 2)(make-string 2))) |
139 : |
|
|
((greaterp j #x7e)(makeku ret type filespec i)(setq ret nil)) |
140 : |
|
|
(sset str 0 (logor #x80 i))(sset str 1 (logor #x80 j)) |
141 : |
|
|
(push (intern (symbol str)) ret))) |
142 : |
|
|
(do ((j #x21 (1+ j))(str (make-string 2)(make-string 2))) |
143 : |
|
|
((greaterp j #x53)(makeku ret type filespec i)(setq ret nil)) |
144 : |
|
|
(sset str 0 (logor #x80 #x4f))(sset str 1 (logor #x80 j)) |
145 : |
|
|
(push (intern (symbol str)) ret)) |
146 : |
|
|
(do ((i #x50 (1+ i))) |
147 : |
|
|
((greaterp i #x73)) |
148 : |
|
|
(do ((j #x21 (1+ j))(str (make-string 2)(make-string 2))) |
149 : |
|
|
((greaterp j #x7e)(makeku ret type filespec i)(setq ret nil)) |
150 : |
|
|
(sset str 0 (logor #x80 i))(sset str 1 (logor #x80 j)) |
151 : |
|
|
(push (intern (symbol str)) ret))) |
152 : |
|
|
(do ((j #x21 (1+ j))(str (make-string 2)(make-string 2))) |
153 : |
|
|
((greaterp j #x24)) |
154 : |
|
|
(sset str 0 (logor #x80 #x74))(sset str 1 (logor #x80 j)) |
155 : |
|
|
(push (intern (symbol str)) ret)) |
156 : |
|
|
(push 'ŁĘŁµ ret) |
157 : |
|
|
(push 'ŁĘŁ¶ ret) |
158 : |
|
|
(makeku ret type filespec i)(setq ret nil))) |
159 : |
|
|
|
160 : |
|
|
(defun makeallkanjitest (type filespec) |
161 : |
|
|
(lets ((ret)) |
162 : |
|
|
(do ((i #x3c (1+ i))) |
163 : |
|
|
((greaterp i #x4e)) |
164 : |
|
|
(do ((j #x21 (1+ j))(str (make-string 2)(make-string 2))) |
165 : |
|
|
((greaterp j #x7e)(makeku ret type filespec i)(setq ret nil)) |
166 : |
|
|
(sset str 0 (logor #x80 i))(sset str 1 (logor #x80 j)) |
167 : |
|
|
(push (intern (symbol str)) ret))) |
168 : |
|
|
(do ((j #x21 (1+ j))(str (make-string 2)(make-string 2))) |
169 : |
|
|
((greaterp j #x53)(makeku ret type filespec i)(setq ret nil)) |
170 : |
|
|
(sset str 0 (logor #x80 #x4f))(sset str 1 (logor #x80 j)) |
171 : |
|
|
(push (intern (symbol str)) ret)) |
172 : |
|
|
(do ((i #x50 (1+ i))) |
173 : |
|
|
((greaterp i #x73)) |
174 : |
|
|
(do ((j #x21 (1+ j))(str (make-string 2)(make-string 2))) |
175 : |
|
|
((greaterp j #x7e)(makeku ret type filespec i)(setq ret nil)) |
176 : |
|
|
(sset str 0 (logor #x80 i))(sset str 1 (logor #x80 j)) |
177 : |
|
|
(push (intern (symbol str)) ret))) |
178 : |
|
|
(do ((j #x21 (1+ j))(str (make-string 2)(make-string 2))) |
179 : |
|
|
((greaterp j #x24)) |
180 : |
|
|
(sset str 0 (logor #x80 #x74))(sset str 1 (logor #x80 j)) |
181 : |
|
|
(push (intern (symbol str)) ret)) |
182 : |
|
|
(push 'ŁĘŁµ ret) |
183 : |
|
|
(push 'ŁĘŁ¶ ret) |
184 : |
|
|
(makeku ret type filespec i)(setq ret nil))) |
185 : |
|
|
(defun makegothku (ku) |
186 : |
|
|
(format "%!/n50 50 translate/n0.001 /c mul dup scale/n" 120) |
187 : |
|
|
(format "//GothicBBB-Medium-H findfont 400 scalefont setfont/n") |
188 : |
|
|
(do ((j #x21 (1+ j)) |
189 : |
|
|
(y 0)) |
190 : |
|
|
((> j #x7e)(format "showpage/n")) |
191 : |
|
|
(format "0 setlinewidth newpath 0 0 moveto 400 0 lineto/n") |
192 : |
|
|
(format "400 400 lineto 0 400 lineto 0 0 lineto stroke/n") |
193 : |
|
|
(format "0 60 moveto </c> show/n" (long-hex-image (+ j (* ku 256)))) |
194 : |
|
|
(setq y (1+ y)) |
195 : |
|
|
(cond ((eq y 12) |
196 : |
|
|
(format "500 /c translate/n" (* -500 11))(setq y 0)) |
197 : |
|
|
(t |
198 : |
|
|
(format "0 500 translate/n"))))) |
199 : |
|
|
(defun makeminku (ku) |
200 : |
|
|
(format "%!/n50 50 translate/n0.001 /c mul dup scale/n" 120) |
201 : |
|
|
(format "//Ryumin-Light-H findfont 400 scalefont setfont/n") |
202 : |
|
|
(do ((j #x21 (1+ j)) |
203 : |
|
|
(y 0)) |
204 : |
|
|
((> j #x7e)(format "showpage/n")) |
205 : |
|
|
(format "0 setlinewidth newpath 0 0 moveto 400 0 lineto/n") |
206 : |
|
|
(format "400 400 lineto 0 400 lineto 0 0 lineto stroke/n") |
207 : |
|
|
(format "0 60 moveto </c> show/n" (long-hex-image (+ j (* ku 256)))) |
208 : |
|
|
(setq y (1+ y)) |
209 : |
|
|
(cond ((eq y 12) |
210 : |
|
|
(format "500 /c translate/n" (* -500 11))(setq y 0)) |
211 : |
|
|
(t |
212 : |
|
|
(format "0 500 translate/n"))))) |