Flutter Engine
The Flutter Engine
Classes | Public Types | Static Public Member Functions | List of all members
skottie::Shaper Class Referencefinal

#include <TextShaper.h>

Classes

struct  Fragment
 
struct  Result
 
struct  RunRec
 
struct  ShapedGlyphs
 
struct  TextDesc
 

Public Types

enum class  VAlign : uint8_t {
  kTop , kTopBaseline , kHybridTop , kHybridCenter ,
  kHybridBottom , kVisualTop , kVisualCenter , kVisualBottom
}
 
enum class  ResizePolicy : uint8_t { kNone , kScaleToFit , kDownscaleToFit }
 
enum class  LinebreakPolicy : uint8_t { kParagraph , kExplicit }
 
enum class  Direction : uint8_t { kLTR , kRTL }
 
enum class  Capitalization { kNone , kUpperCase }
 
enum  Flags : uint32_t { kNone = 0x00 , kFragmentGlyphs = 0x01 , kTrackFragmentAdvanceAscent = 0x02 , kClusters = 0x04 }
 

Static Public Member Functions

static Result Shape (const SkString &text, const TextDesc &desc, const SkPoint &point, const sk_sp< SkFontMgr > &, const sk_sp< SkShapers::Factory > &)
 
static Result Shape (const SkString &text, const TextDesc &desc, const SkRect &box, const sk_sp< SkFontMgr > &, const sk_sp< SkShapers::Factory > &)
 
static Result Shape (const SkString &text, const TextDesc &desc, const SkPoint &point, const sk_sp< SkFontMgr > &)
 
static Result Shape (const SkString &text, const TextDesc &desc, const SkRect &box, const sk_sp< SkFontMgr > &)
 

Detailed Description

Definition at line 37 of file TextShaper.h.

Member Enumeration Documentation

◆ Capitalization

Enumerator
kNone 
kUpperCase 

Definition at line 137 of file TextShaper.h.

137 {
138 kNone,
139 kUpperCase,
140 };

◆ Direction

enum class skottie::Shaper::Direction : uint8_t
strong
Enumerator
kLTR 
kRTL 

Definition at line 135 of file TextShaper.h.

135: uint8_t { kLTR, kRTL };

◆ Flags

enum skottie::Shaper::Flags : uint32_t
Enumerator
kNone 
kFragmentGlyphs 
kTrackFragmentAdvanceAscent 
kClusters 

Definition at line 142 of file TextShaper.h.

142 : uint32_t {
143 kNone = 0x00,
144
145 // Split out individual glyphs into separate Fragments
146 // (useful when the caller intends to manipulate glyphs independently).
147 kFragmentGlyphs = 0x01,
148
149 // Compute the advance and ascent for each fragment.
151
152 // Return cluster information.
153 kClusters = 0x04,
154 };
@ kTrackFragmentAdvanceAscent
Definition: TextShaper.h:150

◆ LinebreakPolicy

enum class skottie::Shaper::LinebreakPolicy : uint8_t
strong
Enumerator
kParagraph 
kExplicit 

Definition at line 127 of file TextShaper.h.

127 : uint8_t {
128 // Break lines such that they fit in a non-empty paragraph box, horizontally.
130 // Only break lines when requested explicitly (\r), regardless of paragraph box dimensions.
131 kExplicit,
132 };

◆ ResizePolicy

enum class skottie::Shaper::ResizePolicy : uint8_t
strong
Enumerator
kNone 
kScaleToFit 
kDownscaleToFit 

Definition at line 116 of file TextShaper.h.

116 : uint8_t {
117 // Use the specified text size.
118 kNone,
119 // Resize the text such that the extent box fits (snuggly) in the text box,
120 // both horizontally and vertically.
121 kScaleToFit,
122 // Same kScaleToFit if the text doesn't fit at the specified font size.
123 // Otherwise, same as kNone.
124 kDownscaleToFit,
125 };

◆ VAlign

enum class skottie::Shaper::VAlign : uint8_t
strong
Enumerator
kTop 
kTopBaseline 
kHybridTop 
kHybridCenter 
kHybridBottom 
kVisualTop 
kVisualCenter 
kVisualBottom 

