Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SkUnicodeHardCodedCharProperties Class Reference

#include <SkUnicode_hardcoded.h>

Inheritance diagram for SkUnicodeHardCodedCharProperties:
SkUnicode SkRefCnt SkRefCntBase SkUnicode_client SkUnicode_libgrapheme

Public Member Functions

bool isControl (SkUnichar utf8) override
 
bool isWhitespace (SkUnichar utf8) override
 
bool isSpace (SkUnichar utf8) override
 
bool isTabulation (SkUnichar utf8) override
 
bool isHardBreak (SkUnichar utf8) override
 
bool isEmoji (SkUnichar utf8) override
 
bool isEmojiComponent (SkUnichar utf8) override
 
bool isEmojiModifierBase (SkUnichar utf8) override
 
bool isEmojiModifier (SkUnichar utf8) override
 
bool isRegionalIndicator (SkUnichar utf8) override
 
bool isIdeographic (SkUnichar utf8) override
 
- Public Member Functions inherited from SkUnicode
 ~SkUnicode () override=default
 
virtual SkString toUpper (const SkString &)=0
 
virtual SkString toUpper (const SkString &, const char *locale)=0
 
virtual std::unique_ptr< SkBidiIteratormakeBidiIterator (const uint16_t text[], int count, SkBidiIterator::Direction)=0
 
virtual std::unique_ptr< SkBidiIteratormakeBidiIterator (const char text[], int count, SkBidiIterator::Direction)=0
 
virtual std::unique_ptr< SkBreakIteratormakeBreakIterator (const char locale[], BreakType breakType)=0
 
virtual std::unique_ptr< SkBreakIteratormakeBreakIterator (BreakType type)=0
 
virtual bool getBidiRegions (const char utf8[], int utf8Units, TextDirection dir, std::vector< BidiRegion > *results)=0
 
virtual bool getWords (const char utf8[], int utf8Units, const char *locale, std::vector< Position > *results)=0
 
virtual bool getUtf8Words (const char utf8[], int utf8Units, const char *locale, std::vector< Position > *results)=0
 
virtual bool getSentences (const char utf8[], int utf8Units, const char *locale, std::vector< Position > *results)=0
 
virtual bool computeCodeUnitFlags (char utf8[], int utf8Units, bool replaceTabs, skia_private::TArray< SkUnicode::CodeUnitFlags, true > *results)=0
 
virtual bool computeCodeUnitFlags (char16_t utf16[], int utf16Units, bool replaceTabs, skia_private::TArray< SkUnicode::CodeUnitFlags, true > *results)=0
 
template<typename Callback >
void forEachCodepoint (const char *utf8, int32_t utf8Units, Callback &&callback)
 
template<typename Callback >
void forEachCodepoint (const char16_t *utf16, int32_t utf16Units, Callback &&callback)
 
template<typename Callback >
void forEachBidiRegion (const uint16_t utf16[], int utf16Units, SkBidiIterator::Direction dir, Callback &&callback)
 
template<typename Callback >
void forEachBreak (const char16_t utf16[], int utf16Units, SkUnicode::BreakType type, Callback &&callback)
 
virtual void reorderVisual (const BidiLevel runLevels[], int levelsCount, int32_t logicalFromVisual[])=0
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Additional Inherited Members

- Public Types inherited from SkUnicode
enum  CodeUnitFlags {
  kNoCodeUnitFlag = 0x00 , kPartOfWhiteSpaceBreak = 0x01 , kGraphemeStart = 0x02 , kSoftLineBreakBefore = 0x04 ,
  kHardLineBreakBefore = 0x08 , kPartOfIntraWordBreak = 0x10 , kControl = 0x20 , kTabulation = 0x40 ,
  kGlyphClusterStart = 0x80 , kIdeographic = 0x100 , kEmoji = 0x200 , kWordBreak = 0x400 ,
  kSentenceBreak = 0x800
}
 
enum class  TextDirection { kLTR , kRTL }
 
enum class  LineBreakType { kSoftLineBreak = 0 , kHardLineBreak = 100 }
 
enum class  BreakType { kWords , kGraphemes , kLines , kSentences }
 
