char-enc.lua /size: 6119 b    last modification: 2020-07-01 14:35
1if not modules then modules = { } end modules ['char-enc'] = {
2    version   = 1.001,
3    comment   = "companion to char-ini.mkiv",
4    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5    copyright = "PRAGMA ADE / ConTeXt Development Team",
6    license   = "see context related readme files"
7 -- dataonly  = true,
8}
9
10-- Thanks to tex4ht for these mappings.
11
12local next = next
13
14local allocate, setinitializer = utilities.storage.allocate, utilities.storage.setinitializer
15
16characters       = characters or { }
17local characters = characters
18
19characters.synonyms = allocate { -- afm mess
20    angle              = 0x2220,
21    anticlockwise      = 0x21BA,
22    arrowaxisleft      = 0x2190,
23    arrowaxisright     = 0x2192,
24    arrowparrleftright = 0x21C6,
25    arrowparrrightleft = 0x21C4,
26    arrowtailleft      = 0x21A2,
27    arrowtailright     = 0x21A3,
28    arrowtripleleft    = 0x21DA,
29    arrowtripleright   = 0x21DB,
30    axisshort          = 0x2212,
31    because            = 0x2235,
32    between            = 0x226C,
33    check              = 0x2713,
34    circleasteris      = 0x229B,
35    circleequal        = 0x2257,
36    circleminus        = 0x229D,
37    circleR            = 0x24C7,
38    circlering         = 0x229A,
39    circleS            = 0x24C8,
40    clockwise          = 0x21BB,
41    complement         = 0x2201,
42    curlyleft          = 0x21AB,
43    curlyright         = 0x21AC,
44    dblarrowdwn        = 0x21CA,
45    dblarrowheadleft   = 0x219E,
46    dblarrowheadright  = 0x21A0,
47    dblarrowleft       = 0x21C7,
48    dblarrowright      = 0x21C9,
49    dblarrowup         = 0x21C8,
50    defines            = 0x225C,
51    diamond            = 0x2662,
52    diamondsolid       = 0x2666,
53    difference         = 0x224F,
54    dotplus            = 0x2214,
55    downfall           = 0x22CE,
56    equaldotleftright  = 0x2252,
57    equaldotrightleft  = 0x2253,
58    equalorfollows     = 0x22DF,
59    equalorgreater     = 0x22DD,
60    equalorless        = 0x22DC,
61    equalorprecedes    = 0x22DE,
62    equalsdots         = 0x2251,
63    followsorcurly     = 0x227D,
64    followsorequal     = 0x227F,
65    forces             = 0x22A9,
66    forcesbar          = 0x22AA,
67    fork               = 0x22D4,
68    frown              = 0x2322,
69    geomequivalent     = 0x224E,
70    greaterdbleqlless  = 0x22Da,
71    greaterdblequal    = 0x2267,
72    greaterlessequal   = 0x22DA,
73    greaterorapproxeql = 0x227F,
74    greaterorequalslant= 0x2265,
75    greaterorless      = 0x2277,
76    greaterorsimilar   = 0x2273,
77    harpoondownleft    = 0x21C3,
78    harpoondownright   = 0x21C2,
79    harpoonleftright   = 0x21CC,
80    harpoonrightleft   = 0x21CB,
81    harpoonupleft      = 0x21BF,
82    harpoonupright     = 0x21BE,
83    intercal           = 0x22BA,
84    intersectiondbl    = 0x22D2,
85    lessdbleqlgreater  = 0x22DB,
86    lessdblequal       = 0x2266,
87    lessequalgreater   = 0x22DB,
88    lessorapproxeql    = 0x227E,
89    lessorequalslant   = 0x2264,
90    lessorgreater      = 0x2276,
91    lessorsimilar      = 0x2272,
92    maltesecross       = 0xFFFD,
93    measuredangle      = 0x2221,
94    muchgreater        = 0x22D9,
95    muchless           = 0x22D8,
96    multimap           = 0x22B8,
97    multiopenleft      = 0x22CB,
98    multiopenright     = 0x22CC,
99    nand               = 0x22BC,
100    orunderscore       = 0x22BB,
101    perpcorrespond     = 0x2259,
102    precedesorcurly    = 0x227C,
103    precedesorequal    = 0x227E,
104    primereverse       = 0x2035,
105    proportional       = 0x221D,
106    revasymptequal     = 0x2243,
107    revsimilar         = 0x223D,
108    rightanglene       = 0x231D,
109    rightanglenw       = 0x231C,
110    rightanglese       = 0x231F,
111    rightanglesw       = 0x231E,
112    ringinequal        = 0x2256,
113    satisfies          = 0x22A8,
114    shiftleft          = 0x21B0,
115    shiftright         = 0x21B1,
116    smile              = 0x2323,
117    sphericalangle     = 0x2222,
118    square             = 0x25A1,
119    squaredot          = 0x22A1,
120    squareimage        = 0x228F,
121    squareminus        = 0x229F,
122    squaremultiply     = 0x22A0,
123    squareoriginal     = 0x2290,
124    squareplus         = 0x229E,
125    squaresmallsolid   = 0x25AA,
126    squaresolid        = 0x25A0,
127    squiggleleftright  = 0x21AD,
128    squiggleright      = 0x21DD,
129    star               = 0x22C6,
130    subsetdbl          = 0x22D0,
131    subsetdblequal     = 0x2286,
132    supersetdbl        = 0x22D1,
133    supersetdblequa    = 0x2287,
134    therefore          = 0x2234,
135    triangle           = 0x25B5,
136    triangledownsld    = 0x25BE,
137    triangleinv        = 0x25BF,
138    triangleleft       = 0x25C3,
139    triangleleftequal  = 0x22B4,
140    triangleleftsld    = 0x25C2,
141    triangleright      = 0x25B9,
142    trianglerightequal = 0x22B5,
143    trianglerightsld   = 0x25B8,
144    trianglesolid      = 0x25B4,
145    uniondbl           = 0x22D3,
146    uprise             = 0x22CF,
147    Yen                = 0x00A5,
148}
149
150-- if not characters.enccodes then
151--
152--     local enccodes = { } characters.enccodes  = enccodes
153--
154--     for unicode, data in next, characters.data do
155--         local encname = data.adobename or data.contextname
156--         if encname then
157--             enccodes[encname] = unicode
158--         end
159--     end
160--
161--     for name, unicode in next, characters.synonyms do
162--         if not enccodes[name] then enccodes[name] = unicode end
163--     end
164--
165-- end
166--
167-- storage.register("characters.enccodes", characters.enccodes, "characters.enccodes")
168
169-- As this table is seldom used, we can delay its definition. Beware, this means
170-- that table.print would not work on this file unless it is accessed once. This
171-- why the serializer does a dummy access.
172
173local enccodes      = allocate()
174characters.enccodes = enccodes
175
176 -- maybe omit context name -> then same as encodings.make_unicode_vector
177
178local function initialize()
179    for unicode, data in next, characters.data do
180        local encname = data.adobename or data.contextname
181        if encname then
182            enccodes[encname] = unicode
183        end
184    end
185    for name, unicode in next, characters.synonyms do
186        if not enccodes[name] then
187            enccodes[name] = unicode
188        end
189    end
190end
191
192setinitializer(enccodes,initialize)
193