| Line | Source Code | Coverage |
|---|
| 1 | enum KhmerCharClassValues { | - |
| 2 | CC_RESERVED = 0, | - |
| 3 | CC_CONSONANT = 1, | - |
| 4 | CC_CONSONANT2 = 2, | - |
| 5 | CC_CONSONANT3 = 3, | - |
| 6 | CC_ZERO_WIDTH_NJ_MARK = 4, | - |
| 7 | CC_CONSONANT_SHIFTER = 5, | - |
| 8 | CC_ROBAT = 6, | - |
| 9 | CC_COENG = 7, | - |
| 10 | CC_DEPENDENT_VOWEL = 8, | - |
| 11 | CC_SIGN_ABOVE = 9, | - |
| 12 | CC_SIGN_AFTER = 10, | - |
| 13 | CC_ZERO_WIDTH_J_MARK = 11, | - |
| 14 | CC_COUNT = 12 | - |
| 15 | }; | - |
| 16 | | - |
| 17 | | - |
| 18 | enum KhmerCharClassFlags { | - |
| 19 | CF_CLASS_MASK = 0x0000FFFF, | - |
| 20 | | - |
| 21 | CF_CONSONANT = 0x01000000, | - |
| 22 | CF_SPLIT_VOWEL = 0x02000000, | - |
| 23 | CF_DOTTED_CIRCLE = 0x04000000, | - |
| 24 | CF_COENG = 0x08000000, | - |
| 25 | CF_SHIFTER = 0x10000000, | - |
| 26 | CF_ABOVE_VOWEL = 0x20000000, | - |
| 27 | | - |
| 28 | | - |
| 29 | CF_POS_BEFORE = 0x00080000, | - |
| 30 | CF_POS_BELOW = 0x00040000, | - |
| 31 | CF_POS_ABOVE = 0x00020000, | - |
| 32 | CF_POS_AFTER = 0x00010000, | - |
| 33 | CF_POS_MASK = 0x000f0000 | - |
| 34 | }; | - |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | enum KhmerChar { | - |
| 39 | C_SIGN_ZWNJ = 0x200C, | - |
| 40 | C_SIGN_ZWJ = 0x200D, | - |
| 41 | C_RO = 0x179A, | - |
| 42 | C_VOWEL_AA = 0x17B6, | - |
| 43 | C_SIGN_NIKAHIT = 0x17C6, | - |
| 44 | C_VOWEL_E = 0x17C1, | - |
| 45 | C_COENG = 0x17D2 | - |
| 46 | }; | - |
| 47 | enum { | - |
| 48 | _xx = CC_RESERVED, | - |
| 49 | _sa = CC_SIGN_ABOVE | CF_DOTTED_CIRCLE | CF_POS_ABOVE, | - |
| 50 | _sp = CC_SIGN_AFTER | CF_DOTTED_CIRCLE| CF_POS_AFTER, | - |
| 51 | _c1 = CC_CONSONANT | CF_CONSONANT, | - |
| 52 | _c2 = CC_CONSONANT2 | CF_CONSONANT, | - |
| 53 | _c3 = CC_CONSONANT3 | CF_CONSONANT, | - |
| 54 | _rb = CC_ROBAT | CF_POS_ABOVE | CF_DOTTED_CIRCLE, | - |
| 55 | _cs = CC_CONSONANT_SHIFTER | CF_DOTTED_CIRCLE | CF_SHIFTER, | - |
| 56 | _dl = CC_DEPENDENT_VOWEL | CF_POS_BEFORE | CF_DOTTED_CIRCLE, | - |
| 57 | _db = CC_DEPENDENT_VOWEL | CF_POS_BELOW | CF_DOTTED_CIRCLE, | - |
| 58 | _da = CC_DEPENDENT_VOWEL | CF_POS_ABOVE | CF_DOTTED_CIRCLE | CF_ABOVE_VOWEL, | - |
| 59 | _dr = CC_DEPENDENT_VOWEL | CF_POS_AFTER | CF_DOTTED_CIRCLE, | - |
| 60 | _co = CC_COENG | CF_COENG | CF_DOTTED_CIRCLE, | - |
| 61 | | - |
| 62 | | - |
| 63 | _va = _da | CF_SPLIT_VOWEL, | - |
| 64 | _vr = _dr | CF_SPLIT_VOWEL | - |
| 65 | }; | - |
| 66 | | - |
| 67 | | - |
| 68 | | - |
| 69 | | - |
| 70 | | - |
| 71 | | - |
| 72 | typedef unsigned long KhmerCharClass; | - |
| 73 | static const KhmerCharClass khmerCharClasses[] = { | - |
| 74 | _c1, _c1, _c1, _c3, _c1, _c1, _c1, _c1, _c3, _c1, _c1, _c1, _c1, _c3, _c1, _c1, | - |
| 75 | _c1, _c1, _c1, _c1, _c3, _c1, _c1, _c1, _c1, _c3, _c2, _c1, _c1, _c1, _c3, _c3, | - |
| 76 | _c1, _c3, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, _c1, | - |
| 77 | _c1, _c1, _c1, _c1, _dr, _dr, _dr, _da, _da, _da, _da, _db, _db, _db, _va, _vr, | - |
| 78 | _vr, _dl, _dl, _dl, _vr, _vr, _sa, _sp, _sp, _cs, _cs, _sa, _rb, _sa, _sa, _sa, | - |
| 79 | _sa, _sa, _co, _sa, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _sa, _xx, _xx | - |
| 80 | }; | - |
| 81 | | - |
| 82 | | - |
| 83 | enum KhmerCharClassesRange { | - |
| 84 | KhmerFirstChar = 0x1780, | - |
| 85 | KhmerLastChar = 0x17df | - |
| 86 | }; | - |
| 87 | | - |
| 88 | | - |
| 89 | | - |
| 90 | | - |
| 91 | | - |
| 92 | | - |
| 93 | | - |
| 94 | static KhmerCharClass getKhmerCharClass(HB_UChar16 uc) | - |
| 95 | { | - |
| 96 | if (uc == C_SIGN_ZWJ) { never evaluated: uc == C_SIGN_ZWJ | 0 |
| 97 | return CC_ZERO_WIDTH_J_MARK; never executed: return CC_ZERO_WIDTH_J_MARK; | 0 |
| 98 | } | - |
| 99 | | - |
| 100 | if (uc == C_SIGN_ZWNJ) { never evaluated: uc == C_SIGN_ZWNJ | 0 |
| 101 | return CC_ZERO_WIDTH_NJ_MARK; never executed: return CC_ZERO_WIDTH_NJ_MARK; | 0 |
| 102 | } | - |
| 103 | | - |
| 104 | if (uc < KhmerFirstChar || uc > KhmerLastChar) { never evaluated: uc > KhmerLastChar never evaluated: uc < KhmerFirstChar | 0 |
| 105 | return CC_RESERVED; never executed: return CC_RESERVED; | 0 |
| 106 | } | - |
| 107 | | - |
| 108 | return khmerCharClasses[uc - KhmerFirstChar]; never executed: return khmerCharClasses[uc - KhmerFirstChar]; | 0 |
| 109 | } | - |
| 110 | static const signed char khmerStateTable[][CC_COUNT] = | - |
| 111 | { | - |
| 112 | | - |
| 113 | { 1, 2, 2, 2, 1, 1, 1, 6, 1, 1, 1, 2}, | - |
| 114 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, | - |
| 115 | {-1, -1, -1, -1, 3, 4, 5, 6, 16, 17, 1, -1}, | - |
| 116 | {-1, -1, -1, -1, -1, 4, -1, -1, 16, -1, -1, -1}, | - |
| 117 | {-1, -1, -1, -1, 15, -1, -1, 6, 16, 17, 1, 14}, | - |
| 118 | {-1, -1, -1, -1, -1, -1, -1, -1, 20, -1, 1, -1}, | - |
| 119 | {-1, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1}, | - |
| 120 | {-1, -1, -1, -1, 12, 13, -1, 10, 16, 17, 1, 14}, | - |
| 121 | {-1, -1, -1, -1, 12, 13, -1, -1, 16, 17, 1, 14}, | - |
| 122 | {-1, -1, -1, -1, 12, 13, -1, 10, 16, 17, 1, 14}, | - |
| 123 | {-1, 11, 11, 11, -1, -1, -1, -1, -1, -1, -1, -1}, | - |
| 124 | {-1, -1, -1, -1, 15, -1, -1, -1, 16, 17, 1, 14}, | - |
| 125 | {-1, -1, -1, -1, -1, 13, -1, -1, 16, -1, -1, -1}, | - |
| 126 | {-1, -1, -1, -1, 15, -1, -1, -1, 16, 17, 1, 14}, | - |
| 127 | {-1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, -1}, | - |
| 128 | {-1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, -1}, | - |
| 129 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, 17, 1, 18}, | - |
| 130 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 18}, | - |
| 131 | {-1, -1, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1}, | - |
| 132 | {-1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, | - |
| 133 | {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1}, | - |
| 134 | }; | - |
| 135 | static int khmer_nextSyllableBoundary(const HB_UChar16 *s, int start, int end, HB_Bool *invalid) | - |
| 136 | { | - |
| 137 | const HB_UChar16 *uc = s + start; | - |
| 138 | int state = 0; | - |
| 139 | int pos = start; | - |
| 140 | *invalid = 0; | - |
| 141 | | - |
| 142 | while (pos < end) { never evaluated: pos < end | 0 |
| 143 | KhmerCharClass charClass = getKhmerCharClass(*uc); | - |
| 144 | if (pos == start) { never evaluated: pos == start | 0 |
| 145 | *invalid = (charClass > 0) && ! (charClass & CF_CONSONANT); never evaluated: (charClass > 0) never evaluated: ! (charClass & CF_CONSONANT) | 0 |
| 146 | } | 0 |
| 147 | state = khmerStateTable[state][charClass & CF_CLASS_MASK]; | - |
| 148 | | - |
| 149 | if(0) printf("state[%d]=%d class=%8lx (uc=%4x)", pos - start, state, | 0 |
| 150 | charClass, *uc ); never executed: printf("state[%d]=%d class=%8lx (uc=%4x)", pos - start, state, charClass, *uc ); | 0 |
| 151 | | - |
| 152 | if (state < 0) { never evaluated: state < 0 | 0 |
| 153 | break; | 0 |
| 154 | } | - |
| 155 | ++uc; | - |
| 156 | ++pos; | - |
| 157 | } | 0 |
| 158 | return pos; never executed: return pos; | 0 |
| 159 | } | - |
| 160 | | - |
| 161 | | - |
| 162 | static const HB_OpenTypeFeature khmer_features[] = { | - |
| 163 | { ( ( (HB_UInt)'p' << 24 ) | ( (HB_UInt)'r' << 16 ) | ( (HB_UInt)'e' << 8 ) | (HB_UInt)'f' ), PreFormProperty }, | - |
| 164 | { ( ( (HB_UInt)'b' << 24 ) | ( (HB_UInt)'l' << 16 ) | ( (HB_UInt)'w' << 8 ) | (HB_UInt)'f' ), BelowFormProperty }, | - |
| 165 | { ( ( (HB_UInt)'a' << 24 ) | ( (HB_UInt)'b' << 16 ) | ( (HB_UInt)'v' << 8 ) | (HB_UInt)'f' ), AboveFormProperty }, | - |
| 166 | { ( ( (HB_UInt)'p' << 24 ) | ( (HB_UInt)'s' << 16 ) | ( (HB_UInt)'t' << 8 ) | (HB_UInt)'f' ), PostFormProperty }, | - |
| 167 | { ( ( (HB_UInt)'p' << 24 ) | ( (HB_UInt)'r' << 16 ) | ( (HB_UInt)'e' << 8 ) | (HB_UInt)'s' ), PreSubstProperty }, | - |
| 168 | { ( ( (HB_UInt)'b' << 24 ) | ( (HB_UInt)'l' << 16 ) | ( (HB_UInt)'w' << 8 ) | (HB_UInt)'s' ), BelowSubstProperty }, | - |
| 169 | { ( ( (HB_UInt)'a' << 24 ) | ( (HB_UInt)'b' << 16 ) | ( (HB_UInt)'v' << 8 ) | (HB_UInt)'s' ), AboveSubstProperty }, | - |
| 170 | { ( ( (HB_UInt)'p' << 24 ) | ( (HB_UInt)'s' << 16 ) | ( (HB_UInt)'t' << 8 ) | (HB_UInt)'s' ), PostSubstProperty }, | - |
| 171 | { ( ( (HB_UInt)'c' << 24 ) | ( (HB_UInt)'l' << 16 ) | ( (HB_UInt)'i' << 8 ) | (HB_UInt)'g' ), CligProperty }, | - |
| 172 | { 0, 0 } | - |
| 173 | }; | - |
| 174 | | - |
| 175 | | - |
| 176 | | - |
| 177 | static HB_Bool khmer_shape_syllable(HB_Bool openType, HB_ShaperItem *item) | - |
| 178 | { | - |
| 179 | | - |
| 180 | | - |
| 181 | | - |
| 182 | int len = 0; | - |
| 183 | int syllableEnd = item->item.pos + item->item.length; | - |
| 184 | unsigned short reordered[16]; | - |
| 185 | unsigned char properties[16]; | - |
| 186 | enum { | - |
| 187 | AboveForm = 0x01, | - |
| 188 | PreForm = 0x02, | - |
| 189 | PostForm = 0x04, | - |
| 190 | BelowForm = 0x08 | - |
| 191 | }; | - |
| 192 | | - |
| 193 | const int availableGlyphs = item->num_glyphs; | - |
| 194 | | - |
| 195 | int coengRo; | - |
| 196 | int i; | - |
| 197 | | - |
| 198 | | - |
| 199 | | - |
| 200 | ((item->item.length < 13) ? static_cast<void> (0) : __assert_fail ("item->item.length < 13", "../3rdparty/harfbuzz/src/harfbuzz-khmer.c", 377, __PRETTY_FUNCTION__)); | - |
| 201 | | - |
| 202 | memset(properties, 0, 16*sizeof(unsigned char)); | - |
| 203 | coengRo = -1; | - |
| 204 | for (i = item->item.pos; i < syllableEnd; i += 1) { never evaluated: i < syllableEnd | 0 |
| 205 | KhmerCharClass charClass = getKhmerCharClass(item->string[i]); | - |
| 206 | | - |
| 207 | | - |
| 208 | | - |
| 209 | if (charClass & CF_SPLIT_VOWEL) { never evaluated: charClass & CF_SPLIT_VOWEL | 0 |
| 210 | reordered[len] = C_VOWEL_E; | - |
| 211 | properties[len] = PreForm; | - |
| 212 | ++len; | - |
| 213 | break; | 0 |
| 214 | } | - |
| 215 | | - |
| 216 | if (charClass & CF_POS_BEFORE) { never evaluated: charClass & CF_POS_BEFORE | 0 |
| 217 | reordered[len] = item->string[i]; | - |
| 218 | properties[len] = PreForm; | - |
| 219 | ++len; | - |
| 220 | break; | 0 |
| 221 | } | - |
| 222 | | - |
| 223 | | - |
| 224 | | - |
| 225 | | - |
| 226 | if ( (charClass & CF_COENG) && (i + 1 < syllableEnd) && never evaluated: (charClass & CF_COENG) never evaluated: (i + 1 < syllableEnd) | 0 |
| 227 | ( (getKhmerCharClass(item->string[i+1]) & CF_CLASS_MASK) == CC_CONSONANT2) ) { never evaluated: ( (getKhmerCharClass(item->string[i+1]) & CF_CLASS_MASK) == CC_CONSONANT2) | 0 |
| 228 | coengRo = i; | - |
| 229 | } | 0 |
| 230 | } | 0 |
| 231 | | - |
| 232 | | - |
| 233 | if (coengRo > -1) { never evaluated: coengRo > -1 | 0 |
| 234 | reordered[len] = C_COENG; | - |
| 235 | properties[len] = PreForm; | - |
| 236 | ++len; | - |
| 237 | reordered[len] = C_RO; | - |
| 238 | properties[len] = PreForm; | - |
| 239 | ++len; | - |
| 240 | } | 0 |
| 241 | | - |
| 242 | | - |
| 243 | | - |
| 244 | | - |
| 245 | | - |
| 246 | | - |
| 247 | if (getKhmerCharClass(item->string[item->item.pos]) & CF_DOTTED_CIRCLE) { never evaluated: getKhmerCharClass(item->string[item->item.pos]) & CF_DOTTED_CIRCLE | 0 |
| 248 | reordered[len] = C_DOTTED_CIRCLE; | - |
| 249 | ++len; | - |
| 250 | } | 0 |
| 251 | | - |
| 252 | | - |
| 253 | | - |
| 254 | for (i = item->item.pos; i < syllableEnd; i += 1) { never evaluated: i < syllableEnd | 0 |
| 255 | HB_UChar16 uc = item->string[i]; | - |
| 256 | KhmerCharClass charClass = getKhmerCharClass(uc); | - |
| 257 | | - |
| 258 | | - |
| 259 | if (charClass & CF_POS_BEFORE) { never evaluated: charClass & CF_POS_BEFORE | 0 |
| 260 | continue; never executed: continue; | 0 |
| 261 | } | - |
| 262 | | - |
| 263 | | - |
| 264 | if (i == coengRo) { never evaluated: i == coengRo | 0 |
| 265 | i += 1; | - |
| 266 | continue; never executed: continue; | 0 |
| 267 | } | - |
| 268 | | - |
| 269 | switch (charClass & CF_POS_MASK) | - |
| 270 | { | - |
| 271 | case CF_POS_ABOVE : | - |
| 272 | reordered[len] = uc; | - |
| 273 | properties[len] = AboveForm; | - |
| 274 | ++len; | - |
| 275 | break; | 0 |
| 276 | | - |
| 277 | case CF_POS_AFTER : | - |
| 278 | reordered[len] = uc; | - |
| 279 | properties[len] = PostForm; | - |
| 280 | ++len; | - |
| 281 | break; | 0 |
| 282 | | - |
| 283 | case CF_POS_BELOW : | - |
| 284 | reordered[len] = uc; | - |
| 285 | properties[len] = BelowForm; | - |
| 286 | ++len; | - |
| 287 | break; | 0 |
| 288 | | - |
| 289 | default: | - |
| 290 | | - |
| 291 | | - |
| 292 | if ( (charClass & CF_COENG) && i + 1 < syllableEnd ) { never evaluated: (charClass & CF_COENG) never evaluated: i + 1 < syllableEnd | 0 |
| 293 | unsigned char property = (getKhmerCharClass(item->string[i+1]) & CF_CLASS_MASK) == CC_CONSONANT3 ? never evaluated: (getKhmerCharClass(item->string[i+1]) & CF_CLASS_MASK) == CC_CONSONANT3 | 0 |
| 294 | PostForm : BelowForm; | - |
| 295 | reordered[len] = uc; | - |
| 296 | properties[len] = property; | - |
| 297 | ++len; | - |
| 298 | i += 1; | - |
| 299 | reordered[len] = item->string[i]; | - |
| 300 | properties[len] = property; | - |
| 301 | ++len; | - |
| 302 | break; | 0 |
| 303 | } | - |
| 304 | | - |
| 305 | | - |
| 306 | | - |
| 307 | | - |
| 308 | | - |
| 309 | | - |
| 310 | if ( (charClass & CF_SHIFTER) && (i + 1 < syllableEnd) ) { never evaluated: (charClass & CF_SHIFTER) never evaluated: (i + 1 < syllableEnd) | 0 |
| 311 | if (getKhmerCharClass(item->string[i+1]) & CF_ABOVE_VOWEL ) { never evaluated: getKhmerCharClass(item->string[i+1]) & CF_ABOVE_VOWEL | 0 |
| 312 | reordered[len] = uc; | - |
| 313 | properties[len] = BelowForm; | - |
| 314 | ++len; | - |
| 315 | break; | 0 |
| 316 | } | - |
| 317 | if (i + 2 < syllableEnd && never evaluated: i + 2 < syllableEnd | 0 |
| 318 | (item->string[i+1] == C_VOWEL_AA) && never evaluated: (item->string[i+1] == C_VOWEL_AA) | 0 |
| 319 | (item->string[i+2] == C_SIGN_NIKAHIT) ) never evaluated: (item->string[i+2] == C_SIGN_NIKAHIT) | 0 |
| 320 | { | - |
| 321 | reordered[len] = uc; | - |
| 322 | properties[len] = BelowForm; | - |
| 323 | ++len; | - |
| 324 | break; | 0 |
| 325 | } | - |
| 326 | if (i + 3 < syllableEnd && (getKhmerCharClass(item->string[i+3]) & CF_ABOVE_VOWEL) ) { never evaluated: i + 3 < syllableEnd never evaluated: (getKhmerCharClass(item->string[i+3]) & CF_ABOVE_VOWEL) | 0 |
| 327 | reordered[len] = uc; | - |
| 328 | properties[len] = BelowForm; | - |
| 329 | ++len; | - |
| 330 | break; | 0 |
| 331 | } | - |
| 332 | if (i + 4 < syllableEnd && never evaluated: i + 4 < syllableEnd | 0 |
| 333 | (item->string[i+3] == C_VOWEL_AA) && never evaluated: (item->string[i+3] == C_VOWEL_AA) | 0 |
| 334 | (item->string[i+4] == C_SIGN_NIKAHIT) ) never evaluated: (item->string[i+4] == C_SIGN_NIKAHIT) | 0 |
| 335 | { | - |
| 336 | reordered[len] = uc; | - |
| 337 | properties[len] = BelowForm; | - |
| 338 | ++len; | - |
| 339 | break; | 0 |
| 340 | } | - |
| 341 | } | 0 |
| 342 | | - |
| 343 | | - |
| 344 | reordered[len] = uc; | - |
| 345 | ++len; | - |
| 346 | break; | 0 |
| 347 | } | - |
| 348 | } | 0 |
| 349 | | - |
| 350 | if (!item->font->klass->convertStringToGlyphIndices(item->font, | 0 |
| 351 | reordered, len, | 0 |
| 352 | item->glyphs, &item->num_glyphs, | 0 |
| 353 | item->item.bidiLevel % 2)) never evaluated: !item->font->klass->convertStringToGlyphIndices(item->font, reordered, len, item->glyphs, &item->num_glyphs, item->item.bidiLevel % 2) | 0 |
| 354 | return 0; never executed: return 0; | 0 |
| 355 | | - |
| 356 | | - |
| 357 | if(0) printf("after shaping: len=%d", len); never executed: printf("after shaping: len=%d", len); | 0 |
| 358 | for (i = 0; i < len; i++) { | 0 |
| 359 | item->attributes[i].mark = 0; | - |
| 360 | item->attributes[i].clusterStart = 0; | - |
| 361 | item->attributes[i].justification = 0; | - |
| 362 | item->attributes[i].zeroWidth = 0; | - |
| 363 | if(0) printf(" %d: %4x property=%x", i, reordered[i], properties[i]); never executed: printf(" %d: %4x property=%x", i, reordered[i], properties[i]); | 0 |
| 364 | } | 0 |
| 365 | | - |
| 366 | | - |
| 367 | | - |
| 368 | | - |
| 369 | if (openType) { never evaluated: openType | 0 |
| 370 | hb_uint32 where[16]; | - |
| 371 | for (i = 0; i < len; ++i) { | 0 |
| 372 | where[i] = ~(PreSubstProperty | - |
| 373 | | BelowSubstProperty | - |
| 374 | | AboveSubstProperty | - |
| 375 | | PostSubstProperty | - |
| 376 | | CligProperty | - |
| 377 | | 0x80000000); | - |
| 378 | if (properties[i] == PreForm) never evaluated: properties[i] == PreForm | 0 |
| 379 | where[i] &= ~PreFormProperty; never executed: where[i] &= ~PreFormProperty; | 0 |
| 380 | else if (properties[i] == BelowForm) never evaluated: properties[i] == BelowForm | 0 |
| 381 | where[i] &= ~BelowFormProperty; never executed: where[i] &= ~BelowFormProperty; | 0 |
| 382 | else if (properties[i] == AboveForm) never evaluated: properties[i] == AboveForm | 0 |
| 383 | where[i] &= ~AboveFormProperty; never executed: where[i] &= ~AboveFormProperty; | 0 |
| 384 | else if (properties[i] == PostForm) never evaluated: properties[i] == PostForm | 0 |
| 385 | where[i] &= ~PostFormProperty; never executed: where[i] &= ~PostFormProperty; | 0 |
| 386 | } | - |
| 387 | | - |
| 388 | HB_OpenTypeShape(item, where); | - |
| 389 | if (!HB_OpenTypePosition(item, availableGlyphs, 0)) never evaluated: !HB_OpenTypePosition(item, availableGlyphs, 0) | 0 |
| 390 | return 0; never executed: return 0; | 0 |
| 391 | } else | 0 |
| 392 | | - |
| 393 | { | - |
| 394 | if(0) printf("Not using openType"); never executed: printf("Not using openType"); | 0 |
| 395 | HB_HeuristicPosition(item); | - |
| 396 | } | 0 |
| 397 | | - |
| 398 | item->attributes[0].clusterStart = (!0); | - |
| 399 | return (!0); never executed: return (!0); | 0 |
| 400 | } | - |
| 401 | | - |
| 402 | HB_Bool HB_KhmerShape(HB_ShaperItem *item) | - |
| 403 | { | - |
| 404 | HB_Bool openType = 0; | - |
| 405 | unsigned short *logClusters = item->log_clusters; | - |
| 406 | int i; | - |
| 407 | | - |
| 408 | HB_ShaperItem syllable = *item; | - |
| 409 | int first_glyph = 0; | - |
| 410 | | - |
| 411 | int sstart = item->item.pos; | - |
| 412 | int end = sstart + item->item.length; | - |
| 413 | | - |
| 414 | ((item->item.script == HB_Script_Khmer) ? static_cast<void> (0) : __assert_fail ("item->item.script == HB_Script_Khmer", "../3rdparty/harfbuzz/src/harfbuzz-khmer.c", 604, __PRETTY_FUNCTION__)); | - |
| 415 | | - |
| 416 | | - |
| 417 | openType = HB_SelectScript(item, khmer_features); | - |
| 418 | | - |
| 419 | | - |
| 420 | if(0) printf("khmer_shape: from %d length %d", item->item.pos, item->item.length); never executed: printf("khmer_shape: from %d length %d", item->item.pos, item->item.length); | 0 |
| 421 | while (sstart < end) { never evaluated: sstart < end | 0 |
| 422 | HB_Bool invalid; | - |
| 423 | int send = khmer_nextSyllableBoundary(item->string, sstart, end, &invalid); | - |
| 424 | if(0) printf("syllable from %d, length %d, invalid=%s", sstart, send-sstart, | 0 |
| 425 | invalid ? "TRUE" : "FALSE"); never executed: printf("syllable from %d, length %d, invalid=%s", sstart, send-sstart, invalid ? "TRUE" : "FALSE"); | 0 |
| 426 | syllable.item.pos = sstart; | - |
| 427 | syllable.item.length = send-sstart; | - |
| 428 | syllable.glyphs = item->glyphs + first_glyph; | - |
| 429 | syllable.attributes = item->attributes + first_glyph; | - |
| 430 | syllable.offsets = item->offsets + first_glyph; | - |
| 431 | syllable.advances = item->advances + first_glyph; | - |
| 432 | syllable.num_glyphs = item->num_glyphs - first_glyph; | - |
| 433 | if (!khmer_shape_syllable(openType, &syllable)) { never evaluated: !khmer_shape_syllable(openType, &syllable) | 0 |
| 434 | if(0) printf("syllable shaping failed, syllable requests %d glyphs", syllable.num_glyphs); never executed: printf("syllable shaping failed, syllable requests %d glyphs", syllable.num_glyphs); | 0 |
| 435 | item->num_glyphs += syllable.num_glyphs; | - |
| 436 | return 0; never executed: return 0; | 0 |
| 437 | } | - |
| 438 | | - |
| 439 | if(0) printf("syllable:"); never executed: printf("syllable:"); | 0 |
| 440 | for (i = first_glyph; i < first_glyph + (int)syllable.num_glyphs; ++i) never evaluated: i < first_glyph + (int)syllable.num_glyphs | 0 |
| 441 | if(0) printf(" %d -> glyph %x", i, item->glyphs[i]); never executed: printf(" %d -> glyph %x", i, item->glyphs[i]); | 0 |
| 442 | if(0) printf(" logclusters:"); never executed: printf(" logclusters:"); | 0 |
| 443 | for (i = sstart; i < send; ++i) { never evaluated: i < send | 0 |
| 444 | if(0) printf(" %d -> glyph %d", i, first_glyph); never executed: printf(" %d -> glyph %d", i, first_glyph); | 0 |
| 445 | logClusters[i-item->item.pos] = first_glyph; | - |
| 446 | } | 0 |
| 447 | sstart = send; | - |
| 448 | first_glyph += syllable.num_glyphs; | - |
| 449 | } | 0 |
| 450 | item->num_glyphs = first_glyph; | - |
| 451 | return (!0); never executed: return (!0); | 0 |
| 452 | } | - |
| 453 | | - |
| 454 | void HB_KhmerAttributes(HB_Script script, const HB_UChar16 *text, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes) | - |
| 455 | { | - |
| 456 | int end = from + len; | - |
| 457 | const HB_UChar16 *uc = text + from; | - |
| 458 | hb_uint32 i = 0; | - |
| 459 | ((script) = (script)); | - |
| 460 | attributes += from; | - |
| 461 | while ( i < len ) { | 0 |
| 462 | HB_Bool invalid; | - |
| 463 | hb_uint32 boundary = khmer_nextSyllableBoundary( text, from+i, end, &invalid ) - from; | - |
| 464 | | - |
| 465 | attributes[i].graphemeBoundary = (!0); | - |
| 466 | | - |
| 467 | if ( boundary > len-1 ) boundary = len; never executed: boundary = len; never evaluated: boundary > len-1 | 0 |
| 468 | i++; | - |
| 469 | while ( i < boundary ) { never evaluated: i < boundary | 0 |
| 470 | attributes[i].graphemeBoundary = 0; | - |
| 471 | ++uc; | - |
| 472 | ++i; | - |
| 473 | } | 0 |
| 474 | ((i == boundary) ? static_cast<void> (0) : __assert_fail ("i == boundary", "../3rdparty/harfbuzz/src/harfbuzz-khmer.c", 664, __PRETTY_FUNCTION__)); | - |
| 475 | } | 0 |
| 476 | } | 0 |
| 477 | | - |
| | |