2 /* Copyright (C) 2002, 2003
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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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" },
405 { "integral", "222B" },
434 { "parenlefttp", "239B" },
435 { "parenleftex", "239C" },
436 { "parenleftbt", "239D" },
437 { "parenrighttp", "239E" },
438 { "parenrightex", "239F" },
439 { "parenrightbt", "23A0" },
440 { "bracketlefttp", "23A1" },
441 { "bracketleftex", "23A2" },
442 { "bracketleftbt", "23A3" },
443 { "bracketrighttp", "23A4" },
444 { "bracketrightex", "23A5" },
445 { "bracketrightbt", "23A6" },
447 { "bracelefttp", "23A7" },
449 { "braceleftmid", "23A8" },
451 { "braceleftbt", "23A9" },
453 { "braceex", "23AA" },
454 { "braceleftex", "23AA" },
455 { "bracerightex", "23AA" },
457 { "bracerighttp", "23AB" },
459 { "bracerightmid", "23AC" },
461 { "bracerightbt", "23AD" },
484 // global constructor
485 static struct glyph_to_unicode_init
{
486 glyph_to_unicode_init();
487 } _glyph_to_unicode_init
;
489 glyph_to_unicode_init::glyph_to_unicode_init() {
490 for (unsigned int i
= 0;
491 i
< sizeof(glyph_to_unicode_list
)/sizeof(glyph_to_unicode_list
[0]);
493 glyph_to_unicode
*gtu
= new glyph_to_unicode
[1];
494 gtu
->value
= (char *)glyph_to_unicode_list
[i
].value
;
495 glyph_to_unicode_table
.define(glyph_to_unicode_list
[i
].key
, gtu
);
499 const char *glyph_name_to_unicode(const char *s
)
501 glyph_to_unicode
*result
= glyph_to_unicode_table
.lookup(s
);
502 return result
? result
->value
: 0;