2 * Copyright (c) 2014 - 2017 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>.
4 * Copyright (C) 2002 - 2004, 2006
5 * Free Software Foundation, Inc.
6 * Written by Werner Lemberg <wl@gnu.org>
8 * This is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2, or (at your option) any later
13 * This is distributed in the hope that it will be useful, but WITHOUT ANY
14 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * You should have received a copy of the GNU General Public License along
19 * with groff; see the file COPYING. If not, write to the Free Software
20 * Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
26 #include "stringclass.h"
30 struct unicode_to_glyph
{
34 declare_ptable(unicode_to_glyph
)
35 implement_ptable(unicode_to_glyph
)
37 PTABLE(unicode_to_glyph
) unicode_to_glyph_table
;
42 } unicode_to_glyph_list
[] = { // FIXME const
77 { "003D_0338", "!=" },
83 { "0041_0300", "`A" },
84 { "0041_0301", "'A" },
85 { "0041_0302", "^A" },
86 { "0041_0303", "~A" },
87 { "0041_0308", ":A" },
88 { "0041_030A", "oA" },
91 { "0043_0301", "'C" },
92 { "0043_0327", ",C" },
95 { "0045_0300", "`E" },
96 { "0045_0301", "'E" },
97 { "0045_0302", "^E" },
98 { "0045_0308", ":E" },
103 { "0049_0300", "`I" },
104 { "0049_0301", "'I" },
105 { "0049_0302", "^I" },
106 { "0049_0308", ":I" },
112 { "004E_0303", "~N" },
114 { "004F_0300", "`O" },
115 { "004F_0301", "'O" },
116 { "004F_0302", "^O" },
117 { "004F_0303", "~O" },
118 { "004F_0308", ":O" },
123 { "0053_030C", "vS" },
126 { "0055_0300", "`U" },
127 { "0055_0301", "'U" },
128 { "0055_0302", "^U" },
129 { "0055_0308", ":U" },
134 { "0059_0301", "'Y" },
135 { "0059_0308", ":Y" },
137 { "005A_030C", "vZ" },
152 { "0061_0300", "`a" },
153 { "0061_0301", "'a" },
154 { "0061_0302", "^a" },
155 { "0061_0303", "~a" },
156 { "0061_0308", ":a" },
157 { "0061_030A", "oa" },
160 { "0063_0301", "'c" },
161 { "0063_0327", ",c" },
164 { "0065_0300", "`e" },
165 { "0065_0301", "'e" },
166 { "0065_0302", "^e" },
167 { "0065_0308", ":e" },
169 { "0066_0066", "ff" },
170 { "0066_0066_0069", "Fi" },
171 { "0066_0066_006C", "Fl" },
172 { "0066_0069", "fi" },
173 { "0066_006C", "fl" },
177 { "0069_0300", "`i" },
178 { "0069_0301", "'i" },
179 { "0069_0302", "^i" },
180 { "0069_0308", ":i" },
186 { "006E_0303", "~n" },
188 { "006F_0300", "`o" },
189 { "006F_0301", "'o" },
190 { "006F_0302", "^o" },
191 { "006F_0303", "~o" },
192 { "006F_0308", ":o" },
197 { "0073_030C", "vs" },
200 { "0075_0300", "`u" },
201 { "0075_0301", "'u" },
202 { "0075_0302", "^u" },
203 { "0075_0308", ":u" },
208 { "0079_0301", "'y" },
209 { "0079_0308", ":y" },
211 { "007A_030C", "vz" },
235 // In groff, U+00AD is an input character only; it is not mapped to
236 // a glyph but to `\%'.
361 //{ "210F", "hbar" },
390 { "2208_0338", "nm" },
392 { "220F", "product" },
393 { "2210", "coproduct" },
408 //{ "222B", "integral" },
417 { "2261_0338", "ne" },
423 { "2282_0338", "nb" },
425 { "2283_0338", "nc" },
436 { "239B", "parenlefttp" },
437 { "239C", "parenleftex" },
438 { "239D", "parenleftbt" },
439 { "239E", "parenrighttp" },
440 { "239F", "parenrightex" },
441 { "23A0", "parenrightbt" },
442 //{ "23A1", "bracketlefttp" },
443 { "23A2", "bracketleftex" },
444 //{ "23A3", "bracketleftbt" },
445 //{ "23A4", "bracketrighttp" },
446 { "23A5", "bracketrightex" },
447 //{ "23A6", "bracketrightbt" },
449 //{ "23A7", "bracelefttp" },
451 //{ "23A8", "braceleftmid" },
453 //{ "23A9", "braceleftbt" },
455 //{ "23AA", "braceex" },
456 //{ "23AA", "braceleftex" },
457 //{ "23AA", "bracerightex" },
459 //{ "23AB", "bracerighttp" },
461 //{ "23AC", "bracerightmid" },
463 //{ "23AD", "bracerightbt" },
480 // global constructor
481 static struct unicode_to_glyph_init
{ /* FIXME ugh, static ctor init */
482 unicode_to_glyph_init();
483 } _unicode_to_glyph_init
;
485 unicode_to_glyph_init::unicode_to_glyph_init()
487 for (unsigned int i
= 0;
488 i
< sizeof(unicode_to_glyph_list
)/sizeof(unicode_to_glyph_list
[0]);
490 unicode_to_glyph
*utg
= new unicode_to_glyph
[1];
491 utg
->value
= (char *)unicode_to_glyph_list
[i
].value
;
492 unicode_to_glyph_table
.define(unicode_to_glyph_list
[i
].key
, utg
);
496 const char *unicode_to_glyph_name(const char *s
)
498 unicode_to_glyph
*result
= unicode_to_glyph_table
.lookup(s
);
499 return result
? result
->value
: 0;