Flutter Engine
The Flutter Engine
third_party
txt
src
txt
paragraph_style.cc
Go to the documentation of this file.
1
/*
2
* Copyright 2017 Google, Inc.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#include "
paragraph_style.h
"
18
19
#include <vector>
20
21
namespace
txt
{
22
23
TextStyle
ParagraphStyle::GetTextStyle
()
const
{
24
TextStyle
result
;
25
result
.font_weight =
font_weight
;
26
result
.font_style =
font_style
;
27
result
.font_families = std::vector<std::string>({
font_family
});
28
if
(
font_size
>= 0) {
29
result
.font_size =
font_size
;
30
}
31
result
.locale =
locale
;
32
result
.height =
height
;
33
result
.has_height_override =
has_height_override
;
34
return
result
;
35
}
36
37
bool
ParagraphStyle::unlimited_lines
()
const
{
38
return
max_lines
==
std::numeric_limits<size_t>::max
();
39
};
40
41
bool
ParagraphStyle::ellipsized
()
const
{
42
return
!
ellipsis
.empty();
43
}
44
45
TextAlign
ParagraphStyle::effective_align
()
const
{
46
if
(
text_align
==
TextAlign::start
) {
47
return
(
text_direction
==
TextDirection::ltr
) ?
TextAlign::left
48
:
TextAlign::right
;
49
}
else
if
(
text_align
==
TextAlign::end
) {
50
return
(
text_direction
==
TextDirection::ltr
) ?
TextAlign::right
51
:
TextAlign::left
;
52
}
else
{
53
return
text_align
;
54
}
55
}
56
57
}
// namespace txt
txt::ParagraphStyle::font_size
double font_size
Definition:
paragraph_style.h:71
txt::ParagraphStyle::ellipsized
bool ellipsized() const
Definition:
paragraph_style.cc:41
txt::ParagraphStyle::locale
std::string locale
Definition:
paragraph_style.h:96
txt::ParagraphStyle::font_family
std::string font_family
Definition:
paragraph_style.h:70
txt::ParagraphStyle::ellipsis
std::u16string ellipsis
Definition:
paragraph_style.h:95
txt::ParagraphStyle::height
double height
Definition:
paragraph_style.h:72
txt::ParagraphStyle::font_weight
FontWeight font_weight
Definition:
paragraph_style.h:68
txt::ParagraphStyle::max_lines
size_t max_lines
Definition:
paragraph_style.h:94
txt::ParagraphStyle::text_direction
TextDirection text_direction
Definition:
paragraph_style.h:93
txt::ParagraphStyle::has_height_override
bool has_height_override
Definition:
paragraph_style.h:73
txt::ParagraphStyle::GetTextStyle
TextStyle GetTextStyle() const
Definition:
paragraph_style.cc:23
txt::ParagraphStyle::effective_align
TextAlign effective_align() const
Definition:
paragraph_style.cc:45
txt::ParagraphStyle::unlimited_lines
bool unlimited_lines() const
Definition:
paragraph_style.cc:37
txt::ParagraphStyle::font_style
FontStyle font_style
Definition:
paragraph_style.h:69
txt::ParagraphStyle::text_align
TextAlign text_align
Definition:
paragraph_style.h:92
txt::TextStyle
Definition:
text_style.h:36
result
GAsyncResult * result
Definition:
fl_text_input_plugin.cc:106
max
static float max(float r, float g, float b)
Definition:
hsl.cpp:49
txt
Definition:
paragraph_builder_skia.cc:27
txt::TextAlign
TextAlign
Definition:
paragraph_style.h:29
txt::TextAlign::right
@ right
txt::TextAlign::end
@ end
txt::TextAlign::left
@ left
txt::TextAlign::start
@ start
txt::TextDirection::ltr
@ ltr
paragraph_style.h
Generated on Sun Jun 23 2024 21:56:53 for Flutter Engine by
1.9.4