| 235 | } |
| 236 | |
| 237 | int16_t CFEGetKerningOffset(CommodettoFontEngine bmf, uint32_t unicode1, uint32_t unicode2) |
| 238 | { |
| 239 | #if MODDEF_CFE_KERN |
| 240 | const uint8_t *kernTriples = bmf->kernTriples; |
| 241 | int count = bmf->kernCount; |
| 242 | |
| 243 | if (NULL == kernTriples) |
| 244 | return 0; |
| 245 | |
| 246 | if (bmf->kernSorted) { |
| 247 | int min = 0; |
| 248 | int max = count; |
| 249 | do { |
| 250 | int mid = (min + max) >> 1; |
| 251 | const uint8_t *cc = (10 * mid) + kernTriples; |
| 252 | unsigned int code = c_read32(cc); |
| 253 | if (code < unicode1) |
| 254 | min = mid + 1; |
| 255 | else if (unicode1 < code) |
| 256 | max = mid - 1; |
| 257 | else { |
| 258 | int direction = (unicode2 < code) ? -10 : +10; |
| 259 | |
| 260 | do { |
| 261 | code = c_read32(cc + 4); |
| 262 | if (code == unicode2) |
| 263 | return c_read16(cc + 8); |
| 264 | |
| 265 | cc += direction; |
| 266 | if (direction < 0) { |
| 267 | if (cc < kernTriples) |
| 268 | break; |
| 269 | } |
| 270 | else { |
| 271 | if (cc >= ((bmf->kernCount * 10) + (uint8_t *)kernTriples)) |
| 272 | break; |
| 273 | } |
| 274 | } while (unicode1 == c_read32(cc)); |
| 275 | |
| 276 | return 0; |
| 277 | } |
| 278 | } while (min <= max); |
| 279 | |
| 280 | return 0; |
| 281 | } |
| 282 | else { |
| 283 | while (count--) { |
| 284 | if ((unicode1 == c_read32(kernTriples)) && (unicode2 == c_read32(kernTriples + 4))) |
| 285 | return c_read16(kernTriples + 8); |
| 286 | kernTriples += 10; |
| 287 | } |
| 288 | } |
| 289 | #endif |
| 290 | return 0; |
| 291 | } |
| 292 | |
| 293 | int CFEShape(CommodettoFontEngine bmf, const char *utf8In, int32_t byteLengthIn, char *utf8Out, int32_t byteLengthOut) |
| 294 | { |
no outgoing calls
no test coverage detected