• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef ROSEN_TEXT_EXPORT_ROSEN_TEXT_TYPOGRAPHY_TYPES_H
17 #define ROSEN_TEXT_EXPORT_ROSEN_TEXT_TYPOGRAPHY_TYPES_H
18 
19 #include <cstddef>
20 
21 namespace OHOS {
22 namespace Rosen {
23 enum class TextDirection {
24     RTL,
25     LTR,
26 };
27 
28 enum class TextAlign {
29     LEFT,
30     RIGHT,
31     CENTER,
32     JUSTIFY,
33     START,
34     END,
35 };
36 
37 enum class BreakStrategy {
38     GREEDY = 0,
39     HIGH_QUALITY = 1,
40     BALANCED = 2
41 };
42 
43 enum class WordBreakType {
44     NORMAL = 0,
45     BREAK_ALL = 1,
46     BREAK_WORD = 2,
47     BREAK_HYPHEN = 3
48 };
49 
50 enum TextDecoration {
51     NONE = 0x0,
52     UNDERLINE = 0x1,
53     OVERLINE = 0x2,
54     LINE_THROUGH = 0x4,
55 };
56 
57 enum class TextDecorationStyle {
58     SOLID,
59     DOUBLE,
60     DOTTED,
61     DASHED,
62     WAVY,
63 };
64 
65 enum class FontWeight {
66     W100, // thin
67     W200,
68     W300,
69     W400, // normal
70     W500,
71     W600,
72     W700, // bold
73     W800,
74     W900,
75 };
76 
77 enum class FontWidth {
78     ULTRA_CONDENSED = 1,
79     EXTRA_CONDENSED = 2,
80     CONDENSED = 3,
81     SEMI_CONDENSED = 4,
82     NORMAL = 5,
83     SEMI_EXPANDED = 6,
84     EXPANDED = 7,
85     EXTRA_EXPANDED = 8,
86     ULTRA_EXPANDED = 9,
87 };
88 
89 enum class FontStyle {
90     NORMAL,
91     ITALIC,
92     OBLIQUE,
93 };
94 
95 enum class TextBaseline {
96     ALPHABETIC,
97     IDEOGRAPHIC,
98 };
99 
100 enum class EllipsisModal {
101     HEAD = 0,
102     MIDDLE = 1,
103     TAIL = 2,
104 };
105 
106 enum TextHeightBehavior {
107     ALL = 0x0,
108     DISABLE_FIRST_ASCENT = 0x1,
109     DISABLE_LAST_ASCENT = 0x2,
110     DISABLE_ALL = 0x1 | 0x2,
111 };
112 
113 enum StyleType {
114     NONE_ATTRIBUTES,
115     ALL_ATTRIBUTES,
116     FONT,
117     FOREGROUND,
118     BACKGROUND,
119     SHADOW,
120     DECORATIONS,
121     LETTER_SPACING,
122     WORD_SPACING
123 };
124 
125 struct Boundary {
126     size_t leftIndex = 0; // include leftIndex_
127     size_t rightIndex = 0; // not include rightIndex_
128 
BoundaryBoundary129     Boundary(size_t left, size_t right)
130     {
131         leftIndex = left;
132         rightIndex = right;
133     }
134 
135     bool operator ==(const Boundary& rhs) const
136     {
137         return leftIndex == rhs.leftIndex && rightIndex == rhs.rightIndex;
138     }
139 };
140 
141 } // namespace Rosen
142 } // namespace OHOS
143 
144 #endif // ROSEN_TEXT_EXPORT_ROSEN_TEXT_TYPOGRAPHY_TYPES_H
145