1
/* $XConsortium: DviChar.c,v 1.7 91/07/31 00:39:31 keith Exp $ */
6
* Map DVI (ditrof output) character names to
7
* font indexes and back
9
/* $XFree86: xc/programs/xditview/DviChar.c,v 1.3 2001/08/28 16:48:09 tsi Exp $ */
11
# include <X11/Intrinsic.h>
14
# define allocHash() ((DviCharNameHash *) XtMalloc (sizeof (DviCharNameHash)))
17
struct map_list *next;
21
static struct map_list *world;
23
static int standard_maps_loaded = 0;
24
static void load_standard_maps (void);
25
static int hash_name (char *name);
26
static void dispose_hash(DviCharNameMap *map);
27
static void compute_hash(DviCharNameMap *map);
35
if (!standard_maps_loaded)
36
load_standard_maps ();
37
for (m = world; m; m=m->next)
38
if (!strcmp (m->map->encoding, encoding))
49
if (!standard_maps_loaded)
50
load_standard_maps ();
51
for (m = world; m; m = m->next)
52
if (!strcmp (m->map->encoding, map->encoding))
55
m = (struct map_list *) XtMalloc (sizeof *m);
68
DviCharNameHash **buckets;
69
DviCharNameHash *h, *next;
72
buckets = map->buckets;
73
for (i = 0; i < DVI_HASH_SIZE; i++) {
74
for (h = buckets[i]; h; h=next) {
88
i = (i << 1) ^ *name++;
98
DviCharNameHash **buckets;
102
buckets = map->buckets;
103
for (i = 0; i < DVI_HASH_SIZE; i++)
105
for (c = 0; c < DVI_MAP_SIZE; c++)
106
for (s = 0; s < DVI_MAX_SYNONYMS; s++) {
107
if (!map->dvi_names[c][s])
109
i = hash_name (map->dvi_names[c][s]) % DVI_HASH_SIZE;
111
h->next = buckets[i];
113
h->name = map->dvi_names[c][s];
120
DviCharIndex (map, name)
127
i = hash_name (name) % DVI_HASH_SIZE;
128
for (h = map->buckets[i]; h; h=h->next)
129
if (!strcmp (h->name, name))
134
static DviCharNameMap ISO8859_1_map = {
183
{ "-","\\-", /* 45 */},
185
{ "/","sl", /* 47 */},
199
{ "=","eq", /* 61 */},
233
{ "_","ru","ul", /* 95 */},
262
{ "|","or" /* 124 */},
264
{ "a~","ap" /* 126 */},
405
static DviCharNameMap Adobe_Symbol_map = {
406
"adobe-fontspecific",
452
{ "+","pl", /* 43 */},
454
{ "-","mi","\\-", /* 45 */},
456
{ "/","sl", /* 47 */},
470
{ "=","eq", /* 61 */},
535
{ "a~","ap", /* 126 */},
571
{ "fm","mt", /* 162 */},
573
{ "/","sl" /* 164 */},
672
load_standard_maps ()
674
standard_maps_loaded = 1;
675
DviRegisterMap (&ISO8859_1_map);
676
DviRegisterMap (&Adobe_Symbol_map);