Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkUnicodeBidiRunIterator Class Referencefinal
Inheritance diagram for SkUnicodeBidiRunIterator:
SkShaper::BiDiRunIterator SkShaper::RunIterator

Public Member Functions

 SkUnicodeBidiRunIterator (const char *utf8, const char *end, SkUnicodeBidi bidi)
 
void consume () override
 
size_t endOfCurrentRun () const override
 
bool atEnd () const override
 
SkBidiIterator::Level currentLevel () const override
 
virtual uint8_t currentLevel () const =0
 
- Public Member Functions inherited from SkShaper::RunIterator
virtual ~RunIterator ()=default
 
virtual void consume ()=0
 
virtual size_t endOfCurrentRun () const =0
 
virtual bool atEnd () const =0
 

Detailed Description

Definition at line 29 of file SkShaper_skunicode.cpp.

Constructor & Destructor Documentation

◆ SkUnicodeBidiRunIterator()

SkUnicodeBidiRunIterator::SkUnicodeBidiRunIterator ( const char *  utf8,
const char *  end,
SkUnicodeBidi  bidi 
)
inline

Definition at line 31 of file SkShaper_skunicode.cpp.

32 : fBidi(std::move(bidi))
33 , fEndOfCurrentRun(utf8)
34 , fBegin(utf8)
35 , fEnd(end)
36 , fUTF16LogicalPosition(0)
37 , fLevel(SkBidiIterator::kLTR)
38 {}
glong glong end

Member Function Documentation

◆ atEnd()

bool SkUnicodeBidiRunIterator::atEnd ( ) const
inlineoverridevirtual

Return true if consume should no longer be called.

Implements SkShaper::RunIterator.

Definition at line 60 of file SkShaper_skunicode.cpp.

60 {
61 return fUTF16LogicalPosition == fBidi->getLength();
62 }

◆ consume()

void SkUnicodeBidiRunIterator::consume ( )
inlineoverridevirtual

Set state to that of current run and move iterator to end of that run.

Implements SkShaper::RunIterator.

Definition at line 40 of file SkShaper_skunicode.cpp.

40 {
41 SkASSERT(fUTF16LogicalPosition < fBidi->getLength());
42 int32_t endPosition = fBidi->getLength();
43 fLevel = fBidi->getLevelAt(fUTF16LogicalPosition);
44 SkUnichar u = utf8_next(&fEndOfCurrentRun, fEnd);
45 fUTF16LogicalPosition += SkUTF::ToUTF16(u);
47 while (fUTF16LogicalPosition < endPosition) {
48 level = fBidi->getLevelAt(fUTF16LogicalPosition);
49 if (level != fLevel) {
50 break;
51 }
52 u = utf8_next(&fEndOfCurrentRun, fEnd);
53
54 fUTF16LogicalPosition += SkUTF::ToUTF16(u);
55 }
56 }
#define SkASSERT(cond)
Definition: SkAssert.h:116
static SkUnichar utf8_next(const char **ptr, const char *end)
int32_t SkUnichar
Definition: SkTypes.h:175
uint8_t Level
Definition: SkUnicode.h:46
SK_SPI size_t ToUTF16(SkUnichar uni, uint16_t utf16[2]=nullptr)
Definition: SkUTF.cpp:243

◆ currentLevel()

SkBidiIterator::Level SkUnicodeBidiRunIterator::currentLevel ( ) const
inlineoverridevirtual

The unicode bidi embedding level (even ltr, odd rtl)

Implements SkShaper::BiDiRunIterator.

Definition at line 63 of file SkShaper_skunicode.cpp.

63 {
64 return fLevel;
65 }

◆ endOfCurrentRun()

size_t SkUnicodeBidiRunIterator::endOfCurrentRun ( ) const
inlineoverridevirtual

Offset to one past the last (utf8) element in the current run.

Implements SkShaper::RunIterator.

Definition at line 57 of file SkShaper_skunicode.cpp.

57 {
58 return fEndOfCurrentRun - fBegin;
59 }

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