MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / startsWithRtl

Function startsWithRtl

lib/MiniBidi/BidiUtils.cpp:34–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32namespace BidiUtils {
33
34bool startsWithRtl(const char* utf8, int maxStrongChars) {
35 if (!utf8 || maxStrongChars <= 0) return false;
36
37 auto* p = reinterpret_cast<const unsigned char*>(utf8);
38 int checked = 0;
39 while (*p) {
40 const uint32_t cp = utf8NextCodepoint(&p);
41 if (!cp || cp == REPLACEMENT_GLYPH) break;
42
43 const uchar cls = bidi_class(cp);
44 if (cls == R || cls == AL) return true;
45 if (cls == L) return false;
46 checked++;
47 if (checked >= maxStrongChars) break;
48 }
49 return false;
50}
51
52int detectParagraphLevel(const char* utf8, const int fallbackLevel, const int maxStrongChars) {
53 if (!utf8 || maxStrongChars <= 0) return fallbackLevel & 1;

Callers 3

addWordMethod · 0.85
layoutAndExtractLinesMethod · 0.85
renderPageMethod · 0.85

Calls 2

utf8NextCodepointFunction · 0.85
bidi_classFunction · 0.85

Tested by

no test coverage detected