• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
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_MODULES_TEXGINE_SRC_FONT_STYLES_H
17 #define ROSEN_MODULES_TEXGINE_SRC_FONT_STYLES_H
18 
19 #include <texgine/typography_types.h>
20 
21 #include "texgine_font_style.h"
22 
23 namespace OHOS {
24 namespace Rosen {
25 namespace TextEngine {
26 class FontStyles {
27 public:
28     enum class Weight {
29         INVISIBLE = 0,
30         THIN = 1,
31         EXTRALIGHT = 2,
32         LIGHT = 3,
33         NORMAL = 4,
34         MEDIUM = 5,
35         SEMIBOLD = 6,
36         BOLD = 7,
37         EXTRABOLD = 8,
38         BLACK = 9,
39         EXTRABLACK = 10,
40         MAX,
41     };
42 
43     enum class Width {
44         ULTRACONDENSED = 0,
45         EXTRACONDENSED = 1,
46         CONDENSED = 2,
47         SEMICONDENSED = 3,
48         NORMAL = 4,
49         SEMIEXPANDED = 5,
50         EXPANDED = 6,
51         EXTRAEXPENDED = 7,
52         ULTRAEXPANDED = 8,
53         MAX,
54     };
55 
56     enum class Slant {
57         UPRIGHT = 0,
58         ITALIC = 1,
59         OBLIQUE = 2,
60         MAX,
61     };
62 
63     FontStyles() = default;
64     FontStyles(FontWeight weight, FontStyle style);
65     FontStyles(Weight weight, Width width, Slant slant);
66 
67     TexgineFontStyle ToTexgineFontStyle() const;
68 
69     bool operator==(const FontStyles &rhs) const;
70     bool operator!=(const FontStyles &rhs) const;
71     bool operator<(const FontStyles& rhs) const;
72 
73 private:
74     Weight weight_ = Weight::NORMAL;
75     Width width_ = Width::NORMAL;
76     Slant slant_ = Slant::UPRIGHT;
77 };
78 } // namespace TextEngine
79 } // namespace Rosen
80 } // namespace OHOS
81 
82 #endif // ROSEN_MODULES_TEXGINE_SRC_FONT_STYLES_H
83