typedef size_t Position
 
typedef uint8_t BidiLevel
 
- Static Public Member Functions inherited from SkUnicode
static bool hasTabulationFlag (SkUnicode::CodeUnitFlags flags)
 
static bool hasHardLineBreakFlag (SkUnicode::CodeUnitFlags flags)
 
static bool hasSoftLineBreakFlag (SkUnicode::CodeUnitFlags flags)
 
static bool hasGraphemeStartFlag (SkUnicode::CodeUnitFlags flags)
 
static bool hasControlFlag (SkUnicode::CodeUnitFlags flags)
 
static bool hasPartOfWhiteSpaceBreakFlag (SkUnicode::CodeUnitFlags flags)
 
static bool extractBidi (const char utf8[], int utf8Units, TextDirection dir, std::vector< BidiRegion > *bidiRegions)
 
static SkString convertUtf16ToUtf8 (const char16_t *utf16, int utf16Units)
 
static SkString convertUtf16ToUtf8 (const std::u16string &utf16)
 
static std::u16string convertUtf8ToUtf16 (const char *utf8, int utf8Units)
 
static std::u16string convertUtf8ToUtf16 (const SkString &utf8)
 
template<typename Appender8 , typename Appender16 >
static bool extractUtfConversionMapping (SkSpan< const char > utf8, Appender8 &&appender8, Appender16 &&appender16)
 

Detailed Description

Definition at line 14 of file SkUnicode_hardcoded.h.

Member Function Documentation

◆ isControl()

bool SkUnicodeHardCodedCharProperties::isControl ( SkUnichar  utf8)
overridevirtual

Implements SkUnicode.

Definition at line 14 of file SkUnicode_hardcoded.cpp.

14 {
15 return (utf8 < ' ') || (utf8 >= 0x7f && utf8 <= 0x9f) ||
16 (utf8 >= 0x200D && utf8 <= 0x200F) ||
17 (utf8 >= 0x202A && utf8 <= 0x202E);
18}

◆ isEmoji()

bool SkUnicodeHardCodedCharProperties::isEmoji ( SkUnichar  utf8)
overridevirtual

Returns if a code point may start an emoji sequence. Returns true for '#', '*', and '0'-'9' since they may start an emoji sequence. To determine if a list of code points begins with an emoji sequence, use getEmojiSequence.

Implements SkUnicode.

Definition at line 88 of file SkUnicode_hardcoded.cpp.

88 {
89 SkDEBUGFAIL("isEmoji Not implemented");
90 return false;
91}
#define SkDEBUGFAIL(message)
Definition SkAssert.h:118

◆ isEmojiComponent()

bool SkUnicodeHardCodedCharProperties::isEmojiComponent ( SkUnichar  utf8)
overridevirtual

Implements SkUnicode.

Definition at line 93 of file SkUnicode_hardcoded.cpp.

93 {
94 SkDEBUGFAIL("isEmojiComponent Not implemented");
95 return false;
96}

◆ isEmojiModifier()

bool SkUnicodeHardCodedCharProperties::isEmojiModifier ( SkUnichar  utf8)
overridevirtual

Implements SkUnicode.

Definition at line 98 of file SkUnicode_hardcoded.cpp.

98 {
99 SkDEBUGFAIL("isEmojiModifier Not implemented");
100 return false;
101}

◆ isEmojiModifierBase()

bool SkUnicodeHardCodedCharProperties::isEmojiModifierBase ( SkUnichar  utf8)
overridevirtual

Implements SkUnicode.

Definition at line 103 of file SkUnicode_hardcoded.cpp.

103 {
104 SkDEBUGFAIL("isEmojiModifierBase Not implemented");
105 return false;
106}

◆ isHardBreak()

bool SkUnicodeHardCodedCharProperties::isHardBreak ( SkUnichar  utf8)
overridevirtual

Implements SkUnicode.

Definition at line 84 of file SkUnicode_hardcoded.cpp.

84 {
85 return utf8 == '\n' || utf8 == u'\u2028';
86}

◆ isIdeographic()

bool SkUnicodeHardCodedCharProperties::isIdeographic ( SkUnichar  utf8)
overridevirtual

