26 return val < 0 ? 0xFFFD : val;
32 : fBidi(
std::move(bidi))
33 , fEndOfCurrentRun(
utf8)
36 , fUTF16LogicalPosition(0)
41 SkASSERT(fUTF16LogicalPosition < fBidi->getLength());
42 int32_t endPosition = fBidi->getLength();
43 fLevel = fBidi->getLevelAt(fUTF16LogicalPosition);
47 while (fUTF16LogicalPosition < endPosition) {
48 level = fBidi->getLevelAt(fUTF16LogicalPosition);
49 if (
level != fLevel) {
58 return fEndOfCurrentRun - fBegin;
61 return fUTF16LogicalPosition == fBidi->getLength();
68 char const * fEndOfCurrentRun;
69 char const *
const fBegin;
70 char const *
const fEnd;
71 int32_t fUTF16LogicalPosition;
75#if !defined(SK_DISABLE_LEGACY_SKSHAPER_FUNCTIONS)
77#if defined(SK_UNICODE_ICU_IMPLEMENTATION)
81#if defined(SK_UNICODE_LIBGRAPHEME_IMPLEMENTATION)
85#if defined(SK_UNICODE_ICU4X_IMPLEMENTATION)
90#if defined(SK_UNICODE_ICU_IMPLEMENTATION)
95#if defined(SK_UNICODE_LIBGRAPHEME_IMPLEMENTATION)
100#if defined(SK_UNICODE_ICU4X_IMPLEMENTATION)
108std::unique_ptr<SkShaper::BiDiRunIterator> SkShaper::MakeIcuBiDiRunIterator(
const char*
utf8,
129 if (!SkTFitsIn<int32_t>(utf8Bytes)) {
130 SkDEBUGF(
"Bidi error: text too long");
135 if (utf16Units < 0) {
140 std::unique_ptr<uint16_t[]> utf16(
new uint16_t[utf16Units]);
150 return std::make_unique<SkUnicodeBidiRunIterator>(
utf8,
utf8 + utf8Bytes, std::move(bidi));
std::unique_ptr< SkBidiIterator > SkUnicodeBidi
sk_sp< SkUnicode > get_unicode()
static SkUnichar utf8_next(const char **ptr, const char *end)
size_t endOfCurrentRun() const override
SkUnicodeBidiRunIterator(const char *utf8, const char *end, SkUnicodeBidi bidi)
SkBidiIterator::Level currentLevel() const override
bool atEnd() const override
SKSHAPER_API std::unique_ptr< SkShaper::BiDiRunIterator > BidiRunIterator(sk_sp< SkUnicode > unicode, const char *utf8, size_t utf8Bytes, uint8_t bidiLevel)
SK_SPI int UTF8ToUTF16(uint16_t dst[], int dstCapacity, const char src[], size_t srcByteLength)
SK_SPI SkUnichar NextUTF8(const char **ptr, const char *end)
SK_SPI size_t ToUTF16(SkUnichar uni, uint16_t utf16[2]=nullptr)
SKUNICODE_API sk_sp< SkUnicode > Make()
SKUNICODE_API sk_sp< SkUnicode > Make()
SKUNICODE_API sk_sp< SkUnicode > Make()