Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
strut_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
5#include <vector>
6
9#include "third_party/skia/include/core/SkString.h"
10#include "third_party/skia/modules/skparagraph/include/Paragraph.h"
11
12SKWASM_EXPORT skia::textlayout::StrutStyle* strutStyle_create() {
14 auto style = new skia::textlayout::StrutStyle();
15 style->setStrutEnabled(true);
16 return style;
17}
18
19SKWASM_EXPORT void strutStyle_dispose(skia::textlayout::StrutStyle* style) {
21 delete style;
22}
23
25 skia::textlayout::StrutStyle* style,
26 SkString** font_families,
27 int count) {
28 std::vector<SkString> families;
29 families.reserve(count);
30 for (int i = 0; i < count; i++) {
31 families.push_back(*font_families[i]);
32 }
33 style->setFontFamilies(std::move(families));
34}
35
36SKWASM_EXPORT void strutStyle_setFontSize(skia::textlayout::StrutStyle* style,
37 SkScalar font_size) {
38 style->setFontSize(font_size);
39}
40
41SKWASM_EXPORT void strutStyle_setHeight(skia::textlayout::StrutStyle* style,
42 SkScalar height) {
43 style->setHeight(height);
44 style->setHeightOverride(true);
45}
46
48 skia::textlayout::StrutStyle* style,
49 bool half_leading) {
50 style->setHalfLeading(half_leading);
51}
52
53SKWASM_EXPORT void strutStyle_setLeading(skia::textlayout::StrutStyle* style,
54 SkScalar leading) {
55 style->setLeading(leading);
56}
57
58SKWASM_EXPORT void strutStyle_setFontStyle(skia::textlayout::StrutStyle* style,
59 int weight,
60 SkFontStyle::Slant slant) {
61 style->setFontStyle(SkFontStyle(weight, SkFontStyle::kNormal_Width, slant));
62}
63
65 skia::textlayout::StrutStyle* style,
66 bool force_strut_height) {
67 style->setForceStrutHeight(force_strut_height);
68}
uint32_t live_strut_style_count
int32_t height
#define SKWASM_EXPORT
Definition export.h:10
SKWASM_EXPORT void strutStyle_setFontStyle(skia::textlayout::StrutStyle *style, int weight, SkFontStyle::Slant slant)
SKWASM_EXPORT void strutStyle_dispose(skia::textlayout::StrutStyle *style)
SKWASM_EXPORT void strutStyle_setForceStrutHeight(skia::textlayout::StrutStyle *style, bool force_strut_height)
SKWASM_EXPORT void strutStyle_setFontFamilies(skia::textlayout::StrutStyle *style, SkString **font_families, int count)
SKWASM_EXPORT void strutStyle_setHeight(skia::textlayout::StrutStyle *style, SkScalar height)
SKWASM_EXPORT void strutStyle_setFontSize(skia::textlayout::StrutStyle *style, SkScalar font_size)
SKWASM_EXPORT skia::textlayout::StrutStyle * strutStyle_create()
SKWASM_EXPORT void strutStyle_setLeading(skia::textlayout::StrutStyle *style, SkScalar leading)
SKWASM_EXPORT void strutStyle_setHalfLeading(skia::textlayout::StrutStyle *style, bool half_leading)
Scalar font_size