home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 February / PCWK0296.iso / sharewar / dos / inne / gs300ini / gs_kanji.ps < prev    next >
Encoding:
Text File  |  1994-08-02  |  4.0 KB  |  153 lines

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