cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / third_party / harfbuzz-ng / src / hb-ucdn.cc
blob61e6ad362298d076b1257de0e1b4036d954af23a
1 /*
2 * Copyright (C) 2012 Grigori Goronzy <greg@kinoho.net>
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #include "hb-private.hh"
19 #include "hb-unicode-private.hh"
21 #include "ucdn.h"
23 static const hb_script_t ucdn_script_translate[] =
25 HB_SCRIPT_COMMON,
26 HB_SCRIPT_LATIN,
27 HB_SCRIPT_GREEK,
28 HB_SCRIPT_CYRILLIC,
29 HB_SCRIPT_ARMENIAN,
30 HB_SCRIPT_HEBREW,
31 HB_SCRIPT_ARABIC,
32 HB_SCRIPT_SYRIAC,
33 HB_SCRIPT_THAANA,
34 HB_SCRIPT_DEVANAGARI,
35 HB_SCRIPT_BENGALI,
36 HB_SCRIPT_GURMUKHI,
37 HB_SCRIPT_GUJARATI,
38 HB_SCRIPT_ORIYA,
39 HB_SCRIPT_TAMIL,
40 HB_SCRIPT_TELUGU,
41 HB_SCRIPT_KANNADA,
42 HB_SCRIPT_MALAYALAM,
43 HB_SCRIPT_SINHALA,
44 HB_SCRIPT_THAI,
45 HB_SCRIP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RIPT_SAURASHTRA,
96 HB_SCRIPT_KAYAH_LI,
97 HB_SCRIPT_REJANG,
98 HB_SCRIPT_LYCIAN,
99 HB_SCRIPT_CARIAN,
100 HB_SCRIPT_LYDIAN,
101 HB_SCRIPT_CHAM,
102 HB_SCRIPT_TAI_THAM,
103 HB_SCRIPT_TAI_VIET,
104 HB_SCRIPT_AVESTAN,
105 HB_SCRIPT_EGYPTIAN_HIEROGLYPHS,
106 HB_SCRIPT_SAMARITAN,
107 HB_SCRIPT_LISU,
108 HB_SCRIPT_BAMUM,
109 HB_SCRIPT_JAVANESE,
110 HB_SCRIPT_MEETEI_MAYEK,
111 HB_SCRIPT_IMPERIAL_ARAMAIC,
112 HB_SCRIPT_OLD_SOUTH_ARABIAN,
113 HB_SCRIPT_INSCRIPTIONAL_PARTHIAN,
114 HB_SCRIPT_INSCRIPTIONAL_PAHLAVI,
115 HB_SCRIPT_OLD_TURKIC,
116 HB_SCRIPT_KAITHI,
117 HB_SCRIPT_BATAK,
118 HB_SCRIPT_BRAHMI,
119 HB_SCRIPT_MANDAIC,
120 HB_SCRIPT_CHAKMA,
121 HB_SCRIPT_MEROITIC_CURSIVE,
122 HB_SCRIPT_MEROITIC_HIEROGLYPHS,
123 HB_SCRIPT_MIAO,
124 HB_SCRIPT_SHARADA,
125 HB_SCRIPT_SORA_SOMPENG,
126 HB_SCRIPT_TAKRI,
127 HB_SCRIPT_UNKNOWN,
130 static hb_unicode_combining_class_t
131 hb_ucdn_combining_class(hb_unicode_funcs_t *ufuncs, hb_codepoint_t unicode,
132 void *user_data HB_UNUSED)
134 return (hb_unicode_combining_class_t) ucdn_get_combining_class(unicode);
137 static unsigned int
138 hb_ucdn_eastasian_width(hb_unicode_funcs_t *ufuncs, hb_codepoint_t unicode,
139 void *user_data HB_UNUSED)
141 int w = ucdn_get_east_asian_width(unicode);
142 return (w == UCDN_EAST_ASIAN_F || w == UCDN_EAST_ASIAN_W) ? 2 : 1;
145 static hb_unicode_general_category_t
146 hb_ucdn_general_category(hb_unicode_funcs_t *ufuncs, hb_codepoint_t unicode,
147 void *user_data HB_UNUSED)
149 return (hb_unicode_general_category_t)ucdn_get_general_category(unicode);
152 static hb_codepoint_t
153 hb_ucdn_mirroring(hb_unicode_funcs_t *ufuncs, hb_codepoint_t unicode,
154 void *user_data HB_UNUSED)
156 return ucdn_mirror(unicode);
159 static hb_script_t
160 hb_ucdn_script(hb_unicode_funcs_t *ufuncs, hb_codepoint_t unicode,
161 void *user_data HB_UNUSED)
163 return ucdn_script_translate[ucdn_get_script(unicode)];
166 static hb_bool_t
167 hb_ucdn_compose(hb_unicode_funcs_t *ufuncs,
168 hb_codepoint_t a, hb_codepoint_t b, hb_codepoint_t *ab,
169 void *user_data HB_UNUSED)
171 return ucdn_compose(ab, a, b);
174 static hb_bool_t
175 hb_ucdn_decompose(hb_unicode_funcs_t *ufuncs,
176 hb_codepoint_t ab, hb_codepoint_t *a, hb_codepoint_t *b,
177 void *user_data HB_UNUSED)
179 return ucdn_decompose(ab, a, b);
182 static unsigned int
183 hb_ucdn_decompose_compatibility(hb_unicode_funcs_t *ufuncs,
184 hb_codepoint_t u, hb_codepoint_t *decomposed,
185 void *user_data HB_UNUSED)
187 return ucdn_compat_decompose(u, decomposed);
190 extern "C" HB_INTERNAL
191 hb_unicode_funcs_t *
192 hb_ucdn_get_unicode_funcs (void)
194 static const hb_unicode_funcs_t _hb_ucdn_unicode_funcs = {
195 HB_OBJECT_HEADER_STATIC,
197 NULL, /* parent */
198 true, /* immutable */
200 #define HB_UNICODE_FUNC_IMPLEMENT(name) hb_ucdn_##name,
201 HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
202 #undef HB_UNICODE_FUNC_IMPLEMENT
206 return const_cast<hb_unicode_funcs_t *> (&_hb_ucdn_unicode_funcs);