Implements SkUnicode.

Definition at line 113 of file SkUnicode_hardcoded.cpp.

113 {
114 static constexpr std::array<std::pair<SkUnichar, SkUnichar>, 8> ranges {{
115 {4352, 4607}, // Hangul Jamo
116 {11904, 42191}, // CJK_Radicals
117 {43072, 43135}, // Phags_Pa
118 {44032, 55215}, // Hangul_Syllables
119 {63744, 64255}, // CJK_Compatibility_Ideographs
120 {65072, 65103}, // CJK_Compatibility_Forms
121 {65381, 65500}, // Katakana_Hangul_Halfwidth
122 {131072, 196607}// Supplementary_Ideographic_Plane
123 }};
124 for (auto range : ranges) {
125 if (range.first <= unichar && range.second > unichar) {
126 return true;
127 }
128 }
129 return false;
130}

◆ isRegionalIndicator()

bool SkUnicodeHardCodedCharProperties::isRegionalIndicator ( SkUnichar  utf8)
overridevirtual

Implements SkUnicode.

Definition at line 108 of file SkUnicode_hardcoded.cpp.

108 {
109 SkDEBUGFAIL("isRegionalIndicator Not implemented");
110 return false;
111}

◆ isSpace()

bool SkUnicodeHardCodedCharProperties::isSpace ( SkUnichar  utf8)
overridevirtual

Implements SkUnicode.

Definition at line 50 of file SkUnicode_hardcoded.cpp.

50 {
51 static constexpr std::array<SkUnichar, 25> spaces {
52 0x0009, // character tabulation
53 0x000A, // line feed
54 0x000B, // line tabulation
55 0x000C, // form feed
56 0x000D, // carriage return
57 0x0020, // space
58 0x0085, // next line
59 0x00A0, // no-break space
60 0x1680, // ogham space mark
61 0x2000, // en quad
62 0x2001, // em quad
63 0x2002, // en space
64 0x2003, // em space
65 0x2004, // three-per-em space
66 0x2005, // four-per-em space
67 0x2006, // six-per-em space
68 0x2007, // figure space
69 0x2008, // punctuation space
70 0x2009, // thin space
71 0x200A, // hair space
72 0x2028, // line separator
73 0x2029, // paragraph separator
74 0x202F, // narrow no-break space
75 0x205F, // medium mathematical space
76 0x3000}; // ideographic space
77 return std::find(spaces.begin(), spaces.end(), unichar) != spaces.end();
78}

◆ isTabulation()

bool SkUnicodeHardCodedCharProperties::isTabulation ( SkUnichar  utf8)
overridevirtual

Implements SkUnicode.

Definition at line 80 of file SkUnicode_hardcoded.cpp.

80 {
81 return utf8 == '\t';
82}

◆ isWhitespace()

bool SkUnicodeHardCodedCharProperties::isWhitespace ( SkUnichar  utf8)
overridevirtual

Implements SkUnicode.

Definition at line 20 of file SkUnicode_hardcoded.cpp.

20 {
21 static constexpr std::array<SkUnichar, 21> whitespaces {
22 0x0009, // character tabulation
23 0x000A, // line feed
24 0x000B, // line tabulation
25 0x000C, // form feed
26 0x000D, // carriage return
27 0x0020, // space
28 //0x0085, // next line
29 //0x00A0, // no-break space
30 0x1680, // ogham space mark
31 0x2000, // en quad
32 0x2001, // em quad
33 0x2002, // en space
34 0x2003, // em space
35 0x2004, // three-per-em space
36 0x2005, // four-per-em space
37 0x2006, // six-per-em space
38 //0x2007, // figure space
39 0x2008, // punctuation space
40 0x2009, // thin space
41 0x200A, // hair space
42 0x2028, // line separator
43 0x2029, // paragraph separator
44 //0x202F, // narrow no-break space
45 0x205F, // medium mathematical space
46 0x3000};// ideographic space
47 return std::find(whitespaces.begin(), whitespaces.end(), unichar) != whitespaces.end();
48}

The documentation for this class was generated from the following files: