• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_TEXT_TEXT_STYLES_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_TEXT_TEXT_STYLES_H
18 
19 #include "core/components/common/properties/text_style.h"
20 #include "core/components/text/text_theme.h"
21 #include "core/components_ng/property/property.h"
22 
23 namespace OHOS::Ace::NG {
24 
25 struct FontStyle {
26     ACE_DEFINE_PROPERTY_GROUP_ITEM(FontSize, Dimension);
27     ACE_DEFINE_PROPERTY_GROUP_ITEM(TextColor, Color);
28     ACE_DEFINE_PROPERTY_GROUP_ITEM(ItalicFontStyle, Ace::FontStyle);
29     ACE_DEFINE_PROPERTY_GROUP_ITEM(FontWeight, FontWeight);
30     ACE_DEFINE_PROPERTY_GROUP_ITEM(FontFamily, std::vector<std::string>);
31     ACE_DEFINE_PROPERTY_GROUP_ITEM(TextDecoration, TextDecoration);
32     ACE_DEFINE_PROPERTY_GROUP_ITEM(TextDecorationColor, Color);
33     ACE_DEFINE_PROPERTY_GROUP_ITEM(TextCase, TextCase);
34     ACE_DEFINE_PROPERTY_GROUP_ITEM(AdaptMinFontSize, Dimension);
35     ACE_DEFINE_PROPERTY_GROUP_ITEM(AdaptMaxFontSize, Dimension);
36     ACE_DEFINE_PROPERTY_GROUP_ITEM(LetterSpacing, Dimension);
37     ACE_DEFINE_PROPERTY_GROUP_ITEM(ForegroundColor, Color);
38 };
39 
40 struct TextLineStyle {
41     ACE_DEFINE_PROPERTY_GROUP_ITEM(LineHeight, Dimension);
42     ACE_DEFINE_PROPERTY_GROUP_ITEM(TextBaseline, TextBaseline);
43     ACE_DEFINE_PROPERTY_GROUP_ITEM(BaselineOffset, Dimension);
44     ACE_DEFINE_PROPERTY_GROUP_ITEM(TextOverflow, TextOverflow);
45     ACE_DEFINE_PROPERTY_GROUP_ITEM(TextAlign, TextAlign);
46     ACE_DEFINE_PROPERTY_GROUP_ITEM(MaxLength, uint32_t);
47     ACE_DEFINE_PROPERTY_GROUP_ITEM(MaxLines, uint32_t);
48 };
49 
50 TextStyle CreateTextStyleUsingTheme(const std::unique_ptr<FontStyle>& fontStyle,
51     const std::unique_ptr<TextLineStyle>& textLineStyle, const RefPtr<TextTheme>& textTheme);
52 } // namespace OHOS::Ace::NG
53 
54 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_TEXT_TEXT_STYLES_H
55