Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
paragraph_style.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
8#include "third_party/skia/modules/skparagraph/include/Paragraph.h"
9
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}
21
25
28 skia::textlayout::TextAlign align) {
29 style->skia_paragraph_style.setTextAlign(align);
30}
31
34 skia::textlayout::TextDirection direction) {
35 style->skia_paragraph_style.setTextDirection(direction);
36}
37
39 size_t max_lines) {
40 style->skia_paragraph_style.setMaxLines(max_lines);
41}
42
47
50 bool apply_height_to_first_ascent,
51 bool apply_height_to_last_descent) {
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}
64
66 SkString* ellipsis) {
67 style->skia_paragraph_style.setEllipsis(*ellipsis);
68}
69
72 skia::textlayout::StrutStyle* strut_style) {
73 style->skia_paragraph_style.setStrutStyle(*strut_style);
74}
75
77 Skwasm::TextStyle* text_style) {
78 style->text_style = *text_style;
79}
80
83 bool apply_rounding_hack) {
84 style->skia_paragraph_style.setApplyRoundingHack(apply_rounding_hack);
85}
int32_t height
#define SKWASM_EXPORT
Definition export.h:10
SKWASM_EXPORT void paragraphStyle_setTextHeightBehavior(Skwasm::ParagraphStyle *style, bool apply_height_to_first_ascent, bool apply_height_to_last_descent)
SKWASM_EXPORT void paragraphStyle_setApplyRoundingHack(Skwasm::ParagraphStyle *style, bool apply_rounding_hack)
SKWASM_EXPORT void paragraphStyle_setTextDirection(Skwasm::ParagraphStyle *style, skia::textlayout::TextDirection direction)
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_setHeight(Skwasm::ParagraphStyle *style, SkScalar height)
SKWASM_EXPORT void paragraphStyle_setMaxLines(Skwasm::ParagraphStyle *style, size_t max_lines)
SKWASM_EXPORT Skwasm::ParagraphStyle * paragraphStyle_create()
SKWASM_EXPORT void paragraphStyle_setTextAlign(Skwasm::ParagraphStyle *style, skia::textlayout::TextAlign align)
SKWASM_EXPORT void paragraphStyle_setTextStyle(Skwasm::ParagraphStyle *style, Skwasm::TextStyle *text_style)
SKWASM_EXPORT void paragraphStyle_dispose(Skwasm::ParagraphStyle *style)
skia::textlayout::ParagraphStyle skia_paragraph_style
Definition text_types.h:39