Flutter Engine
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 
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;
34  return result;
35 }
36 
38  return max_lines == std::numeric_limits<size_t>::max();
39 };
40 
42  return !ellipsis.empty();
43 }
44 
49  } else if (text_align == TextAlign::end) {
52  } else {
53  return text_align;
54  }
55 }
56 
57 } // namespace txt
bool has_height_override
Definition: text_style.h:54
TextStyle GetTextStyle() const
double height
Definition: text_style.h:53
FontStyle font_style
Definition: text_style.h:45
bool ellipsized() const
std::string locale
Definition: text_style.h:55
double font_size
Definition: text_style.h:50
std::u16string ellipsis
TextAlign effective_align() const
std::string font_family
std::vector< std::string > font_families
Definition: text_style.h:49
FontWeight font_weight
Definition: text_style.h:44
bool unlimited_lines() const
TextDirection text_direction