| 315 | } |
| 316 | |
| 317 | bool CodepointToUtf16be(int code, char utf16[kMaxBytesPerCodepoint]) { |
| 318 | if ((code > 0xD7FF && code < 0xE000) || code > 0x10FFFF) { |
| 319 | tprintf("Dropping invalid codepoint %d\n", code); |
| 320 | return false; |
| 321 | } |
| 322 | if (code < 0x10000) { |
| 323 | snprintf(utf16, kMaxBytesPerCodepoint, "%04X", code); |
| 324 | } else { |
| 325 | int a = code - 0x010000; |
| 326 | int high_surrogate = (0x03FF & (a >> 10)) + 0xD800; |
| 327 | int low_surrogate = (0x03FF & a) + 0xDC00; |
| 328 | snprintf(utf16, kMaxBytesPerCodepoint, |
| 329 | "%04X%04X", high_surrogate, low_surrogate); |
| 330 | } |
| 331 | return true; |
| 332 | } |
| 333 | |
| 334 | char* TessPDFRenderer::GetPDFTextObjects(TessBaseAPI* api, |
| 335 | double width, double height) { |
no outgoing calls
no test coverage detected