7#ifndef SkUnicode_DEFINED
8#define SkUnicode_DEFINED
21namespace sknonstd {
template <
typename T>
struct is_bitmask_enum; }
23#if !defined(SKUNICODE_IMPLEMENTATION)
24 #define SKUNICODE_IMPLEMENTATION 0
27#if !defined(SKUNICODE_API)
28 #if defined(SKUNICODE_DLL)
30 #if SKUNICODE_IMPLEMENTATION
31 #define SKUNICODE_API __declspec(dllexport)
33 #define SKUNICODE_API __declspec(dllimport)
36 #define SKUNICODE_API __attribute__((visibility("default")))
73 virtual bool setText(
const char utftext8[],
int utf8Units) = 0;
74 virtual bool setText(
const char16_t utftext16[],
int utf16Units) = 0;
80 kNoCodeUnitFlag = 0x00,
81 kPartOfWhiteSpaceBreak = 0x01,
82 kGraphemeStart = 0x02,
83 kSoftLineBreakBefore = 0x04,
84 kHardLineBreakBefore = 0x08,
85 kPartOfIntraWordBreak = 0x10,
88 kGlyphClusterStart = 0x80,
92 kSentenceBreak = 0x800,
109 kHardLineBreak = 100,
115 :
pos(
pos), breakType(breakType) { }
150 (
const char locale[],
BreakType breakType) = 0;
164 std::vector<BidiRegion>* bidiRegions);
168 std::vector<BidiRegion>* results) = 0;
170 virtual bool getWords(
const char utf8[],
int utf8Units,
const char* locale,
171 std::vector<Position>* results) = 0;
175 std::vector<Position>* results) = 0;
179 std::vector<Position>* results) = 0;
181 char utf8[],
int utf8Units,
bool replaceTabs,
184 char16_t utf16[],
int utf16Units,
bool replaceTabs,
187 static SkString convertUtf16ToUtf8(
const char16_t * utf16,
int utf16Units);
188 static SkString convertUtf16ToUtf8(
const std::u16string& utf16);
189 static std::u16string convertUtf8ToUtf16(
const char*
utf8,
int utf8Units);
190 static std::u16string convertUtf8ToUtf16(
const SkString&
utf8);
192 template <
typename Appender8,
typename Appender16>
196 auto ptr =
utf8.begin();
205 for (
auto i = index;
i <
next; ++
i) {
212 if (size16 !=
next) {
232 appender8(
utf8.size());
238 template <
typename Callback>
240 const char* current =
utf8;
241 const char*
end =
utf8 + utf8Units;
242 while (current <
end) {
243 auto before = current -
utf8;
245 if (unichar < 0) unichar = 0xFFFD;
246 auto after = current -
utf8;
253 template <
typename Callback>
255 const char16_t* current = utf16;
256 const char16_t*
end = utf16 + utf16Units;
257 while (current <
end) {
258 auto before = current - utf16;
260 auto after = current - utf16;
265 template <
typename Callback>
267 auto iter = makeBidiIterator(utf16, utf16Units,
dir);
268 const uint16_t* start16 = utf16;
269 const uint16_t* end16 = utf16 + utf16Units;
273 while (pos16 <= iter->getLength()) {
274 auto level = iter->getLevelAt(pos16);
276 currentLevel =
level;
277 }
else if (
level != currentLevel) {
278 callback(pos16, start16 - utf16, currentLevel);
279 currentLevel =
level;
281 if (start16 == end16) {
289 template <
typename Callback>
291 auto iter = makeBreakIterator(
type);
292 iter->setText(utf16, utf16Units);
293 auto pos = iter->first();
297 }
while (!iter->isDone());
static float next(float f)
constexpr size_t SkToSizeT(S x)
virtual Level getLevelAt(Position)=0
virtual ~SkBidiIterator()=default
virtual Position getLength()=0
virtual bool setText(const char16_t utftext16[], int utf16Units)=0
virtual Position first()=0
virtual Position current()=0
virtual bool setText(const char utftext8[], int utf8Units)=0
virtual Status status()=0
virtual Position next()=0
virtual ~SkBreakIterator()=default
virtual bool computeCodeUnitFlags(char16_t utf16[], int utf16Units, bool replaceTabs, skia_private::TArray< SkUnicode::CodeUnitFlags, true > *results)=0
virtual bool isEmojiModifier(SkUnichar utf8)=0
virtual bool isIdeographic(SkUnichar utf8)=0
~SkUnicode() override=default
virtual bool isEmojiModifierBase(SkUnichar utf8)=0
virtual bool isWhitespace(SkUnichar utf8)=0
void forEachCodepoint(const char16_t *utf16, int32_t utf16Units, Callback &&callback)
void forEachBidiRegion(const uint16_t utf16[], int utf16Units, SkBidiIterator::Direction dir, Callback &&callback)
virtual bool isRegionalIndicator(SkUnichar utf8)=0
virtual bool getWords(const char utf8[], int utf8Units, const char *locale, std::vector< Position > *results)=0
virtual void reorderVisual(const BidiLevel runLevels[], int levelsCount, int32_t logicalFromVisual[])=0
virtual std::unique_ptr< SkBreakIterator > makeBreakIterator(const char locale[], BreakType breakType)=0
virtual bool isEmojiComponent(SkUnichar utf8)=0
virtual bool isTabulation(SkUnichar utf8)=0
virtual std::unique_ptr< SkBreakIterator > makeBreakIterator(BreakType type)=0
static bool extractBidi(const char utf8[], int utf8Units, TextDirection dir, std::vector< BidiRegion > *bidiRegions)
virtual std::unique_ptr< SkBidiIterator > makeBidiIterator(const uint16_t text[], int count, SkBidiIterator::Direction)=0
virtual SkString toUpper(const SkString &)=0
virtual std::unique_ptr< SkBidiIterator > makeBidiIterator(const char text[], int count, SkBidiIterator::Direction)=0
virtual bool isSpace(SkUnichar utf8)=0
virtual bool isControl(SkUnichar utf8)=0
virtual bool getSentences(const char utf8[], int utf8Units, const char *locale, std::vector< Position > *results)=0
void forEachCodepoint(const char *utf8, int32_t utf8Units, Callback &&callback)
static bool extractUtfConversionMapping(SkSpan< const char > utf8, Appender8 &&appender8, Appender16 &&appender16)
virtual bool isEmoji(SkUnichar utf8)=0
virtual SkString toUpper(const SkString &, const char *locale)=0
void forEachBreak(const char16_t utf16[], int utf16Units, SkUnicode::BreakType type, Callback &&callback)
virtual bool getBidiRegions(const char utf8[], int utf8Units, TextDirection dir, std::vector< BidiRegion > *results)=0
virtual bool computeCodeUnitFlags(char utf8[], int utf8Units, bool replaceTabs, skia_private::TArray< SkUnicode::CodeUnitFlags, true > *results)=0
virtual bool getUtf8Words(const char utf8[], int utf8Units, const char *locale, std::vector< Position > *results)=0
virtual bool isHardBreak(SkUnichar utf8)=0
FlutterSemanticsFlag flags
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
SK_SPI SkUnichar NextUTF16(const uint16_t **ptr, const uint16_t *end)
SK_SPI SkUnichar NextUTF8(const char **ptr, const char *end)
SK_SPI size_t ToUTF16(SkUnichar uni, uint16_t utf16[2]=nullptr)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets dir
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
std::function< void(MTLRenderPipelineDescriptor *)> Callback
Region(Position start, Position end, Level level)
BidiRegion(Position start, Position end, BidiLevel level)
LineBreakBefore(Position pos, LineBreakType breakType)