gs_kanji.ps 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. % Copyright (C) 1994, 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: gs_kanji.ps,v 1.4 2002/02/21 21:49:28 giles Exp $
  16. % Scaffolding for Kanji fonts. This is based on the Wadalab free font
  17. % from the University of Tokyo; it may not be appropriate for other
  18. % Kanji fonts.
  19. /currentglobal where
  20. { pop currentglobal { setglobal } true setglobal }
  21. { { } }
  22. ifelse
  23. % Define the encoding for the root font.
  24. /KanjiEncoding
  25. % \x00
  26. 0 0 0 0 0 0 0 0
  27. 0 0 0 0 0 0 0 0
  28. 0 0 0 0 0 0 0 0
  29. 0 0 0 0 0 0 0 0
  30. % \x20
  31. 0 1 2 3 4 5 6 7
  32. 8 0 0 0 0 0 0 0
  33. 9 10 11 12 13 14 15 16
  34. 17 18 19 20 21 22 23 24
  35. % \x40
  36. 25 26 27 28 29 30 31 32
  37. 33 34 35 36 37 38 39 40
  38. 41 42 43 44 45 46 47 48
  39. 49 50 51 52 53 54 55 56
  40. % \x60
  41. 57 58 59 60 61 62 63 64
  42. 65 66 67 68 69 70 71 72
  43. 73 74 75 76 77 0 0 0
  44. 0 0 0 0 0 0 0 0
  45. % \x80
  46. 0 0 0 0 0 0 0 0
  47. 0 0 0 0 0 0 0 0
  48. 0 0 0 0 0 0 0 0
  49. 0 0 0 0 0 0 0 0
  50. % \xA0
  51. 0 1 2 3 4 5 6 7
  52. 8 0 0 0 0 0 0 0
  53. 9 10 11 12 13 14 15 16
  54. 17 18 19 20 21 22 23 24
  55. % \xC0
  56. 25 26 27 28 29 30 31 32
  57. 33 34 35 36 37 38 39 40
  58. 41 42 43 44 45 46 47 48
  59. 49 50 51 52 53 54 55 56
  60. % \xE0
  61. 57 58 59 60 61 62 63 64
  62. 65 66 67 68 69 70 71 72
  63. 73 74 75 76 77 0 0 0
  64. 0 0 0 0 0 0 0 0
  65. 256 packedarray def
  66. % Define a stub for the base font encoding.
  67. /KanjiSubEncoding { /KanjiSubEncoding .findencoding } bind def
  68. %% Replace 3 (gs_ksb_e.ps)
  69. EncodingDirectory /KanjiSubEncoding
  70. { (gs_ksb_e.ps) //systemdict begin runlibfile KanjiSubEncoding end }
  71. bind put
  72. % Support procedures and data.
  73. /T1FontInfo 8 dict begin
  74. /version (001.001) readonly def
  75. /FullName (KanjiBase) readonly def
  76. /FamilyName (KanjiBase) readonly def
  77. /Weight (Medium) readonly def
  78. /ItalicAngle 0 def
  79. /isFixedPitch false def
  80. /UnderlinePosition 0 def
  81. /UnderlineThickness 0 def
  82. currentdict end readonly def
  83. /T1NF % <fontname> T1NF <font>
  84. {
  85. 20 dict begin
  86. /FontName exch def
  87. /FontType 1 def
  88. /FontInfo T1FontInfo def
  89. /FontMatrix [.001 0 0 .001 0 0] def
  90. /FontBBox [0 0 1000 1000] def
  91. /Encoding KanjiSubEncoding def
  92. /CharStrings 150 dict def
  93. /PaintType 0 def
  94. /Private 2 dict def
  95. Private begin
  96. /BlueValues [] def
  97. /password 5839 def
  98. end
  99. FontName currentdict end definefont
  100. } def
  101. /T0NF % <fontname> T0NF <font>
  102. {
  103. 20 dict begin
  104. /FontName exch def
  105. /FDepVector exch def
  106. /FontType 0 def
  107. /FontMatrix [1 0 0 1 0 0] def
  108. /FMapType 2 def
  109. /Encoding KanjiEncoding def
  110. FontName currentdict end definefont
  111. } def
  112. % Define the composite font and all the base fonts.
  113. /CompNF % <fontname> CompNF <font>
  114. {
  115. /newname1 exch def
  116. newname1 dup length string cvs /str exch def
  117. str length /len exch def
  118. /fdepvector 78 array def
  119. /j 1 def
  120. 16#21 1 16#74 {
  121. /i exch def
  122. KanjiEncoding i get 0 gt {
  123. len 4 add string /newstr exch def
  124. newstr 0 str putinterval
  125. newstr len (.r) putinterval
  126. newstr len 2 add i 16 2 string cvrs putinterval
  127. newstr cvn /newlit exch def
  128. newlit T1NF /newfont exch def
  129. fdepvector j newfont put
  130. /j j 1 add def
  131. } if
  132. } for
  133. fdepvector 0 fdepvector 1 get put
  134. /j 0 def
  135. fdepvector newname1 T0NF
  136. } def
  137. % Define an individual character in a composite font.
  138. /CompD % <charstring> <(HL)> CompD -
  139. { currentfont /Encoding get 1 index 0 get get % FDepVector index
  140. currentfont /FDepVector get exch get % base font
  141. dup /Encoding get 3 -1 roll 1 get get % base font character name
  142. exch /CharStrings get exch 3 -1 roll put
  143. } bind def
  144. exec