home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 10 / AU_CD10.iso / Updates / GhostScript / !GhostScr / 6_01 / lib / gs_kanji.ps < prev    next >
Text File  |  2000-03-09  |  4KB  |  161 lines

  1. %    Copyright (C) 1994, 1995, 1996 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of Aladdin Ghostscript.
  3. % Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  4. % or distributor accepts any responsibility for the consequences of using it,
  5. % or for whether it serves any particular purpose or works at all, unless he
  6. % or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  7. % License (the "License") for full details.
  8. % Every copy of Aladdin Ghostscript must include a copy of the License,
  9. % normally in a plain ASCII text file named PUBLIC.  The License grants you
  10. % the right to copy, modify and redistribute Aladdin Ghostscript, but only
  11. % under certain conditions described in the License.  Among other things, the
  12. % License requires that the copyright notice and this notice be preserved on
  13. % all copies.
  14.  
  15. % $Id: gs_kanji.ps,v 1.1 2000/03/09 08:40:40 lpd 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.  
  20. /currentglobal where
  21.  { pop currentglobal { setglobal } true setglobal }
  22.  { { } }
  23. ifelse
  24.  
  25. % Define the encoding for the root font.
  26.  
  27. /KanjiEncoding
  28. % \x00
  29.     0    0    0    0    0    0    0    0
  30.     0    0    0    0    0    0    0    0
  31.     0    0    0    0    0    0    0    0
  32.     0    0    0    0    0    0    0    0
  33. % \x20
  34.     0    1    2    3    4    5    6    7
  35.     8    0    0    0    0    0    0    0
  36.     9    10    11    12    13    14    15    16
  37.     17    18    19    20    21    22    23    24
  38. % \x40
  39.     25    26    27    28    29    30    31    32
  40.     33    34    35    36    37    38    39    40
  41.     41    42    43    44    45    46    47    48
  42.     49    50    51    52    53    54    55    56
  43. % \x60
  44.     57    58    59    60    61    62    63    64
  45.     65    66    67    68    69    70    71    72
  46.     73    74    75    76    77    0    0    0
  47.     0    0    0    0    0    0    0    0
  48. % \x80
  49.     0    0    0    0    0    0    0    0
  50.     0    0    0    0    0    0    0    0
  51.     0    0    0    0    0    0    0    0
  52.     0    0    0    0    0    0    0    0
  53. % \xA0
  54.     0    1    2    3    4    5    6    7
  55.     8    0    0    0    0    0    0    0
  56.     9    10    11    12    13    14    15    16
  57.     17    18    19    20    21    22    23    24
  58. % \xC0
  59.     25    26    27    28    29    30    31    32
  60.     33    34    35    36    37    38    39    40
  61.     41    42    43    44    45    46    47    48
  62.     49    50    51    52    53    54    55    56
  63. % \xE0
  64.     57    58    59    60    61    62    63    64
  65.     65    66    67    68    69    70    71    72
  66.     73    74    75    76    77    0    0    0
  67.     0    0    0    0    0    0    0    0
  68. 256 packedarray def
  69.  
  70. % Define a stub for the base font encoding.
  71.  
  72.   /KanjiSubEncoding { /KanjiSubEncoding .findencoding } bind def
  73. %% Replace 3 (gs_ksb_e.ps)
  74.   EncodingDirectory /KanjiSubEncoding
  75.    { (gs_ksb_e.ps) //systemdict begin runlibfile KanjiSubEncoding end }
  76.   bind put
  77.  
  78. % Support procedures and data.
  79.  
  80. /T1FontInfo 8 dict begin
  81.   /version (001.001) readonly def
  82.   /FullName (KanjiBase) readonly def
  83.   /FamilyName (KanjiBase) readonly def
  84.   /Weight (Medium) readonly def
  85.   /ItalicAngle 0 def
  86.   /isFixedPitch false def
  87.   /UnderlinePosition 0 def
  88.   /UnderlineThickness 0 def
  89. currentdict end readonly def
  90.  
  91. /T1NF            % <fontname> T1NF <font>
  92. {
  93. 20 dict begin
  94.   /FontName exch def
  95.   /FontType 1 def
  96.   /FontInfo T1FontInfo def
  97.   /FontMatrix [.001 0 0 .001 0 0] def
  98.   /FontBBox [0 0 1000 1000] def
  99.   /Encoding KanjiSubEncoding def
  100.   /CharStrings 150 dict def
  101.   /PaintType 0 def
  102.   /Private 2 dict def
  103.   Private begin
  104.     /BlueValues [] def
  105.     /password 5839 def
  106.   end
  107. FontName currentdict end definefont
  108. } def
  109.  
  110. /T0NF            % <fontname> T0NF <font>
  111. {
  112. 20 dict begin
  113.   /FontName exch def
  114.   /FDepVector exch def
  115.   /FontType 0 def
  116.   /FontMatrix [1 0 0 1 0 0] def
  117.   /FMapType 2 def
  118.   /Encoding KanjiEncoding def
  119. FontName currentdict end definefont
  120. } def
  121.  
  122. % Define the composite font and all the base fonts.
  123.  
  124. /CompNF            % <fontname> CompNF <font>
  125. {
  126. /newname1 exch def
  127. newname1 dup length string cvs /str exch def
  128. str length /len exch def
  129. /fdepvector 78 array def 
  130. /j 1 def
  131. 16#21 1 16#74 {
  132. /i exch def
  133. KanjiEncoding i get 0 gt {
  134. len 4 add string /newstr exch def
  135. newstr 0 str putinterval
  136. newstr len (.r) putinterval
  137. newstr len 2 add  i 16 2 string cvrs putinterval
  138. newstr cvn /newlit exch def
  139. newlit T1NF /newfont exch def
  140. fdepvector j newfont put
  141. /j j 1 add def
  142. } if
  143. } for
  144. fdepvector 0 fdepvector 1 get put
  145. /j 0 def
  146. fdepvector newname1 T0NF
  147. } def
  148.  
  149. % Define an individual character in a composite font.
  150. /CompD            % <charstring> <(HL)> CompD -
  151.  { currentfont /Encoding get 1 index 0 get get    % FDepVector index
  152.    currentfont /FDepVector get exch get        % base font
  153.    dup /Encoding get 3 -1 roll 1 get get    % base font character name
  154.    exch /CharStrings get exch 3 -1 roll put
  155.  } bind def
  156.  
  157. exec
  158.