| Index: third_party/harfbuzz-ng/src/hb-unicode.cc
|
| diff --git a/third_party/harfbuzz-ng/src/hb-unicode.cc b/third_party/harfbuzz-ng/src/hb-unicode.cc
|
| index 1d6eacb0fa4f5036ea14a622957f69260d50325c..2e2d077ec0ae34bf4156932d81d7681649424003 100644
|
| --- a/third_party/harfbuzz-ng/src/hb-unicode.cc
|
| +++ b/third_party/harfbuzz-ng/src/hb-unicode.cc
|
| @@ -1,7 +1,7 @@
|
| /*
|
| * Copyright © 2009 Red Hat, Inc.
|
| - * Copyright © 2011 Codethink Limited
|
| - * Copyright © 2010,2011 Google, Inc.
|
| + * Copyright © 2011 Codethink Limited
|
| + * Copyright © 2010,2011,2012 Google, Inc.
|
| *
|
| * This is part of HarfBuzz, a text shaping library.
|
| *
|
| @@ -38,12 +38,12 @@
|
| * hb_unicode_funcs_t
|
| */
|
|
|
| -static unsigned int
|
| +static hb_unicode_combining_class_t
|
| hb_unicode_combining_class_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED,
|
| hb_codepoint_t unicode HB_UNUSED,
|
| void *user_data HB_UNUSED)
|
| {
|
| - return 0;
|
| + return HB_UNICODE_COMBINING_CLASS_NOT_REORDERED;
|
| }
|
|
|
| static unsigned int
|
| @@ -99,13 +99,54 @@ hb_unicode_decompose_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED,
|
| }
|
|
|
|
|
| +static unsigned int
|
| +hb_unicode_decompose_compatibility_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED,
|
| + hb_codepoint_t u HB_UNUSED,
|
| + hb_codepoint_t *decomposed HB_UNUSED,
|
| + void *user_data HB_UNUSED)
|
| +{
|
| + return 0;
|
| +}
|
| +
|
| +
|
| +#define HB_UNICODE_FUNCS_IMPLEMENT_SET \
|
| + HB_UNICODE_FUNCS_IMPLEMENT (glib) \
|
| + HB_UNICODE_FUNCS_IMPLEMENT (icu) \
|
| + HB_UNICODE_FUNCS_IMPLEMENT (nil) \
|
| + /* ^--- Add new callbacks before nil */
|
| +
|
| +#define hb_nil_get_unicode_funcs hb_unicode_funcs_get_empty
|
| +
|
| +/* Prototype them all */
|
| +#define HB_UNICODE_FUNCS_IMPLEMENT(set) \
|
| +extern "C" hb_unicode_funcs_t *hb_##set##_get_unicode_funcs (void);
|
| +HB_UNICODE_FUNCS_IMPLEMENT_SET
|
| +#undef HB_UNICODE_FUNCS_IMPLEMENT
|
| +
|
|
|
| hb_unicode_funcs_t *
|
| hb_unicode_funcs_get_default (void)
|
| {
|
| - return const_cast<hb_unicode_funcs_t *> (&_hb_unicode_funcs_default);
|
| +#define HB_UNICODE_FUNCS_IMPLEMENT(set) \
|
| + return hb_##set##_get_unicode_funcs ();
|
| +
|
| +#ifdef HAVE_GLIB
|
| + HB_UNICODE_FUNCS_IMPLEMENT(glib)
|
| +#elif defined(HAVE_ICU)
|
| + HB_UNICODE_FUNCS_IMPLEMENT(icu)
|
| +#else
|
| +#define HB_UNICODE_FUNCS_NIL 1
|
| + HB_UNICODE_FUNCS_IMPLEMENT(nil)
|
| +#endif
|
| +
|
| +#undef HB_UNICODE_FUNCS_IMPLEMENT
|
| }
|
|
|
| +#if !defined(HB_NO_UNICODE_FUNCS) && defined(HB_UNICODE_FUNCS_NIL)
|
| +#pragma message("Could not find any Unicode functions implementation, you have to provide your own.")
|
| +#pragma message("To suppress this warnings, define HB_NO_UNICODE_FUNCS.")
|
| +#endif
|
| +
|
| hb_unicode_funcs_t *
|
| hb_unicode_funcs_create (hb_unicode_funcs_t *parent)
|
| {
|
| @@ -131,7 +172,6 @@ hb_unicode_funcs_create (hb_unicode_funcs_t *parent)
|
| }
|
|
|
|
|
| -extern HB_INTERNAL const hb_unicode_funcs_t _hb_unicode_funcs_nil;
|
| const hb_unicode_funcs_t _hb_unicode_funcs_nil = {
|
| HB_OBJECT_HEADER_STATIC,
|
|
|
| @@ -236,7 +276,7 @@ hb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t *ufuncs, \
|
| } \
|
| }
|
|
|
| - HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
|
| +HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
|
| #undef HB_UNICODE_FUNC_IMPLEMENT
|
|
|
|
|
| @@ -246,9 +286,9 @@ return_type \
|
| hb_unicode_##name (hb_unicode_funcs_t *ufuncs, \
|
| hb_codepoint_t unicode) \
|
| { \
|
| - return ufuncs->func.name (ufuncs, unicode, ufuncs->user_data.name); \
|
| + return ufuncs->name (unicode); \
|
| }
|
| - HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
|
| +HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
|
| #undef HB_UNICODE_FUNC_IMPLEMENT
|
|
|
| hb_bool_t
|
| @@ -257,8 +297,7 @@ hb_unicode_compose (hb_unicode_funcs_t *ufuncs,
|
| hb_codepoint_t b,
|
| hb_codepoint_t *ab)
|
| {
|
| - *ab = 0;
|
| - return ufuncs->func.compose (ufuncs, a, b, ab, ufuncs->user_data.compose);
|
| + return ufuncs->compose (a, b, ab);
|
| }
|
|
|
| hb_bool_t
|
| @@ -267,62 +306,127 @@ hb_unicode_decompose (hb_unicode_funcs_t *ufuncs,
|
| hb_codepoint_t *a,
|
| hb_codepoint_t *b)
|
| {
|
| - *a = ab; *b = 0;
|
| - return ufuncs->func.decompose (ufuncs, ab, a, b, ufuncs->user_data.decompose);
|
| + return ufuncs->decompose (ab, a, b);
|
| }
|
|
|
| -
|
| -
|
| unsigned int
|
| -_hb_unicode_modified_combining_class (hb_unicode_funcs_t *ufuncs,
|
| - hb_codepoint_t unicode)
|
| +hb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs,
|
| + hb_codepoint_t u,
|
| + hb_codepoint_t *decomposed)
|
| {
|
| - int c = hb_unicode_combining_class (ufuncs, unicode);
|
| -
|
| - if (unlikely (hb_in_range<int> (c, 27, 33)))
|
| - {
|
| - /* Modify the combining-class to suit Arabic better. See:
|
| - * http://unicode.org/faq/normalization.html#8
|
| - * http://unicode.org/faq/normalization.html#9
|
| - */
|
| - c = c == 33 ? 27 : c + 1;
|
| - }
|
| - else if (unlikely (hb_in_range<int> (c, 10, 25)))
|
| - {
|
| - /* The equivalent fix for Hebrew is more complex.
|
| - *
|
| - * We permute the "fixed-position" classes 10-25 into the order
|
| - * described in the SBL Hebrew manual:
|
| - *
|
| - * http://www.sbl-site.org/Fonts/SBLHebrewUserManual1.5x.pdf
|
| - *
|
| - * (as recommended by:
|
| - * http://forum.fontlab.com/archive-old-microsoft-volt-group/vista-and-diacritic-ordering-t6751.0.html)
|
| - *
|
| - * More details here:
|
| - * https://bugzilla.mozilla.org/show_bug.cgi?id=662055
|
| - */
|
| - static const int permuted_hebrew_classes[25 - 10 + 1] = {
|
| - /* 10 sheva */ 22,
|
| - /* 11 hataf segol */ 15,
|
| - /* 12 hataf patah */ 16,
|
| - /* 13 hataf qamats */ 17,
|
| - /* 14 hiriq */ 23,
|
| - /* 15 tsere */ 18,
|
| - /* 16 segol */ 19,
|
| - /* 17 patah */ 20,
|
| - /* 18 qamats */ 21,
|
| - /* 19 holam */ 14,
|
| - /* 20 qubuts */ 24,
|
| - /* 21 dagesh */ 12,
|
| - /* 22 meteg */ 25,
|
| - /* 23 rafe */ 13,
|
| - /* 24 shin dot */ 10,
|
| - /* 25 sin dot */ 11,
|
| - };
|
| - c = permuted_hebrew_classes[c - 10];
|
| - }
|
| -
|
| - return c;
|
| + return ufuncs->decompose_compatibility (u, decomposed);
|
| }
|
|
|
| +
|
| +/* See hb-unicode-private.hh for details. */
|
| +const uint8_t
|
| +_hb_modified_combining_class[256] =
|
| +{
|
| + 0, /* HB_UNICODE_COMBINING_CLASS_NOT_REORDERED */
|
| + 1, /* HB_UNICODE_COMBINING_CLASS_OVERLAY */
|
| + 2, 3, 4, 5, 6,
|
| + 7, /* HB_UNICODE_COMBINING_CLASS_NUKTA */
|
| + 8, /* HB_UNICODE_COMBINING_CLASS_KANA_VOICING */
|
| + 9, /* HB_UNICODE_COMBINING_CLASS_VIRAMA */
|
| +
|
| + /* Hebrew */
|
| + HB_MODIFIED_COMBINING_CLASS_CCC10,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC11,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC12,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC13,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC14,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC15,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC16,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC17,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC18,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC19,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC20,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC21,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC22,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC23,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC24,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC25,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC26,
|
| +
|
| + /* Arabic */
|
| + HB_MODIFIED_COMBINING_CLASS_CCC27,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC28,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC29,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC30,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC31,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC32,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC33,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC34,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC35,
|
| +
|
| + /* Syriac */
|
| + HB_MODIFIED_COMBINING_CLASS_CCC36,
|
| +
|
| + 37, 38, 39,
|
| + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
|
| + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
|
| + 80, 81, 82, 83,
|
| +
|
| + /* Telugu */
|
| + HB_MODIFIED_COMBINING_CLASS_CCC84,
|
| + 85, 86, 87, 88, 89, 90,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC91,
|
| + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
|
| +
|
| + /* Thai */
|
| + HB_MODIFIED_COMBINING_CLASS_CCC103,
|
| + 104, 105, 106,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC107,
|
| + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
|
| +
|
| + /* Lao */
|
| + HB_MODIFIED_COMBINING_CLASS_CCC118,
|
| + 119, 120, 121,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC122,
|
| + 123, 124, 125, 126, 127, 128,
|
| +
|
| + /* Tibetan */
|
| + HB_MODIFIED_COMBINING_CLASS_CCC129,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC130,
|
| + 131,
|
| + HB_MODIFIED_COMBINING_CLASS_CCC132,
|
| + 133, 134, 135, 136, 137, 138, 139,
|
| +
|
| +
|
| + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
|
| + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
|
| + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
|
| + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
|
| + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
|
| + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
|
| +
|
| + 200, /* HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW_LEFT */
|
| + 201,
|
| + 202, /* HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW */
|
| + 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
|
| + 214, /* HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE */
|
| + 215,
|
| + 216, /* HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE_RIGHT */
|
| + 217,
|
| + 218, /* HB_UNICODE_COMBINING_CLASS_BELOW_LEFT */
|
| + 219,
|
| + 220, /* HB_UNICODE_COMBINING_CLASS_BELOW */
|
| + 221,
|
| + 222, /* HB_UNICODE_COMBINING_CLASS_BELOW_RIGHT */
|
| + 223,
|
| + 224, /* HB_UNICODE_COMBINING_CLASS_LEFT */
|
| + 225,
|
| + 226, /* HB_UNICODE_COMBINING_CLASS_RIGHT */
|
| + 227,
|
| + 228, /* HB_UNICODE_COMBINING_CLASS_ABOVE_LEFT */
|
| + 229,
|
| + 230, /* HB_UNICODE_COMBINING_CLASS_ABOVE */
|
| + 231,
|
| + 232, /* HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT */
|
| + 233, /* HB_UNICODE_COMBINING_CLASS_DOUBLE_BELOW */
|
| + 234, /* HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE */
|
| + 235, 236, 237, 238, 239,
|
| + 240, /* HB_UNICODE_COMBINING_CLASS_IOTA_SUBSCRIPT */
|
| + 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
|
| + 255, /* HB_UNICODE_COMBINING_CLASS_INVALID */
|
| +};
|
|
|