2 /* Copyright (C) 2002, 2003, 2004
3 Free Software Foundation, Inc.
4 Written by Werner Lemberg <wl@gnu.org>
6 This file is part of groff.
8 groff 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 groff 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. */
23 #include "stringclass.h"
28 struct glyph_to_unicode {
32 declare_ptable(glyph_to_unicode)
33 implement_ptable(glyph_to_unicode)
35 PTABLE(glyph_to_unicode) glyph_to_unicode_table;
40 } glyph_to_unicode_list[] = {
125 { "ff", "0066_0066" },
126 { "Fi", "0066_0066_0069" },
127 { "Fl", "0066_0066_006C" },
128 { "fi", "0066_0069" },
129 { "fl", "0066_006C" },
390 { "product", "220F" },
391 { "coproduct", "2210" },
406 { "integral", "222B" },
435 { "parenlefttp", "239B" },
436 { "parenleftex", "239C" },
437 { "parenleftbt", "239D" },
438 { "parenrighttp", "239E" },
439 { "parenrightex", "239F" },
440 { "parenrightbt", "23A0" },
441 { "bracketlefttp", "23A1" },
442 { "bracketleftex", "23A2" },
443 { "bracketleftbt", "23A3" },
444 { "bracketrighttp", "23A4" },
445 { "bracketrightex", "23A5" },
446 { "bracketrightbt", "23A6" },
448 { "bracelefttp", "23A7" },
450 { "braceleftmid", "23A8" },
452 { "braceleftbt", "23A9" },
454 { "braceex", "23AA" },
455 { "braceleftex", "23AA" },
456 { "bracerightex", "23AA" },
458 { "bracerighttp", "23AB" },
460 { "bracerightmid", "23AC" },
462 { "bracerightbt", "23AD" },
485 // global constructor
486 static struct glyph_to_unicode_init {
487 glyph_to_unicode_init();
488 } _glyph_to_unicode_init;
490 glyph_to_unicode_init::glyph_to_unicode_init() {
491 for (unsigned int i = 0;
492 i < sizeof(glyph_to_unicode_list)/sizeof(glyph_to_unicode_list[0]);
494 glyph_to_unicode *gtu = new glyph_to_unicode[1];
495 gtu->value = (char *)glyph_to_unicode_list[i].value;
496 glyph_to_unicode_table.define(glyph_to_unicode_list[i].key, gtu);
500 const char *glyph_name_to_unicode(const char *s)
502 glyph_to_unicode *result = glyph_to_unicode_table.lookup(s);
503 return result ? result->value : 0;