Flutter Engine
The Flutter Engine
Classes | Typedefs | Enumerations | Functions | Variables
skia::textlayout Namespace Reference

Classes

struct  Block
 
class  CanvasParagraphPainter
 
class  Cluster
 
struct  Decoration
 
class  Decorations
 
class  DirText
 
class  FontArguments
 
class  FontCollection
 
struct  FontFeature
 
class  InternalLineMetrics
 
class  LangIterator
 
class  LineMetrics
 
class  OneLineShaper
 
class  Paragraph
 
class  ParagraphBuilder
 
class  ParagraphBuilderImpl
 
class  ParagraphCache
 
class  ParagraphCacheKey
 
class  ParagraphCacheValue
 
class  ParagraphImpl
 
class  ParagraphPainter
 
class  ParagraphPainterAutoRestore
 
struct  ParagraphStyle
 
struct  Placeholder
 
struct  PlaceholderStyle
 
struct  PositionWithAffinity
 
struct  ResolvedFontDescriptor
 
class  Run
 
struct  SkRange
 
struct  StrutStyle
 
struct  StyleBlock
 
class  StyleMetrics
 
class  TestFontCollection
 
struct  TextBox
 
class  TextLine
 
class  TextShadow
 
class  TextStyle
 
class  TextWrapper
 
class  TypefaceFontProvider
 
class  TypefaceFontStyleSet
 

Typedefs

typedef size_t TextIndex
 
typedef SkRange< size_t > TextRange
 
typedef size_t BlockIndex
 
typedef SkRange< size_t > BlockRange
 
typedef size_t RunIndex
 
typedef size_t ClusterIndex
 
typedef SkRange< size_t > ClusterRange
 
typedef size_t GraphemeIndex
 
typedef SkRange< GraphemeIndexGraphemeRange
 
typedef size_t GlyphIndex
 
typedef SkRange< GlyphIndexGlyphRange
 

Enumerations

enum  Affinity { kUpstream , kDownstream }
 
enum class  RectHeightStyle {
  kTight , kMax , kIncludeLineSpacingMiddle , kIncludeLineSpacingTop ,
  kIncludeLineSpacingBottom , kStrut
}
 
enum class  RectWidthStyle { kTight , kMax }
 
enum class  TextAlign {
  kLeft , kRight , kCenter , kJustify ,
  kStart , kEnd
}
 
enum class  TextDirection { kRtl , kLtr }
 
enum class  TextBaseline { kAlphabetic , kIdeographic }
 
enum  TextHeightBehavior { kAll = 0x0 , kDisableFirstAscent = 0x1 , kDisableLastDescent = 0x2 , kDisableAll = 0x1 | 0x2 }
 
enum class  LineMetricStyle : uint8_t { Typographic , CSS }
 
enum  TextDecoration { kNoDecoration = 0x0 , kUnderline = 0x1 , kOverline = 0x2 , kLineThrough = 0x4 }
 
enum  TextDecorationStyle {
  kSolid , kDouble , kDotted , kDashed ,
  kWavy
}
 
enum  TextDecorationMode { kGaps , kThrough }
 
enum  StyleType {
  kNone , kAllAttributes , kFont , kForeground ,
  kBackground , kShadow , kDecorations , kLetterSpacing ,
  kWordSpacing
}
 
enum class  PlaceholderAlignment {
  kBaseline , kAboveBaseline , kBelowBaseline , kTop ,
  kBottom , kMiddle
}
 Where to vertically align the placeholder relative to the surrounding text. More...
 
enum  InternalState {
  kUnknown = 0 , kIndexed = 1 , kShaped = 2 , kLineBroken = 5 ,
  kFormatted = 6 , kDrawn = 7
}
 

Functions

template<typename C , typename UnaryFunction >
UnaryFunction directional_for_each (C &c, bool forwards, UnaryFunction f)
 
static bool nearlyZero (SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
 
static bool nearlyEqual (SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
 
bool operator== (const FontArguments &a, const FontArguments &b)
 
bool operator!= (const skia::textlayout::FontArguments &a, const skia::textlayout::FontArguments &b)
 
TextRange operator* (const TextRange &a, const TextRange &b)
 
static bool is_ascii_7bit_space (int c)
 
template<typename T >
bool operator== (const SkSpan< T > &a, const SkSpan< T > &b)
 
template<typename T >
bool operator<= (const SkSpan< T > &a, const SkSpan< T > &b)
 

Variables

const size_t EMPTY_INDEX = std::numeric_limits<size_t>::max()
 
const SkRange< size_t > EMPTY_RANGE = SkRange<size_t>(EMPTY_INDEX, EMPTY_INDEX)
 
constexpr TextDecoration AllTextDecorations []
 
const SkRange< size_t > EMPTY_TEXT = EMPTY_RANGE
 
const size_t EMPTY_BLOCK = EMPTY_INDEX
 
const SkRange< size_t > EMPTY_BLOCKS = EMPTY_RANGE
 
const size_t EMPTY_RUN = EMPTY_INDEX
 
const size_t EMPTY_CLUSTER = EMPTY_INDEX
 
const SkRange< size_t > EMPTY_CLUSTERS = EMPTY_RANGE
 

Typedef Documentation

◆ BlockIndex

Definition at line 355 of file TextStyle.h.

◆ BlockRange

Definition at line 356 of file TextStyle.h.

◆ ClusterIndex

Definition at line 35 of file Run.h.

◆ ClusterRange

Definition at line 36 of file Run.h.

◆ GlyphIndex

Definition at line 43 of file Run.h.

◆ GlyphRange

Definition at line 44 of file Run.h.

◆ GraphemeIndex

Definition at line 40 of file Run.h.

◆ GraphemeRange

Definition at line 41 of file Run.h.

◆ RunIndex

Definition at line 32 of file Run.h.

◆ TextIndex

Definition at line 336 of file TextStyle.h.

◆ TextRange

Definition at line 337 of file TextStyle.h.

Enumeration Type Documentation

◆ Affinity

Enumerator
kUpstream 
kDownstream 

Definition at line 16 of file DartTypes.h.

◆ InternalState

Enumerator
kUnknown 
kIndexed 
kShaped 
kLineBroken 
kFormatted 
kDrawn 

Definition at line 71 of file ParagraphImpl.h.

71 {
72 kUnknown = 0,
73 kIndexed = 1, // Text is indexed
74 kShaped = 2, // Text is shaped
75 kLineBroken = 5,
76 kFormatted = 6,
77 kDrawn = 7
78};

◆ LineMetricStyle

enum class skia::textlayout::LineMetricStyle : uint8_t
strong
Enumerator
Typographic 
CSS 

Definition at line 143 of file DartTypes.h.

143 : uint8_t {
144 // Use ascent, descent, etc from a fixed baseline.
146 // Use ascent, descent, etc like css with the leading split and with height adjustments
147 CSS
148};
Definition: dart.idl:550

◆ PlaceholderAlignment

Where to vertically align the placeholder relative to the surrounding text.

Enumerator
kBaseline 

Match the baseline of the placeholder with the baseline.

kAboveBaseline 

Align the bottom edge of the placeholder with the baseline such that the placeholder sits on top of the baseline.

kBelowBaseline 

Align the top edge of the placeholder with the baseline specified in such that the placeholder hangs below the baseline.

kTop 

Align the top edge of the placeholder with the top edge of the font. When the placeholder is very tall, the extra space will hang from the top and extend through the bottom of the line.

kBottom 

Align the bottom edge of the placeholder with the top edge of the font. When the placeholder is very tall, the extra space will rise from the bottom and extend through the top of the line.

kMiddle 

Align the middle of the placeholder with the middle of the text. When the placeholder is very tall, the extra space will grow equally from the top and bottom of the line.

Definition at line 87 of file TextStyle.h.

87 {
88 /// Match the baseline of the placeholder with the baseline.
90
91 /// Align the bottom edge of the placeholder with the baseline such that the
92 /// placeholder sits on top of the baseline.
94
95 /// Align the top edge of the placeholder with the baseline specified in
96 /// such that the placeholder hangs below the baseline.
98
99 /// Align the top edge of the placeholder with the top edge of the font.
100 /// When the placeholder is very tall, the extra space will hang from
101 /// the top and extend through the bottom of the line.
102 kTop,
103
104 /// Align the bottom edge of the placeholder with the top edge of the font.
105 /// When the placeholder is very tall, the extra space will rise from
106 /// the bottom and extend through the top of the line.
107 kBottom,
108
109 /// Align the middle of the placeholder with the middle of the text. When the
110 /// placeholder is very tall, the extra space will grow equally from
111 /// the top and bottom of the line.
112 kMiddle,
113};
const SkScalar kBottom
@ kBaseline
Match the baseline of the placeholder with the baseline.

◆ RectHeightStyle

Enumerator
kTight 
kMax 
kIncludeLineSpacingMiddle 
kIncludeLineSpacingTop 
kIncludeLineSpacingBottom 
kStrut 

Definition at line 18 of file DartTypes.h.

18 {
19 // Provide tight bounding boxes that fit heights per run.
20 kTight,
21
22 // The height of the boxes will be the maximum height of all runs in the
23 // line. All rects in the same line will be the same height.
24 kMax,
25
26 // Extends the top and/or bottom edge of the bounds to fully cover any line
27 // spacing. The top edge of each line should be the same as the bottom edge
28 // of the line above. There should be no gaps in vertical coverage given any
29 // ParagraphStyle line_height.
30 //
31 // The top and bottom of each rect will cover half of the
32 // space above and half of the space below the line.
34 // The line spacing will be added to the top of the rect.
36 // The line spacing will be added to the bottom of the rect.
38 //
39 kStrut
40};

◆ RectWidthStyle

Enumerator
kTight 
kMax 

Definition at line 42 of file DartTypes.h.

42 {
43 // Provide tight bounding boxes that fit widths to the runs of each line
44 // independently.
45 kTight,
46
47 // Extends the width of the last rect of each line to match the position of
48 // the widest rect over all the lines.
49 kMax
50};

◆ StyleType

Enumerator
kNone 
kAllAttributes 
kFont 
kForeground 
kBackground 
kShadow 
kDecorations 
kLetterSpacing 
kWordSpacing 

Definition at line 58 of file TextStyle.h.

58 {
59 kNone,
61 kFont,
64 kShadow,
68};
@ kBackground
Suitable for threads that shouldn't disrupt high priority work.
Definition: embedder.h:260

◆ TextAlign

enum class skia::textlayout::TextAlign
strong
Enumerator
kLeft 
kRight 
kCenter 
kJustify 
kStart 
kEnd 

Definition at line 52 of file DartTypes.h.

52 {
53 kLeft,
54 kRight,
55 kCenter,
56 kJustify,
57 kStart,
58 kEnd,
59};

◆ TextBaseline

enum class skia::textlayout::TextBaseline
strong
Enumerator
kAlphabetic 
kIdeographic 

Definition at line 131 of file DartTypes.h.

131 {
134};
@ kIdeographic
Definition: text_baseline.h:24
@ kAlphabetic
Definition: text_baseline.h:23

◆ TextDecoration

Enumerator
kNoDecoration 
kUnderline 
kOverline 
kLineThrough 

Definition at line 41 of file TextStyle.h.

41 {
42 kNoDecoration = 0x0,
43 kUnderline = 0x1,
44 kOverline = 0x2,
45 kLineThrough = 0x4,
46};

◆ TextDecorationMode

Enumerator
kGaps 
kThrough 

Definition at line 56 of file TextStyle.h.

◆ TextDecorationStyle

Enumerator
kSolid 
kDouble 
kDotted 
kDashed 
kWavy 

Definition at line 54 of file TextStyle.h.

◆ TextDirection

Enumerator
kRtl 
kLtr 

Definition at line 61 of file DartTypes.h.

61 {
62 kRtl,
63 kLtr,
64};

◆ TextHeightBehavior

Enumerator
kAll 
kDisableFirstAscent 
kDisableLastDescent 
kDisableAll 

Definition at line 136 of file DartTypes.h.

136 {
137 kAll = 0x0,
140 kDisableAll = 0x1 | 0x2,
141};

Function Documentation

◆ directional_for_each()

template<typename C , typename UnaryFunction >
UnaryFunction skia::textlayout::directional_for_each ( C c,
bool  forwards,
UnaryFunction  f 
)

Definition at line 85 of file DartTypes.h.

85 {
86 return forwards
87 ? std::for_each(std::begin(c), std::end(c), f)
88 : std::for_each(std::rbegin(c), std::rend(c), f);
89}
static const char * begin(const StringSlice &s)
Definition: editor.cpp:252
Definition: ref_ptr.h:256

◆ is_ascii_7bit_space()

static bool skia::textlayout::is_ascii_7bit_space ( int  c)
static

Definition at line 317 of file ParagraphImpl.cpp.

317 {
318 SkASSERT(c >= 0 && c <= 127);
319
320 // Extracted from https://en.wikipedia.org/wiki/Whitespace_character
321 //
322 enum WS {
323 kHT = 9,
324 kLF = 10,
325 kVT = 11,
326 kFF = 12,
327 kCR = 13,
328 kSP = 32, // too big to use as shift
329 };
330#define M(shift) (1 << (shift))
331 constexpr uint32_t kSpaceMask = M(kHT) | M(kLF) | M(kVT) | M(kFF) | M(kCR);
332 // we check for Space (32) explicitly, since it is too large to shift
333 return (c == kSP) || (c <= 31 && (kSpaceMask & M(c)));
334#undef M
335}
#define M(shift)
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ nearlyEqual()

static bool skia::textlayout::nearlyEqual ( SkScalar  x,
SkScalar  y,
SkScalar  tolerance = SK_ScalarNearlyZero 
)
inlinestatic

Definition at line 31 of file TextStyle.h.

31 {
32 if (SkIsFinite(x, y)) {
33 return SkScalarNearlyEqual(x, y, tolerance);
34 }
35 // Inf == Inf, anything else is false
36 return x == y;
37}
static bool SkIsFinite(T x, Pack... values)
static bool SkScalarNearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
Definition: SkScalar.h:107
double y
double x

◆ nearlyZero()

static bool skia::textlayout::nearlyZero ( SkScalar  x,
SkScalar  tolerance = SK_ScalarNearlyZero 
)
inlinestatic

Definition at line 24 of file TextStyle.h.

24 {
25 if (SkIsFinite(x)) {
26 return SkScalarNearlyZero(x, tolerance);
27 }
28 return false;
29}
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
Definition: SkScalar.h:101

◆ operator!=()

bool skia::textlayout::operator!= ( const skia::textlayout::FontArguments a,
const skia::textlayout::FontArguments b 
)

Definition at line 54 of file FontArguments.cpp.

54 {
55 return !(a == b);
56}
static bool b
struct MyStruct a[10]

◆ operator*()

TextRange skia::textlayout::operator* ( const TextRange a,
const TextRange b 
)

Definition at line 51 of file ParagraphImpl.cpp.

51 {
52 if (a.start == b.start && a.end == b.end) return a;
53 auto begin = std::max(a.start, b.start);
54 auto end = std::min(a.end, b.end);
55 return end > begin ? TextRange(begin, end) : EMPTY_TEXT;
56}
glong glong end
static float max(float r, float g, float b)
Definition: hsl.cpp:49
static float min(float r, float g, float b)
Definition: hsl.cpp:48
const SkRange< size_t > EMPTY_TEXT
Definition: TextStyle.h:338
SkRange< size_t > TextRange
Definition: TextStyle.h:337

◆ operator<=()

template<typename T >
bool skia::textlayout::operator<= ( const SkSpan< T > &  a,
const SkSpan< T > &  b 
)

Definition at line 47 of file ParagraphImpl.h.

47 {
48 return a.begin() >= b.begin() && a.end() <= b.end();
49}

◆ operator==() [1/2]

bool skia::textlayout::operator== ( const FontArguments a,
const FontArguments b 
)

Definition at line 47 of file FontArguments.cpp.

47 {
48 return a.fCollectionIndex == b.fCollectionIndex &&
49 a.fCoordinates == b.fCoordinates &&
50 a.fPaletteIndex == b.fPaletteIndex &&
51 a.fPaletteOverrides == b.fPaletteOverrides;
52}

◆ operator==() [2/2]

template<typename T >
bool skia::textlayout::operator== ( const SkSpan< T > &  a,
const SkSpan< T > &  b 
)

Definition at line 43 of file ParagraphImpl.h.

43 {
44 return a.size() == b.size() && a.begin() == b.begin();
45}

Variable Documentation

◆ AllTextDecorations

constexpr TextDecoration skia::textlayout::AllTextDecorations[]
constexpr
Initial value:

Definition at line 47 of file TextStyle.h.

◆ EMPTY_BLOCK

const size_t skia::textlayout::EMPTY_BLOCK = EMPTY_INDEX

Definition at line 357 of file TextStyle.h.

◆ EMPTY_BLOCKS

const SkRange<size_t> skia::textlayout::EMPTY_BLOCKS = EMPTY_RANGE

Definition at line 358 of file TextStyle.h.

◆ EMPTY_CLUSTER

const size_t skia::textlayout::EMPTY_CLUSTER = EMPTY_INDEX

Definition at line 37 of file Run.h.

◆ EMPTY_CLUSTERS

const SkRange<size_t> skia::textlayout::EMPTY_CLUSTERS = EMPTY_RANGE

Definition at line 38 of file Run.h.

◆ EMPTY_INDEX

const size_t skia::textlayout::EMPTY_INDEX = std::numeric_limits<size_t>::max()

Definition at line 91 of file DartTypes.h.

◆ EMPTY_RANGE

const SkRange<size_t> skia::textlayout::EMPTY_RANGE = SkRange<size_t>(EMPTY_INDEX, EMPTY_INDEX)

Definition at line 128 of file DartTypes.h.

◆ EMPTY_RUN

const size_t skia::textlayout::EMPTY_RUN = EMPTY_INDEX

Definition at line 33 of file Run.h.

◆ EMPTY_TEXT

const SkRange<size_t> skia::textlayout::EMPTY_TEXT = EMPTY_RANGE

Definition at line 338 of file TextStyle.h.