Imported Upstream version 1.22.4
[platform/upstream/groff.git] / src / include / unicode.h
1 // -*- C++ -*-
2 /* Copyright (C) 2002-2018 Free Software Foundation, Inc.
3      Written by Werner Lemberg <wl@gnu.org>
4
5 This file is part of groff.
6
7 groff is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 groff is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
19
20 // Convert a groff glyph name to a string containing an underscore-separated
21 // list of Unicode code points.  For example,
22 //
23 //   '-'   ->  '2010'
24 //   ',c'  ->  '00E7'
25 //   'fl'  ->  '0066_006C'
26 //
27 // Return NULL if there is no equivalent.
28 const char *glyph_name_to_unicode(const char *);
29
30 // Convert a string containing an underscore-separated list of Unicode code
31 // points to a groff glyph name.  For example,
32 //
33 //   '2010'       ->  'hy'
34 //   '0066_006C'  ->  'fl'
35 //
36 // Return NULL if there is no equivalent.
37 const char *unicode_to_glyph_name(const char *);
38
39 // Convert a string containing a precomposed Unicode character to a string
40 // containing an underscore-separated list of Unicode code points,
41 // representing its canonical decomposition.  Also perform compatibility
42 // equivalent replacement.  For example,
43 //
44 //   '1F3A' -> '0399_0313_0300'
45 //   'FA6A' -> '983B'
46 //
47 // Return NULL if there is no equivalent.
48 const char *decompose_unicode(const char *);
49
50 // Test whether the given string denotes a Unicode character.  It must
51 // be of the form 'uNNNN', obeying the following rules.
52 //
53 //   - 'NNNN' must consist of at least 4 hexadecimal digits in upper case.
54 //   - If there are more than 4 hexadecimal digits, the leading one must not
55 //     be zero,
56 //   - 'NNNN' must denote a valid Unicode code point (U+0000..U+10FFFF,
57 //     excluding surrogate code points.
58 //
59 // Return a pointer to 'NNNN' (skipping the leading 'u' character) in case
60 // of success, NULL otherwise.
61 const char *check_unicode_name(const char *);
62
63 // end of unicode.h