MCPcopy Create free account
hub / github.com/creatale/node-dv / CodepointToUtf16be

Function CodepointToUtf16be

deps/tesseract/api/pdfrenderer.cpp:317–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315}
316
317bool 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
334char* TessPDFRenderer::GetPDFTextObjects(TessBaseAPI* api,
335 double width, double height) {

Callers 2

GetPDFTextObjectsMethod · 0.85
EndDocumentHandlerMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected