Flutter Engine
The Flutter Engine
Functions
paragraph_style.cpp File Reference
#include "../export.h"
#include "../wrappers.h"
#include "third_party/skia/modules/skparagraph/include/Paragraph.h"

Go to the source code of this file.

Functions

SKWASM_EXPORT ParagraphStyleparagraphStyle_create ()
 
SKWASM_EXPORT void paragraphStyle_dispose (ParagraphStyle *style)
 
SKWASM_EXPORT void paragraphStyle_setTextAlign (ParagraphStyle *style, TextAlign align)
 
SKWASM_EXPORT void paragraphStyle_setTextDirection (ParagraphStyle *style, TextDirection direction)
 
SKWASM_EXPORT void paragraphStyle_setMaxLines (ParagraphStyle *style, size_t maxLines)
 
SKWASM_EXPORT void paragraphStyle_setHeight (ParagraphStyle *style, SkScalar height)
 
SKWASM_EXPORT void paragraphStyle_setTextHeightBehavior (ParagraphStyle *style, bool applyHeightToFirstAscent, bool applyHeightToLastDescent)
 
SKWASM_EXPORT void paragraphStyle_setEllipsis (ParagraphStyle *style, SkString *ellipsis)
 
SKWASM_EXPORT void paragraphStyle_setStrutStyle (ParagraphStyle *style, StrutStyle *strutStyle)
 
SKWASM_EXPORT void paragraphStyle_setTextStyle (ParagraphStyle *style, TextStyle *textStyle)
 
SKWASM_EXPORT void paragraphStyle_setApplyRoundingHack (ParagraphStyle *style, bool applyRoundingHack)
 

Function Documentation

◆ paragraphStyle_create()

SKWASM_EXPORT ParagraphStyle * paragraphStyle_create ( )

Definition at line 12 of file paragraph_style.cpp.

12 {
13 auto style = new ParagraphStyle();
14
15 // This is the default behavior in Flutter
16 style->setReplaceTabCharacters(true);
17
18 // Default text style has a black color
19 TextStyle textStyle;
20 textStyle.setColor(SK_ColorBLACK);
21 style->setTextStyle(textStyle);
22
23 return style;
24}
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
void setColor(SkColor color)
Definition: TextStyle.h:166

◆ paragraphStyle_dispose()

SKWASM_EXPORT void paragraphStyle_dispose ( ParagraphStyle style)

Definition at line 26 of file paragraph_style.cpp.

26 {
27 delete style;
28}

◆ paragraphStyle_setApplyRoundingHack()

SKWASM_EXPORT void paragraphStyle_setApplyRoundingHack ( ParagraphStyle style,
bool  applyRoundingHack 
)

Definition at line 82 of file paragraph_style.cpp.

83 {
84 style->setApplyRoundingHack(applyRoundingHack);
85}

◆ paragraphStyle_setEllipsis()

SKWASM_EXPORT void paragraphStyle_setEllipsis ( ParagraphStyle style,
SkString ellipsis 
)

Definition at line 67 of file paragraph_style.cpp.

68 {
69 style->setEllipsis(*ellipsis);
70}
void setEllipsis(const std::u16string &ellipsis)

◆ paragraphStyle_setHeight()

SKWASM_EXPORT void paragraphStyle_setHeight ( ParagraphStyle style,
SkScalar  height 
)

Definition at line 45 of file paragraph_style.cpp.

46 {
47 style->setHeight(height);
48}
int32_t height
void setHeight(SkScalar height)

◆ paragraphStyle_setMaxLines()

SKWASM_EXPORT void paragraphStyle_setMaxLines ( ParagraphStyle style,
size_t  maxLines 
)

Definition at line 40 of file paragraph_style.cpp.

41 {
42 style->setMaxLines(maxLines);
43}
void setMaxLines(size_t maxLines)

◆ paragraphStyle_setStrutStyle()

SKWASM_EXPORT void paragraphStyle_setStrutStyle ( ParagraphStyle style,
StrutStyle strutStyle 
)

Definition at line 72 of file paragraph_style.cpp.

73 {
74 style->setStrutStyle(*strutStyle);
75}
void setStrutStyle(StrutStyle strutStyle)

◆ paragraphStyle_setTextAlign()

SKWASM_EXPORT void paragraphStyle_setTextAlign ( ParagraphStyle style,
TextAlign  align 
)

Definition at line 30 of file paragraph_style.cpp.

31 {
32 style->setTextAlign(align);
33}
void setTextAlign(TextAlign align)

◆ paragraphStyle_setTextDirection()

SKWASM_EXPORT void paragraphStyle_setTextDirection ( ParagraphStyle style,
TextDirection  direction 
)

Definition at line 35 of file paragraph_style.cpp.

36 {
37 style->setTextDirection(direction);
38}
void setTextDirection(TextDirection direction)

◆ paragraphStyle_setTextHeightBehavior()

SKWASM_EXPORT void paragraphStyle_setTextHeightBehavior ( ParagraphStyle style,
bool  applyHeightToFirstAscent,
bool  applyHeightToLastDescent 
)

Definition at line 50 of file paragraph_style.cpp.

53 {
54 TextHeightBehavior behavior;
55 if (!applyHeightToFirstAscent && !applyHeightToLastDescent) {
56 behavior = kDisableAll;
57 } else if (!applyHeightToLastDescent) {
58 behavior = kDisableLastDescent;
59 } else if (!applyHeightToFirstAscent) {
60 behavior = kDisableFirstAscent;
61 } else {
62 behavior = kAll;
63 }
64 style->setTextHeightBehavior(behavior);
65}
void setTextHeightBehavior(TextHeightBehavior v)

◆ paragraphStyle_setTextStyle()

SKWASM_EXPORT void paragraphStyle_setTextStyle ( ParagraphStyle style,
TextStyle textStyle 
)

Definition at line 77 of file paragraph_style.cpp.

78 {
79 style->setTextStyle(*textStyle);
80}
void setTextStyle(const TextStyle &textStyle)