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