Definition at line 89 of file TextShaper.h.

89 : uint8_t {
90 // Align the first line typographical top with the text box top (AE box text).
91 kTop,
92 // Align the first line typographical baseline with the text box top (AE point text).
93 kTopBaseline,
94
95 // Skottie vertical alignment extensions
96
97 // These are based on a hybrid extent box defined (in Y) as
98 //
99 // ------------------------------------------------------
100 // MIN(visual_top_extent , typographical_top_extent )
101 //
102 // ...
103 //
104 // MAX(visual_bottom_extent, typographical_bottom_extent)
105 // ------------------------------------------------------
106 kHybridTop, // extent box top -> text box top
107 kHybridCenter, // extent box center -> text box center
108 kHybridBottom, // extent box bottom -> text box bottom
109
110 // Visual alignement modes -- these are using tight visual bounds for the paragraph.
111 kVisualTop, // visual top -> text box top
112 kVisualCenter, // visual center -> text box center
113 kVisualBottom, // visual bottom -> text box bottom
114 };

Member Function Documentation

◆ Shape() [1/4]

Shaper::Result skottie::Shaper::Shape ( const SkString text,
const TextDesc desc,
const SkPoint point,
const sk_sp< SkFontMgr > &  fontmgr 
)
static

Definition at line 748 of file TextShaper.cpp.

749 {
750 return Shaper::Shape(text, desc, point, fontmgr, SkShapers::BestAvailable());
751}
static Result Shape(const SkString &text, const TextDesc &desc, const SkPoint &point, const sk_sp< SkFontMgr > &, const sk_sp< SkShapers::Factory > &)
Definition: TextShaper.cpp:643
std::u16string text
sk_sp< Factory > BestAvailable()

◆ Shape() [2/4]

Shaper::Result skottie::Shaper::Shape ( const SkString text,
const TextDesc desc,
const SkPoint point,
const sk_sp< SkFontMgr > &  fontmgr,
const sk_sp< SkShapers::Factory > &  shapingFactory 
)
static

Definition at line 643 of file TextShaper.cpp.

644 {
645 const AdjustedText adjText(text, desc, shapingFactory->getUnicode());
646
647 return (desc.fResize == ResizePolicy::kScaleToFit ||
648 desc.fResize == ResizePolicy::kDownscaleToFit) // makes no sense in point mode
649 ? Result()
650 : ShapeImpl(adjText, desc, SkRect::MakeEmpty().makeOffset(point.x(), point.y()),
651 fontmgr, shapingFactory, nullptr);
652}
virtual SkUnicode * getUnicode()=0
double y
double x

◆ Shape() [3/4]

Shaper::Result skottie::Shaper::Shape ( const SkString text,
const TextDesc desc,
const SkRect box,
const sk_sp< SkFontMgr > &  fontmgr 
)
static

Definition at line 753 of file TextShaper.cpp.

754 {
755 return Shaper::Shape(text, desc, box, fontmgr, SkShapers::BestAvailable());
756}

◆ Shape() [4/4]

Shaper::Result skottie::Shaper::Shape ( const SkString text,
const TextDesc desc,
const SkRect box,
const sk_sp< SkFontMgr > &  fontmgr,
const sk_sp< SkShapers::Factory > &  shapingFactory 
)
static

Definition at line 654 of file TextShaper.cpp.

655 {
656 const AdjustedText adjText(text, desc, shapingFactory->getUnicode());
657
658 switch(desc.fResize) {
660 return ShapeImpl(adjText, desc, box, fontmgr, shapingFactory, nullptr);
662 return ShapeToFit(adjText, desc, box, fontmgr, shapingFactory);
664 SkSize size;
665 auto result = ShapeImpl(adjText, desc, box, fontmgr, shapingFactory, &size);
666
667 return result_fits(result, size, box, desc)
668 ? result
669 : ShapeToFit(adjText, desc, box, fontmgr, shapingFactory);
670 }
671 }
672
674}
#define SkUNREACHABLE
Definition: SkAssert.h:135
GAsyncResult * result
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
Definition: SkSize.h:52

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