diff --git a/src/hb-ot-shape-private.hh b/src/hb-ot-shape-private.hh index 87e8ddbae..78564f835 100644 --- a/src/hb-ot-shape-private.hh +++ b/src/hb-ot-shape-private.hh @@ -98,59 +98,6 @@ is_variation_selector (hb_codepoint_t unicode) (unicode >= 0xE0100 && unicode <= 0xE01EF)); /* VARIATION SELECTOR-17..256 */ } -static inline unsigned int -_hb_unicode_modified_combining_class (hb_unicode_funcs_t *ufuncs, - hb_codepoint_t unicode) -{ - int c = hb_unicode_combining_class (ufuncs, unicode); - - if (unlikely (hb_in_range (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 (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; -} - static inline void hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *unicode) { diff --git a/src/hb-unicode-private.hh b/src/hb-unicode-private.hh index 2ad8a4984..7fdf646df 100644 --- a/src/hb-unicode-private.hh +++ b/src/hb-unicode-private.hh @@ -102,6 +102,9 @@ extern HB_INTERNAL hb_unicode_funcs_t _hb_unicode_funcs_nil; #endif +HB_INTERNAL unsigned int +_hb_unicode_modified_combining_class (hb_unicode_funcs_t *ufuncs, + hb_codepoint_t unicode); #endif /* HB_UNICODE_PRIVATE_HH */ diff --git a/src/hb-unicode.cc b/src/hb-unicode.cc index 4b285c5e1..a660ccc2e 100644 --- a/src/hb-unicode.cc +++ b/src/hb-unicode.cc @@ -271,3 +271,58 @@ hb_unicode_decompose (hb_unicode_funcs_t *ufuncs, return ufuncs->func.decompose (ufuncs, ab, a, b, ufuncs->user_data.decompose); } + + +unsigned int +_hb_unicode_modified_combining_class (hb_unicode_funcs_t *ufuncs, + hb_codepoint_t unicode) +{ + int c = hb_unicode_combining_class (ufuncs, unicode); + + if (unlikely (hb_in_range (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 (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; +} +