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

  1. %    Copyright (C) 1993 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: winmaps.ps,v 1.1 2000/03/09 08:40:40 lpd Exp $
  16. % winmaps.ps - make maps between PostScript encodings and Windows
  17. % character sets.
  18.  
  19. % Define the two Windows encodings.
  20.  
  21. /ANSIEncoding
  22.   ISOLatin1Encoding 256 array copy
  23.   dup 16#90 /.notdef put
  24.   16#93 1 16#9f { 2 copy /.notdef put pop } for
  25. def
  26.  
  27. /OEMEncoding [
  28.   /.notdef /.notdef /.notdef /heart /diamond /club /spade /bullet
  29.     8 { /.notdef } repeat
  30.   /.notdef /.notdef /.notdef /.notdef /paragraph /section /.notdef /.notdef
  31.     /arrowup /arrowdown /arrowright /arrowleft /.notdef /arrowboth /.notdef /.notdef
  32.   StandardEncoding 32 96 getinterval aload pop
  33.   /Ccedilla /udieresis /eacute /acircumflex /adieresis /agrave /aring /ccedilla
  34.     /ecircumflex /edieresis /egrave /idieresis /igrave /Adieresis /Aring
  35.   /Eacute /ae /AE /ocircumflex /odieresis /ograve /ucircumflex /ugrave
  36.     /ydieresis /Odieresis /Udieresis /cent /sterling /yen /.notdef /florin
  37.   /aacute /iacute /oacute /uacute /ntilde /Ntilde /ordfeminine /ordmasculine
  38.     /questiondown /.notdef /logicalnot /onehalf /onequarter /exclamdown /guillemotleft /guillemotright
  39.   48 { /.notdef } repeat
  40.   /alpha /beta /Gamma /Pi /Sigma /sigma /mu /tau
  41.     /Phi /Theta /Omega /delta /infinity /phi /element /intersection
  42.   /equivalence /plusminus /greaterequal /lessequal /integraltp /integralbt /divide /.notdef
  43.     /degree /dotmath /periodcentered /radical /.notdef /twosuperior /.notdef /.notdef
  44. ] def
  45.  
  46. % Utility procedures
  47.  
  48. /invertencoding        % <array> invertencoding <dict>
  49.  { 256 dict exch dup length 1 sub -1 0
  50.     {    % stack: dict array index
  51.       2 copy get /.notdef ne
  52.        { 2 copy get exch 3 index 3 1 roll put }
  53.        { pop }
  54.       ifelse
  55.     } for
  56.    pop
  57.  } def
  58.  
  59. /pmarray 256 array def
  60. /printmap        % <chars> <decode> printmap -
  61.  { mark 3 1 roll exch
  62.     { 2 copy known { 1 index exch get } { pop 0 } ifelse exch
  63.     }
  64.    forall pop
  65.    pmarray 0 counttomark 2 sub getinterval astore
  66.    ([) print dup length =only 0 exch (] = {\n  ) exch
  67.     { exch print =only
  68.       1 add 15 and dup 0 eq { (,\n  ) } { (, ) } ifelse
  69.     }
  70.    forall pop pop (\n};\n) print pop
  71.  } def
  72.  
  73. /decodeStd StandardEncoding invertencoding def
  74. /decodeISO ISOLatin1Encoding
  75.     % Remove the redundant characters
  76.   dup length array copy
  77.   [8#222 8#225 8#230 8#233 8#240] { 2 copy /.notdef put pop } forall
  78. invertencoding def
  79. /decodeSym SymbolEncoding invertencoding def
  80.  
  81. /decodeANSI ANSIEncoding invertencoding def
  82. /decodeOEM OEMEncoding invertencoding def
  83.  
  84. % Construct the map from Symbol to OEM.
  85.  
  86. (\nprivate const byte far_data gs_map_symbol_to_oem) print
  87. SymbolEncoding decodeOEM printmap
  88.  
  89. % Construct the map from ISOLatin1 to OEM.
  90.  
  91. (\nprivate const byte far_data gs_map_iso_to_oem) print
  92. ISOLatin1Encoding decodeOEM printmap
  93.  
  94. % Construct the map from Standard to ISOLatin1.
  95.  
  96. (\nprivate const byte far_data gs_map_std_to_iso) print
  97. StandardEncoding decodeISO printmap
  98.  
  99. % Construct the map from ISOLatin1 to Standard.
  100. % The Windows driver doesn't need this, but the X11 driver does.
  101.  
  102. (\nprivate const byte far_data gs_map_iso_to_std) print
  103. ISOLatin1Encoding decodeStd printmap
  104.  
  105. quit
  106.