星火微课系统客户端
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. % Copyright (C) 1995, 1996 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. % $Id: wftopfa.ps 6300 2005-12-28 19:56:24Z giles $
  16. % wftopfa.ps
  17. % Convert a Wadalab base font to .PFA (or .PFB) format.
  18. (gs_ksb_e.ps) runlibfile
  19. (wrfont.ps) runlibfile
  20. /wftopfa_dict 100 dict def
  21. wftopfa_dict begin
  22. /KanjiSubEncoding dup .findencoding def
  23. % Initialize parameters.
  24. /init % - init -
  25. { /chars 256 dict def
  26. /version (001.001) def
  27. /highcode 0 def
  28. /StdHW [32] def
  29. /StdVW [32] def
  30. /UniqueID 20000000 def
  31. /FontBase (Wadalab) def
  32. /StdEncMode false def
  33. /CustomEncMode false def
  34. /Binary false def
  35. /Encrypt true def
  36. } bind def
  37. % Read definitions.
  38. /rdstring 5000 string def
  39. /readdefs % <filename> readdefs -
  40. { (r) file
  41. { dup rdstring readline not { pop exit } if
  42. dup length 15 ge
  43. { dup dup length 7 sub 7 getinterval (> CompD) eq
  44. { token pop exch token pop exch pop
  45. dup 0 get /highcode exch def
  46. exch chars 3 1 roll put
  47. }
  48. { pop
  49. }
  50. ifelse
  51. }
  52. { pop
  53. }
  54. ifelse
  55. }
  56. loop closefile
  57. } bind def
  58. % Write out the final font.
  59. /writepfa
  60. { 4 string highcode 16#1000 add 16 2 index cvrs 0 (.r) putinterval
  61. FontBase exch concatstrings /fullname exch def
  62. UniqueID 20000000 eq { /UniqueID 4990000 highcode add def } if
  63. /encoding CustomEncMode
  64. { KanjiSubEncoding }
  65. { StdEncMode { StandardEncoding } { ISOLatin1Encoding } ifelse }
  66. ifelse def
  67. /Font 30 dict def
  68. Font begin
  69. /FontInfo 20 dict def
  70. FontInfo begin
  71. % Write the clear text part.
  72. /CreationDate (%Calendar%) currentdevparams
  73. dup /Weekday get {(Sun )(Mon )(Tue )(Wed )(Thu )(Fri )(Sat )} exch get
  74. 1 index /Month get 1 sub
  75. {(Jan)(Feb)(Mar)(Apr)(May)(Jun)(Jul)(Aug)(Sep)(Oct)(Nov)(Dec)} exch get
  76. concatstrings
  77. {{/Day ( )} {/Hour ( )} {/Minute (:)} {/Second (:)} {/Year ( )}}
  78. { dup 1 get 3 -1 roll exch concatstrings exch
  79. 0 get 2 index exch get
  80. dup 10 lt { =string cvs (0) exch concatstrings } { =string cvs } ifelse
  81. concatstrings
  82. }
  83. forall exch pop readonly def
  84. /VMusage 100000 def
  85. /version version readonly def
  86. /Notice (No copyright on this font. Original available from moe.ipl.t.u-tokyo.ac.jp:/Font. Converted by wftopfa.ps (Aladdin Enterprises).) readonly def
  87. /FullName fullname readonly def
  88. /FamilyName FontBase readonly def
  89. /Weight (Regular) readonly def
  90. /ItalicAngle 0 def
  91. /isFixedPitch true def
  92. /UnderlinePosition 0 def
  93. /UnderlineThickness 0 def
  94. end % FontInfo
  95. /FontName fullname cvn def
  96. /Encoding encoding def
  97. /PaintType 0 def
  98. /FontType 1 def
  99. /FontMatrix [.001 0 0 .001 0 -0.16] readonly def
  100. /UniqueID UniqueID def
  101. /FontBBox [0 0 1000 1000] readonly def
  102. /Private 20 dict def
  103. Private begin
  104. /-| {string currentfile exch readstring pop} readonly def
  105. /|- {readonly def} readonly def
  106. /| {readonly put} readonly def
  107. /BlueValues [] readonly def
  108. /OtherBlues [] readonly def
  109. /MinFeature {16 16} readonly def
  110. /StdHW StdHW def
  111. /StdVW StdVW def
  112. /ForceBold false def
  113. /password 5839 def
  114. /UniqueID UniqueID def
  115. /OtherSubrs [] readonly def
  116. /Subrs [
  117. (\020\2771p|\020\024\020=-\223D\\\342R) readonly
  118. (\020\2771py\274\366Uz) readonly
  119. (\020\2771py\275\304\236i) readonly
  120. (\020\2771p\371) readonly
  121. (\020\2771p~\266+6\034\3446z) readonly
  122. ] readonly def
  123. end % Private
  124. /CharStrings 256 dict def
  125. chars
  126. { exch =string cvs
  127. dup 0 get highcode eq
  128. { 1 get encoding exch get exch CharStrings 3 1 roll put }
  129. { pop pop }
  130. ifelse
  131. }
  132. forall
  133. end % Font
  134. Font /FontName get Font definefont setfont
  135. (%stdout) (w) file writefont
  136. } bind def
  137. % Scan the command line and process files.
  138. /options mark
  139. /version { 2 copy get /version exch def 1 add } bind
  140. /StdHW { 2 copy get cvx exec /StdHW exch def 1 add } bind
  141. /StdVW { 2 copy get cvx exec /StdVW exch def 1 add } bind
  142. /UniqueId { 2 copy get cvi /UniqueID exch def 1 add } bind
  143. /UniqueID 1 index
  144. /FontBase { 2 copy get /FontBase exch def 1 add } bind
  145. /StdEnc { /StdEncMode true def } bind
  146. /CustomEnc { /CustomEncMode true def } bind
  147. /Binary { /Binary true def } bind
  148. /noEncrypt { /Encrypt false def } bind
  149. .dicttomark def
  150. /wftopfa % [(arg1) ...] wftopfa -
  151. { init dup 0
  152. { dup 2 index length ge { exit } if
  153. 2 copy get exch 1 add exch
  154. options 1 index .knownget { exch pop exec } { readdefs } ifelse
  155. }
  156. loop pop pop
  157. wrfont_dict /binary_CharStrings Binary put
  158. wrfont_dict /eexec_encrypt Encrypt put
  159. wrfont_dict /name_all_Encodings CustomEncMode put
  160. writepfa
  161. } bind def
  162. end % wftopfa_dict
  163. /wftopfa
  164. { mark exch wftopfa_dict begin /saved save def { wftopfa } exec false%stopped
  165. { cleartomark true } { cleartomark false } ifelse
  166. saved end restore { stop } if
  167. } bind def
  168. [ shellarguments
  169. { ] wftopfa }
  170. { pop }
  171. ifelse
  172. % ---------------- Root font ---------------- %
  173. % Define the Encoding for the root font.
  174. /wfrootencoding
  175. % \x00-\x3F
  176. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  177. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  178. 0 1 2 3 4 5 6 7 8 0 0 0 0 0 0 0
  179. 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
  180. % \x40-\x7F
  181. 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
  182. 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
  183. 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
  184. 73 74 75 76 77 0 0 0 0 0 0 0 0 0 0 0
  185. % \x80-\xFF
  186. 128 copy
  187. 256 packedarray def
  188. % Define the template for the root font dictionary.
  189. /wfrootfontdict mark
  190. /FontType 0
  191. /FontMatrix [1 0 0 1 0 0]
  192. /FMapType 2
  193. /Encoding wfrootencoding
  194. .dicttomark def
  195. % Define a dummy (placeholder) Type 1 font for the FDepVector.
  196. /type1dummyfont % <fontname> type1dummyfont <font>
  197. { mark /FontName 3 -1 roll
  198. /FontType 1
  199. /FontMatrix [.001 0 0 .001 0 0]
  200. /FontBBox [0 0 1000 1000]
  201. /Encoding /KanjiSubEncoding findencoding
  202. /CharStrings 0 dict
  203. /Private mark /BlueValues [] /password 5839 .dicttomark
  204. .dicttomark dup /FontName get exch definefont
  205. } bind def
  206. % Write a root font. Again, wrfont.ps does most of the work.
  207. /makerootfont % <rootname> makerootfont <font>
  208. { wfrootfontdict dup length 4 add % FontName, FDepVector, PrefEnc, FID
  209. dict copy begin
  210. cvlit /FontName exch def
  211. 4 dict begin
  212. /len FontName length def
  213. /str len 4 add string def
  214. FontName str cvs pop
  215. str len (.r) putinterval
  216. /FDepVector [ 16#21 1 16#74
  217. { dup wfrootencoding exch get 0 eq
  218. { pop
  219. }
  220. { 16 str len 2 add 2 getinterval cvrs pop
  221. str cvn type1dummyfont
  222. }
  223. ifelse
  224. }
  225. for end counttomark -1 roll dup counttomark 2 roll
  226. ] def
  227. FontName currentdict end definefont
  228. } bind def
  229. /writerootfont % <rootname> writerootfont -
  230. { save exch makerootfont setfont (%stdout) (w) file writefont restore
  231. } bind def
  232. % ---------------- Converting entire fonts ---------------- %
  233. % Define the directory where the Wadalab fonts are stored.
  234. /wfdir (/home/ghost/kanji/w) def
  235. % Convert an entire Wadalab font.
  236. /writeentirefont % <fontname> <template*> writeentirefont -
  237. { 2 dict begin
  238. /templates exch def
  239. /fontname exch def
  240. [ templates
  241. { wfdir (/) concatstrings exch concatstrings { copystring }
  242. 8192 string filenameforall
  243. }
  244. forall
  245. wfdir (/wadalab-sym/*.ps) concatstrings { copystring }
  246. 8192 string filenameforall
  247. ]
  248. (%!\n) print
  249. { /currentuserparams where
  250. { pop currentuserparams /VMReclaim get -2 vmreclaim { vmreclaim } }
  251. { { } }
  252. ifelse
  253. } == (exec\n) print
  254. (/KanjiSubEncoding ) print /KanjiSubEncoding findencoding ==
  255. (readonly def\n) print
  256. { (%stderr) (w) file dup 2 index write== flushfile
  257. mark exch (CustomEnc) (Binary) (noEncrypt)
  258. (FontBase) fontname counttomark -1 roll ] wftopfa
  259. }
  260. forall
  261. fontname cvn writerootfont
  262. (exec\n) print
  263. end
  264. } def % don't bind, so we can print the procedure
  265. % Convert the Wadalab JIS 1&2 SaiMincho font.
  266. % To invoke this from the command line,
  267. % gs -dNODISPLAY -q wftopfa.ps -c writeSaiMincho0 flush quit >wmin0.ps
  268. % To make the resulting font loadable on demand, add to the Fontmap file:
  269. % /Wadalab-SaiMincho (wmin0.ps) ;
  270. /writeSaiMincho0
  271. { (Wadalab-SaiMincho) [ (wadalab-mincho-0-8/*.ps) ] writeentirefont
  272. } bind def