Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
paragraph_style.cc File Reference
#include "flutter/skwasm/export.h"
#include "flutter/skwasm/text/text_types.h"
#include "flutter/skwasm/wrappers.h"
#include "third_party/skia/modules/skparagraph/include/Paragraph.h"

Go to the source code of this file.

Functions

SKWASM_EXPORT Skwasm::ParagraphStyleparagraphStyle_create ()
 
SKWASM_EXPORT void paragraphStyle_dispose (Skwasm::ParagraphStyle *style)
 
SKWASM_EXPORT void paragraphStyle_setTextAlign (Skwasm::ParagraphStyle *style, skia::textlayout::TextAlign align)
 
SKWASM_EXPORT void paragraphStyle_setTextDirection (Skwasm::ParagraphStyle *style, skia::textlayout::TextDirection direction)
 
SKWASM_EXPORT void paragraphStyle_setMaxLines (Skwasm::ParagraphStyle *style, size_t max_lines)
 
SKWASM_EXPORT void paragraphStyle_setHeight (Skwasm::ParagraphStyle *style, SkScalar height)
 
SKWASM_EXPORT void paragraphStyle_setTextHeightBehavior (Skwasm::ParagraphStyle *style, bool apply_height_to_first_ascent, bool apply_height_to_last_descent)
 
SKWASM_EXPORT void paragraphStyle_setEllipsis (Skwasm::ParagraphStyle *style, SkString *ellipsis)
 
SKWASM_EXPORT void paragraphStyle_setStrutStyle (Skwasm::ParagraphStyle *style, skia::textlayout::StrutStyle *strut_style)
 
SKWASM_EXPORT void paragraphStyle_setTextStyle (Skwasm::ParagraphStyle *style, Skwasm::TextStyle *text_style)
 
SKWASM_EXPORT void paragraphStyle_setApplyRoundingHack (Skwasm::ParagraphStyle *style, bool apply_rounding_hack)
 

Function Documentation

◆ paragraphStyle_create()

SKWASM_EXPORT Skwasm::ParagraphStyle * paragraphStyle_create ( )

Definition at line 10 of file paragraph_style.cc.

10 {
11 auto style = new Skwasm::ParagraphStyle();
12
13 // This is the default behavior in Flutter
14 style->skia_paragraph_style.setReplaceTabCharacters(true);
15
16 // Default text style has a black color
17 style->text_style.skia_style.setColor(SK_ColorBLACK);
18
19 return style;
20}

◆ paragraphStyle_dispose()

SKWASM_EXPORT void paragraphStyle_dispose ( Skwasm::ParagraphStyle style)

Definition at line 22 of file paragraph_style.cc.

22 {
23 delete style;
24}

◆ paragraphStyle_setApplyRoundingHack()

SKWASM_EXPORT void paragraphStyle_setApplyRoundingHack ( Skwasm::ParagraphStyle style,
bool  apply_rounding_hack 
)

Definition at line 81 of file paragraph_style.cc.

83 {
84 style->skia_paragraph_style.setApplyRoundingHack(apply_rounding_hack);
85}
skia::textlayout::ParagraphStyle skia_paragraph_style
Definition text_types.h:39

References Skwasm::ParagraphStyle::skia_paragraph_style.

◆ paragraphStyle_setEllipsis()

SKWASM_EXPORT void paragraphStyle_setEllipsis ( Skwasm::ParagraphStyle style,
SkString *  ellipsis 
)

Definition at line 65 of file paragraph_style.cc.

66 {
67 style->skia_paragraph_style.setEllipsis(*ellipsis);
68}

References Skwasm::ParagraphStyle::skia_paragraph_style.

◆ paragraphStyle_setHeight()

SKWASM_EXPORT void paragraphStyle_setHeight ( Skwasm::ParagraphStyle style,
SkScalar  height 
)

Definition at line 43 of file paragraph_style.cc.

44 {
45 style->skia_paragraph_style.setHeight(height);
46}
int32_t height

References height, and Skwasm::ParagraphStyle::skia_paragraph_style.

◆ paragraphStyle_setMaxLines()

SKWASM_EXPORT void paragraphStyle_setMaxLines ( Skwasm::ParagraphStyle style,
size_t  max_lines 
)

Definition at line 38 of file paragraph_style.cc.

39 {
40 style->skia_paragraph_style.setMaxLines(max_lines);
41}

References Skwasm::ParagraphStyle::skia_paragraph_style.

◆ paragraphStyle_setStrutStyle()

SKWASM_EXPORT void paragraphStyle_setStrutStyle ( Skwasm::ParagraphStyle style,
skia::textlayout::StrutStyle *  strut_style 
)

Definition at line 70 of file paragraph_style.cc.

72 {
73 style->skia_paragraph_style.setStrutStyle(*strut_style);
74}

References Skwasm::ParagraphStyle::skia_paragraph_style.

◆ paragraphStyle_setTextAlign()

SKWASM_EXPORT void paragraphStyle_setTextAlign ( Skwasm::ParagraphStyle style,
skia::textlayout::TextAlign  align 
)

Definition at line 26 of file paragraph_style.cc.

28 {
29 style->skia_paragraph_style.setTextAlign(align);
30}

References Skwasm::ParagraphStyle::skia_paragraph_style.

◆ paragraphStyle_setTextDirection()

SKWASM_EXPORT void paragraphStyle_setTextDirection ( Skwasm::ParagraphStyle style,
skia::textlayout::TextDirection  direction 
)

Definition at line 32 of file paragraph_style.cc.

34 {
35 style->skia_paragraph_style.setTextDirection(direction);
36}

References Skwasm::ParagraphStyle::skia_paragraph_style.

◆ paragraphStyle_setTextHeightBehavior()

SKWASM_EXPORT void paragraphStyle_setTextHeightBehavior ( Skwasm::ParagraphStyle style,
bool  apply_height_to_first_ascent,
bool  apply_height_to_last_descent 
)

Definition at line 48 of file paragraph_style.cc.

51 {
52 skia::textlayout::TextHeightBehavior behavior;
53 if (!apply_height_to_first_ascent && !apply_height_to_last_descent) {
54 behavior = skia::textlayout::kDisableAll;
55 } else if (!apply_height_to_last_descent) {
56 behavior = skia::textlayout::kDisableLastDescent;
57 } else if (!apply_height_to_first_ascent) {
58 behavior = skia::textlayout::kDisableFirstAscent;
59 } else {
60 behavior = skia::textlayout::kAll;
61 }
62 style->skia_paragraph_style.setTextHeightBehavior(behavior);
63}

References Skwasm::ParagraphStyle::skia_paragraph_style.

◆ paragraphStyle_setTextStyle()

SKWASM_EXPORT void paragraphStyle_setTextStyle ( Skwasm::ParagraphStyle style,
Skwasm::TextStyle text_style 
)

Definition at line 76 of file paragraph_style.cc.

77 {
78 style->text_style = *text_style;
79}

References Skwasm::ParagraphStyle::text_style.