You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.5 KiB

1 month ago
  1. % Copyright (C) 2001-2023 Artifex Software, Inc.
  2. % All Rights Reserved.
  3. %
  4. % This software is provided AS-IS with no warranty, either express or
  5. % implied.
  6. %
  7. % This software is distributed under license and may not be copied,
  8. % modified or distributed except as expressly authorized under the terms
  9. % of the license contained in the file LICENSE in this distribution.
  10. %
  11. % Refer to licensing information at http://www.artifex.com or contact
  12. % Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
  13. % CA 94129, USA, for further information.
  14. %
  15. % winmaps.ps - make maps between PostScript encodings and Windows
  16. % character sets.
  17. % Define the two Windows encodings.
  18. /ANSIEncoding
  19. ISOLatin1Encoding 256 array copy
  20. dup 16#90 /.notdef put
  21. 16#93 1 16#9f { 2 copy /.notdef put pop } for
  22. def
  23. /OEMEncoding [
  24. /.notdef /.notdef /.notdef /heart /diamond /club /spade /bullet
  25. 8 { /.notdef } repeat
  26. /.notdef /.notdef /.notdef /.notdef /paragraph /section /.notdef /.notdef
  27. /arrowup /arrowdown /arrowright /arrowleft /.notdef /arrowboth /.notdef /.notdef
  28. StandardEncoding 32 96 getinterval aload pop
  29. /Ccedilla /udieresis /eacute /acircumflex /adieresis /agrave /aring /ccedilla
  30. /ecircumflex /edieresis /egrave /idieresis /igrave /Adieresis /Aring
  31. /Eacute /ae /AE /ocircumflex /odieresis /ograve /ucircumflex /ugrave
  32. /ydieresis /Odieresis /Udieresis /cent /sterling /yen /.notdef /florin
  33. /aacute /iacute /oacute /uacute /ntilde /Ntilde /ordfeminine /ordmasculine
  34. /questiondown /.notdef /logicalnot /onehalf /onequarter /exclamdown /guillemotleft /guillemotright
  35. 48 { /.notdef } repeat
  36. /alpha /beta /Gamma /Pi /Sigma /sigma /mu /tau
  37. /Phi /Theta /Omega /delta /infinity /phi /element /intersection
  38. /equivalence /plusminus /greaterequal /lessequal /integraltp /integralbt /divide /.notdef
  39. /degree /dotmath /periodcentered /radical /.notdef /twosuperior /.notdef /.notdef
  40. ] def
  41. % Utility procedures
  42. /invertencoding % <array> invertencoding <dict>
  43. { 256 dict exch dup length 1 sub -1 0
  44. { % stack: dict array index
  45. 2 copy get /.notdef ne
  46. { 2 copy get exch 3 index 3 1 roll put }
  47. { pop }
  48. ifelse
  49. } for
  50. pop
  51. } def
  52. /pmarray 256 array def
  53. /printmap % <chars> <decode> printmap -
  54. { mark 3 1 roll exch
  55. { 2 copy known { 1 index exch get } { pop 0 } ifelse exch
  56. }
  57. forall pop
  58. pmarray 0 counttomark 2 sub getinterval astore
  59. ([) print dup length =only 0 exch (] = {\n ) exch
  60. { exch print =only
  61. 1 add 15 and dup 0 eq { (,\n ) } { (, ) } ifelse
  62. }
  63. forall pop pop (\n};\n) print pop
  64. } def
  65. /decodeStd StandardEncoding invertencoding def
  66. /decodeISO ISOLatin1Encoding
  67. % Remove the redundant characters
  68. dup length array copy
  69. [8#222 8#225 8#230 8#233 8#240] { 2 copy /.notdef put pop } forall
  70. invertencoding def
  71. /decodeSym SymbolEncoding invertencoding def
  72. /decodeANSI ANSIEncoding invertencoding def
  73. /decodeOEM OEMEncoding invertencoding def
  74. % Construct the map from Symbol to OEM.
  75. (\nprivate const byte far_data gs_map_symbol_to_oem) print
  76. SymbolEncoding decodeOEM printmap
  77. % Construct the map from ISOLatin1 to OEM.
  78. (\nprivate const byte far_data gs_map_iso_to_oem) print
  79. ISOLatin1Encoding decodeOEM printmap
  80. % Construct the map from Standard to ISOLatin1.
  81. (\nprivate const byte far_data gs_map_std_to_iso) print
  82. StandardEncoding decodeISO printmap
  83. % Construct the map from ISOLatin1 to Standard.
  84. % The Windows driver doesn't need this, but the X11 driver does.
  85. (\nprivate const byte far_data gs_map_iso_to_std) print
  86. ISOLatin1Encoding decodeStd printmap
  87. quit