4 /* Copyright (C) 2002, 2003, 2004
5 Free Software Foundation, Inc.
6 Written by Werner Lemberg <wl@gnu.org>
8 This file is part of groff.
10 groff is free software; you can redistribute it and/or modify it under
11 the terms of the GNU General Public License as published by the Free
12 Software Foundation; either version 2, or (at your option) any later
15 groff is distributed in the hope that it will be useful, but WITHOUT ANY
16 WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 You should have received a copy of the GNU General Public License along
21 with groff; see the file COPYING. If not, write to the Free Software
22 Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
25 #include "stringclass.h"
30 struct glyph_to_unicode
{
34 declare_ptable(glyph_to_unicode
)
35 implement_ptable(glyph_to_unicode
)
37 PTABLE(glyph_to_unicode
) glyph_to_unicode_table
;
42 } glyph_to_unicode_list
[] = {
127 { "ff", "0066_0066" },
128 { "Fi", "0066_0066_0069" },
129 { "Fl", "0066_0066_006C" },
130 { "fi", "0066_0069" },
131 { "fl", "0066_006C" },
392 { "product", "220F" },
393 { "coproduct", "2210" },
408 { "integral", "222B" },
437 { "parenlefttp", "239B" },
438 { "parenleftex", "239C" },
439 { "parenleftbt", "239D" },
440 { "parenrighttp", "239E" },
441 { "parenrightex", "239F" },
442 { "parenrightbt", "23A0" },
443 { "bracketlefttp", "23A1" },
444 { "bracketleftex", "23A2" },
445 { "bracketleftbt", "23A3" },
446 { "bracketrighttp", "23A4" },
447 { "bracketrightex", "23A5" },
448 { "bracketrightbt", "23A6" },
450 { "bracelefttp", "23A7" },
452 { "braceleftmid", "23A8" },
454 { "braceleftbt", "23A9" },
456 { "braceex", "23AA" },
457 { "braceleftex", "23AA" },
458 { "bracerightex", "23AA" },
460 { "bracerighttp", "23AB" },
462 { "bracerightmid", "23AC" },
464 { "bracerightbt", "23AD" },
487 // global constructor
488 static struct glyph_to_unicode_init
{
489 glyph_to_unicode_init();
490 } _glyph_to_unicode_init
;
492 glyph_to_unicode_init::glyph_to_unicode_init() {
493 for (unsigned int i
= 0;
494 i
< sizeof(glyph_to_unicode_list
)/sizeof(glyph_to_unicode_list
[0]);
496 glyph_to_unicode
*gtu
= new glyph_to_unicode
[1];
497 gtu
->value
= (char *)glyph_to_unicode_list
[i
].value
;
498 glyph_to_unicode_table
.define(glyph_to_unicode_list
[i
].key
, gtu
);
502 const char *glyph_name_to_unicode(const char *s
)
504 glyph_to_unicode
*result
= glyph_to_unicode_table
.lookup(s
);
505 return result
? result
->value
: 0;