winmaps.ps 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. % Copyright (C) 1993 Aladdin Enterprises. All rights reserved.
  2. %
  3. % This file is part of AFPL Ghostscript.
  4. %
  5. % AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author or
  6. % distributor accepts any responsibility for the consequences of using it, or
  7. % for whether it serves any particular purpose or works at all, unless he or
  8. % she says so in writing. Refer to the Aladdin Free Public License (the
  9. % "License") for full details.
  10. %
  11. % Every copy of AFPL Ghostscript must include a copy of the License, normally
  12. % in a plain ASCII text file named PUBLIC. The License grants you the right
  13. % to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14. % conditions described in the License. Among other things, the License
  15. % requires that the copyright notice and this notice be preserved on all
  16. % copies.
  17. % $Id: winmaps.ps,v 1.2 2000/09/19 18:29:11 lpd Exp $
  18. % winmaps.ps - make maps between PostScript encodings and Windows
  19. % character sets.
  20. % Define the two Windows encodings.
  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. /OEMEncoding [
  27. /.notdef /.notdef /.notdef /heart /diamond /club /spade /bullet
  28. 8 { /.notdef } repeat
  29. /.notdef /.notdef /.notdef /.notdef /paragraph /section /.notdef /.notdef
  30. /arrowup /arrowdown /arrowright /arrowleft /.notdef /arrowboth /.notdef /.notdef
  31. StandardEncoding 32 96 getinterval aload pop
  32. /Ccedilla /udieresis /eacute /acircumflex /adieresis /agrave /aring /ccedilla
  33. /ecircumflex /edieresis /egrave /idieresis /igrave /Adieresis /Aring
  34. /Eacute /ae /AE /ocircumflex /odieresis /ograve /ucircumflex /ugrave
  35. /ydieresis /Odieresis /Udieresis /cent /sterling /yen /.notdef /florin
  36. /aacute /iacute /oacute /uacute /ntilde /Ntilde /ordfeminine /ordmasculine
  37. /questiondown /.notdef /logicalnot /onehalf /onequarter /exclamdown /guillemotleft /guillemotright
  38. 48 { /.notdef } repeat
  39. /alpha /beta /Gamma /Pi /Sigma /sigma /mu /tau
  40. /Phi /Theta /Omega /delta /infinity /phi /element /intersection
  41. /equivalence /plusminus /greaterequal /lessequal /integraltp /integralbt /divide /.notdef
  42. /degree /dotmath /periodcentered /radical /.notdef /twosuperior /.notdef /.notdef
  43. ] def
  44. % Utility procedures
  45. /invertencoding % <array> invertencoding <dict>
  46. { 256 dict exch dup length 1 sub -1 0
  47. { % stack: dict array index
  48. 2 copy get /.notdef ne
  49. { 2 copy get exch 3 index 3 1 roll put }
  50. { pop }
  51. ifelse
  52. } for
  53. pop
  54. } def
  55. /pmarray 256 array def
  56. /printmap % <chars> <decode> printmap -
  57. { mark 3 1 roll exch
  58. { 2 copy known { 1 index exch get } { pop 0 } ifelse exch
  59. }
  60. forall pop
  61. pmarray 0 counttomark 2 sub getinterval astore
  62. ([) print dup length =only 0 exch (] = {\n ) exch
  63. { exch print =only
  64. 1 add 15 and dup 0 eq { (,\n ) } { (, ) } ifelse
  65. }
  66. forall pop pop (\n};\n) print pop
  67. } def
  68. /decodeStd StandardEncoding invertencoding def
  69. /decodeISO ISOLatin1Encoding
  70. % Remove the redundant characters
  71. dup length array copy
  72. [8#222 8#225 8#230 8#233 8#240] { 2 copy /.notdef put pop } forall
  73. invertencoding def
  74. /decodeSym SymbolEncoding invertencoding def
  75. /decodeANSI ANSIEncoding invertencoding def
  76. /decodeOEM OEMEncoding invertencoding def
  77. % Construct the map from Symbol to OEM.
  78. (\nprivate const byte far_data gs_map_symbol_to_oem) print
  79. SymbolEncoding decodeOEM printmap
  80. % Construct the map from ISOLatin1 to OEM.
  81. (\nprivate const byte far_data gs_map_iso_to_oem) print
  82. ISOLatin1Encoding decodeOEM printmap
  83. % Construct the map from Standard to ISOLatin1.
  84. (\nprivate const byte far_data gs_map_std_to_iso) print
  85. StandardEncoding decodeISO printmap
  86. % Construct the map from ISOLatin1 to Standard.
  87. % The Windows driver doesn't need this, but the X11 driver does.
  88. (\nprivate const byte far_data gs_map_iso_to_std) print
  89. ISOLatin1Encoding decodeStd printmap
  90. quit