| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright © 2010,2012 Google, Inc. | 2 * Copyright © 2010,2012 Google, Inc. |
| 3 * | 3 * |
| 4 * This is part of HarfBuzz, a text shaping library. | 4 * This is part of HarfBuzz, a text shaping library. |
| 5 * | 5 * |
| 6 * Permission is hereby granted, without written agreement and without | 6 * Permission is hereby granted, without written agreement and without |
| 7 * license or royalty fees, to use, copy, modify, and distribute this | 7 * license or royalty fees, to use, copy, modify, and distribute this |
| 8 * software and its documentation for any purpose, provided that the | 8 * software and its documentation for any purpose, provided that the |
| 9 * above copyright notice and the following two paragraphs appear in | 9 * above copyright notice and the following two paragraphs appear in |
| 10 * all copies of this software. | 10 * all copies of this software. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 | 29 |
| 30 static bool | 30 static bool |
| 31 compose_hebrew (const hb_ot_shape_normalize_context_t *c, | 31 compose_hebrew (const hb_ot_shape_normalize_context_t *c, |
| 32 hb_codepoint_t a, | 32 hb_codepoint_t a, |
| 33 hb_codepoint_t b, | 33 hb_codepoint_t b, |
| 34 hb_codepoint_t *ab) | 34 hb_codepoint_t *ab) |
| 35 { | 35 { |
| 36 /* Hebrew presentation-form shaping. | 36 /* Hebrew presentation-form shaping. |
| 37 * https://bugzilla.mozilla.org/show_bug.cgi?id=728866 | 37 * https://bugzilla.mozilla.org/show_bug.cgi?id=728866 |
| 38 * Hebrew presentation forms with dagesh, for characters 0x05D0..0x05EA; | 38 * Hebrew presentation forms with dagesh, for characters U+05D0..05EA; |
| 39 * Note that some letters do not have a dagesh presForm encoded. | 39 * Note that some letters do not have a dagesh presForm encoded. |
| 40 */ | 40 */ |
| 41 static const hb_codepoint_t sDageshForms[0x05EA - 0x05D0 + 1] = { | 41 static const hb_codepoint_t sDageshForms[0x05EAu - 0x05D0u + 1] = { |
| 42 0xFB30, /* ALEF */ | 42 0xFB30u, /* ALEF */ |
| 43 0xFB31, /* BET */ | 43 0xFB31u, /* BET */ |
| 44 0xFB32, /* GIMEL */ | 44 0xFB32u, /* GIMEL */ |
| 45 0xFB33, /* DALET */ | 45 0xFB33u, /* DALET */ |
| 46 0xFB34, /* HE */ | 46 0xFB34u, /* HE */ |
| 47 0xFB35, /* VAV */ | 47 0xFB35u, /* VAV */ |
| 48 0xFB36, /* ZAYIN */ | 48 0xFB36u, /* ZAYIN */ |
| 49 0x0000, /* HET */ | 49 0x0000u, /* HET */ |
| 50 0xFB38, /* TET */ | 50 0xFB38u, /* TET */ |
| 51 0xFB39, /* YOD */ | 51 0xFB39u, /* YOD */ |
| 52 0xFB3A, /* FINAL KAF */ | 52 0xFB3Au, /* FINAL KAF */ |
| 53 0xFB3B, /* KAF */ | 53 0xFB3Bu, /* KAF */ |
| 54 0xFB3C, /* LAMED */ | 54 0xFB3Cu, /* LAMED */ |
| 55 0x0000, /* FINAL MEM */ | 55 0x0000u, /* FINAL MEM */ |
| 56 0xFB3E, /* MEM */ | 56 0xFB3Eu, /* MEM */ |
| 57 0x0000, /* FINAL NUN */ | 57 0x0000u, /* FINAL NUN */ |
| 58 0xFB40, /* NUN */ | 58 0xFB40u, /* NUN */ |
| 59 0xFB41, /* SAMEKH */ | 59 0xFB41u, /* SAMEKH */ |
| 60 0x0000, /* AYIN */ | 60 0x0000u, /* AYIN */ |
| 61 0xFB43, /* FINAL PE */ | 61 0xFB43u, /* FINAL PE */ |
| 62 0xFB44, /* PE */ | 62 0xFB44u, /* PE */ |
| 63 0x0000, /* FINAL TSADI */ | 63 0x0000u, /* FINAL TSADI */ |
| 64 0xFB46, /* TSADI */ | 64 0xFB46u, /* TSADI */ |
| 65 0xFB47, /* QOF */ | 65 0xFB47u, /* QOF */ |
| 66 0xFB48, /* RESH */ | 66 0xFB48u, /* RESH */ |
| 67 0xFB49, /* SHIN */ | 67 0xFB49u, /* SHIN */ |
| 68 0xFB4A /* TAV */ | 68 0xFB4Au /* TAV */ |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 bool found = c->unicode->compose (a, b, ab); | 71 bool found = c->unicode->compose (a, b, ab); |
| 72 | 72 |
| 73 if (!found && !c->plan->has_mark) | 73 if (!found && !c->plan->has_mark) |
| 74 { | 74 { |
| 75 /* Special-case Hebrew presentation forms that are excluded from | 75 /* Special-case Hebrew presentation forms that are excluded from |
| 76 * standard normalization, but wanted for old fonts. */ | 76 * standard normalization, but wanted for old fonts. */ |
| 77 switch (b) { | 77 switch (b) { |
| 78 case 0x05B4: /* HIRIQ */ | 78 case 0x05B4u: /* HIRIQ */ |
| 79 » if (a == 0x05D9) { /* YOD */ | 79 » if (a == 0x05D9u) { /* YOD */ |
| 80 » *ab = 0xFB1D; | 80 » *ab = 0xFB1Du; |
| 81 found = true; | 81 found = true; |
| 82 } | 82 } |
| 83 break; | 83 break; |
| 84 case 0x05B7: /* patah */ | 84 case 0x05B7u: /* patah */ |
| 85 » if (a == 0x05F2) { /* YIDDISH YOD YOD */ | 85 » if (a == 0x05F2u) { /* YIDDISH YOD YOD */ |
| 86 » *ab = 0xFB1F; | 86 » *ab = 0xFB1Fu; |
| 87 found = true; | 87 found = true; |
| 88 » } else if (a == 0x05D0) { /* ALEF */ | 88 » } else if (a == 0x05D0u) { /* ALEF */ |
| 89 » *ab = 0xFB2E; | 89 » *ab = 0xFB2Eu; |
| 90 found = true; | 90 found = true; |
| 91 } | 91 } |
| 92 break; | 92 break; |
| 93 case 0x05B8: /* QAMATS */ | 93 case 0x05B8u: /* QAMATS */ |
| 94 » if (a == 0x05D0) { /* ALEF */ | 94 » if (a == 0x05D0u) { /* ALEF */ |
| 95 » *ab = 0xFB2F; | 95 » *ab = 0xFB2Fu; |
| 96 found = true; | 96 found = true; |
| 97 } | 97 } |
| 98 break; | 98 break; |
| 99 case 0x05B9: /* HOLAM */ | 99 case 0x05B9u: /* HOLAM */ |
| 100 » if (a == 0x05D5) { /* VAV */ | 100 » if (a == 0x05D5u) { /* VAV */ |
| 101 » *ab = 0xFB4B; | 101 » *ab = 0xFB4Bu; |
| 102 found = true; | 102 found = true; |
| 103 } | 103 } |
| 104 break; | 104 break; |
| 105 case 0x05BC: /* DAGESH */ | 105 case 0x05BCu: /* DAGESH */ |
| 106 » if (a >= 0x05D0 && a <= 0x05EA) { | 106 » if (a >= 0x05D0u && a <= 0x05EAu) { |
| 107 » *ab = sDageshForms[a - 0x05D0]; | 107 » *ab = sDageshForms[a - 0x05D0u]; |
| 108 found = (*ab != 0); | 108 found = (*ab != 0); |
| 109 » } else if (a == 0xFB2A) { /* SHIN WITH SHIN DOT */ | 109 » } else if (a == 0xFB2Au) { /* SHIN WITH SHIN DOT */ |
| 110 » *ab = 0xFB2C; | 110 » *ab = 0xFB2Cu; |
| 111 found = true; | 111 found = true; |
| 112 » } else if (a == 0xFB2B) { /* SHIN WITH SIN DOT */ | 112 » } else if (a == 0xFB2Bu) { /* SHIN WITH SIN DOT */ |
| 113 » *ab = 0xFB2D; | 113 » *ab = 0xFB2Du; |
| 114 found = true; | 114 found = true; |
| 115 } | 115 } |
| 116 break; | 116 break; |
| 117 case 0x05BF: /* RAFE */ | 117 case 0x05BFu: /* RAFE */ |
| 118 switch (a) { | 118 switch (a) { |
| 119 » case 0x05D1: /* BET */ | 119 » case 0x05D1u: /* BET */ |
| 120 » *ab = 0xFB4C; | 120 » *ab = 0xFB4Cu; |
| 121 found = true; | 121 found = true; |
| 122 break; | 122 break; |
| 123 » case 0x05DB: /* KAF */ | 123 » case 0x05DBu: /* KAF */ |
| 124 » *ab = 0xFB4D; | 124 » *ab = 0xFB4Du; |
| 125 found = true; | 125 found = true; |
| 126 break; | 126 break; |
| 127 » case 0x05E4: /* PE */ | 127 » case 0x05E4u: /* PE */ |
| 128 » *ab = 0xFB4E; | 128 » *ab = 0xFB4Eu; |
| 129 found = true; | 129 found = true; |
| 130 break; | 130 break; |
| 131 } | 131 } |
| 132 break; | 132 break; |
| 133 case 0x05C1: /* SHIN DOT */ | 133 case 0x05C1u: /* SHIN DOT */ |
| 134 » if (a == 0x05E9) { /* SHIN */ | 134 » if (a == 0x05E9u) { /* SHIN */ |
| 135 » *ab = 0xFB2A; | 135 » *ab = 0xFB2Au; |
| 136 found = true; | 136 found = true; |
| 137 » } else if (a == 0xFB49) { /* SHIN WITH DAGESH */ | 137 » } else if (a == 0xFB49u) { /* SHIN WITH DAGESH */ |
| 138 » *ab = 0xFB2C; | 138 » *ab = 0xFB2Cu; |
| 139 found = true; | 139 found = true; |
| 140 } | 140 } |
| 141 break; | 141 break; |
| 142 case 0x05C2: /* SIN DOT */ | 142 case 0x05C2u: /* SIN DOT */ |
| 143 » if (a == 0x05E9) { /* SHIN */ | 143 » if (a == 0x05E9u) { /* SHIN */ |
| 144 » *ab = 0xFB2B; | 144 » *ab = 0xFB2Bu; |
| 145 found = true; | 145 found = true; |
| 146 » } else if (a == 0xFB49) { /* SHIN WITH DAGESH */ | 146 » } else if (a == 0xFB49u) { /* SHIN WITH DAGESH */ |
| 147 » *ab = 0xFB2D; | 147 » *ab = 0xFB2Du; |
| 148 found = true; | 148 found = true; |
| 149 } | 149 } |
| 150 break; | 150 break; |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 | 153 |
| 154 return found; | 154 return found; |
| 155 } | 155 } |
| 156 | 156 |
| 157 | 157 |
| 158 const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hebrew = | 158 const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hebrew = |
| 159 { | 159 { |
| 160 "hebrew", | 160 "hebrew", |
| 161 NULL, /* collect_features */ | 161 NULL, /* collect_features */ |
| 162 NULL, /* override_features */ | 162 NULL, /* override_features */ |
| 163 NULL, /* data_create */ | 163 NULL, /* data_create */ |
| 164 NULL, /* data_destroy */ | 164 NULL, /* data_destroy */ |
| 165 NULL, /* preprocess_text */ | 165 NULL, /* preprocess_text */ |
| 166 HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT, | 166 HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT, |
| 167 NULL, /* decompose */ | 167 NULL, /* decompose */ |
| 168 compose_hebrew, | 168 compose_hebrew, |
| 169 NULL, /* setup_masks */ | 169 NULL, /* setup_masks */ |
| 170 HB_OT_SHAPE_ZERO_WIDTH_MARKS_DEFAULT, | 170 HB_OT_SHAPE_ZERO_WIDTH_MARKS_DEFAULT, |
| 171 true, /* fallback_position */ | 171 true, /* fallback_position */ |
| 172 }; | 172 }; |
| OLD | NEW |