OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2009 Red Hat, Inc. | 2 * Copyright © 2009 Red Hat, Inc. |
3 * Copyright © 2011 Codethink Limited | 3 * Copyright © 2011 Codethink Limited |
4 * Copyright © 2010,2011,2012 Google, Inc. | 4 * Copyright © 2010,2011,2012 Google, Inc. |
5 * | 5 * |
6 * This is part of HarfBuzz, a text shaping library. | 6 * This is part of HarfBuzz, a text shaping library. |
7 * | 7 * |
8 * Permission is hereby granted, without written agreement and without | 8 * Permission is hereby granted, without written agreement and without |
9 * license or royalty fees, to use, copy, modify, and distribute this | 9 * license or royalty fees, to use, copy, modify, and distribute this |
10 * software and its documentation for any purpose, provided that the | 10 * software and its documentation for any purpose, provided that the |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 /* Other planes */ | 192 /* Other planes */ |
193 switch (plane) { | 193 switch (plane) { |
194 case 0x01: return hb_in_ranges (ch, 0x1BCA0u, 0x1BCA3u, | 194 case 0x01: return hb_in_ranges (ch, 0x1BCA0u, 0x1BCA3u, |
195 0x1D173u, 0x1D17Au); | 195 0x1D173u, 0x1D17Au); |
196 case 0x0E: return hb_in_range (ch, 0xE0000u, 0xE0FFFu); | 196 case 0x0E: return hb_in_range (ch, 0xE0000u, 0xE0FFFu); |
197 default: return false; | 197 default: return false; |
198 } | 198 } |
199 } | 199 } |
200 } | 200 } |
201 | 201 |
| 202 /* Space estimates based on: |
| 203 * http://www.unicode.org/charts/PDF/U2000.pdf |
| 204 * https://www.microsoft.com/typography/developers/fdsspec/spaces.aspx |
| 205 */ |
| 206 enum space_t { |
| 207 NOT_SPACE = 0, |
| 208 SPACE_EM = 1, |
| 209 SPACE_EM_2 = 2, |
| 210 SPACE_EM_3 = 3, |
| 211 SPACE_EM_4 = 4, |
| 212 SPACE_EM_5 = 5, |
| 213 SPACE_EM_6 = 6, |
| 214 SPACE_EM_16 = 16, |
| 215 SPACE_4_EM_18, /* 4/18th of an EM! */ |
| 216 SPACE, |
| 217 SPACE_FIGURE, |
| 218 SPACE_PUNCTUATION, |
| 219 SPACE_NARROW, |
| 220 }; |
| 221 static inline space_t |
| 222 space_fallback_type (hb_codepoint_t u) |
| 223 { |
| 224 switch (u) |
| 225 { |
| 226 /* All GC=Zs chars that can use a fallback. */ |
| 227 default: return NOT_SPACE; /* Shouldn't happen. */ |
| 228 case 0x0020u: return SPACE; /* U+0020 SPACE */ |
| 229 case 0x00A0u: return SPACE; /* U+00A0 NO-BREAK SPACE */ |
| 230 case 0x2000u: return SPACE_EM_2; /* U+2000 EN QUAD */ |
| 231 case 0x2001u: return SPACE_EM; /* U+2001 EM QUAD */ |
| 232 case 0x2002u: return SPACE_EM_2; /* U+2002 EN SPACE */ |
| 233 case 0x2003u: return SPACE_EM; /* U+2003 EM SPACE */ |
| 234 case 0x2004u: return SPACE_EM_3; /* U+2004 THREE-PER-EM SPACE */ |
| 235 case 0x2005u: return SPACE_EM_4; /* U+2005 FOUR-PER-EM SPACE */ |
| 236 case 0x2006u: return SPACE_EM_6; /* U+2006 SIX-PER-EM SPACE */ |
| 237 case 0x2007u: return SPACE_FIGURE; /* U+2007 FIGURE SPACE */ |
| 238 case 0x2008u: return SPACE_PUNCTUATION; /* U+2008 PUNCTUATION SPACE */ |
| 239 case 0x2009u: return SPACE_EM_5; /* U+2009 THIN SPACE */ |
| 240 case 0x200Au: return SPACE_EM_16; /* U+200A HAIR SPACE */ |
| 241 case 0x202Fu: return SPACE_NARROW; /* U+202F NARROW NO-BREAK SPACE
*/ |
| 242 case 0x205Fu: return SPACE_4_EM_18; /* U+205F MEDIUM MATHEMATICAL SP
ACE */ |
| 243 case 0x3000u: return SPACE_EM; /* U+3000 IDEOGRAPHIC SPACE */ |
| 244 } |
| 245 } |
202 | 246 |
203 struct { | 247 struct { |
204 #define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_func_t name; | 248 #define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_func_t name; |
205 HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS | 249 HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS |
206 #undef HB_UNICODE_FUNC_IMPLEMENT | 250 #undef HB_UNICODE_FUNC_IMPLEMENT |
207 } func; | 251 } func; |
208 | 252 |
209 struct { | 253 struct { |
210 #define HB_UNICODE_FUNC_IMPLEMENT(name) void *name; | 254 #define HB_UNICODE_FUNC_IMPLEMENT(name) void *name; |
211 HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS | 255 HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 350 |
307 | 351 |
308 /* Misc */ | 352 /* Misc */ |
309 | 353 |
310 #define HB_UNICODE_GENERAL_CATEGORY_IS_MARK(gen_cat) \ | 354 #define HB_UNICODE_GENERAL_CATEGORY_IS_MARK(gen_cat) \ |
311 (FLAG_SAFE (gen_cat) & \ | 355 (FLAG_SAFE (gen_cat) & \ |
312 (FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) | \ | 356 (FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) | \ |
313 FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) | \ | 357 FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) | \ |
314 FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK))) | 358 FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK))) |
315 | 359 |
| 360 #define HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK(gen_cat) \ |
| 361 (FLAG_SAFE (gen_cat) & \ |
| 362 (FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) | \ |
| 363 FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK))) |
316 | 364 |
317 #endif /* HB_UNICODE_PRIVATE_HH */ | 365 #endif /* HB_UNICODE_PRIVATE_HH */ |
OLD | NEW |