1 // Copyright 2021 Google LLC. 2 #ifndef TextRun_DEFINED 3 #define TextRun_DEFINED 4 5 #include "experimental/sktext/include/Types.h" 6 #include "modules/skshaper/include/SkShaper.h" 7 8 namespace skia { 9 namespace text { 10 class TextRun { 11 public: 12 TextRun(const SkShaper::RunHandler::RunInfo& info); 13 TextRun& operator=(const TextRun&) = delete; 14 TextRun(TextRun&&) = default; 15 TextRun& operator=(TextRun&&) = delete; 16 ~TextRun() = default; 17 18 SkShaper::RunHandler::Buffer newRunBuffer(); 19 void commit(); 20 21 SkScalar calculateWidth(GlyphRange glyphRange) const; 22 leftToRight()23 bool leftToRight() const { return fBidiLevel % 2 == 0; } bidiLevel()24 uint8_t bidiLevel() const { return fBidiLevel; } 25 26 private: 27 friend class Wrapper; 28 friend class Processor; 29 30 SkFont fFont; 31 32 SkVector fAdvance; 33 SkShaper::RunHandler::Range fUtf8Range; 34 SkSTArray<128, SkGlyphID, true> fGlyphs; 35 SkSTArray<128, SkPoint, true> fPositions; 36 SkSTArray<128, uint32_t, true> fClusters; 37 SkSTArray<128, SkRect, true> fBounds; 38 39 uint8_t fBidiLevel; 40 }; 41 } // namespace text 42 } // namespace skia 43 #endif 44