• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 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 */
15class ArkTypographyWeights {
16    public static thin = 100;
17    public static ultralight = 200;
18    public static light = 300;
19    public static regular = 400;
20    public static medium = 500;
21    public static semibold = 600;
22    public static bold = 700;
23    public static heavy = 800;
24    public static black = 900;
25}
26
27class ArkSystemTypography implements Typography {
28    // Display
29    displayLarge: TypographyStyle;
30    displayMiddle: TypographyStyle;
31    displaySmall: TypographyStyle;
32
33    // Title
34    titleLarge: TypographyStyle;
35    titleMiddle: TypographyStyle;
36    titleSmall: TypographyStyle;
37
38    // Subtitle
39    subtitleLarge: TypographyStyle;
40    subtitleMiddle: TypographyStyle;
41    subtitleSmall: TypographyStyle;
42
43    // Body
44    bodyLarge: TypographyStyle;
45    bodyMiddle: TypographyStyle;
46    bodySmall: TypographyStyle;
47
48    // Caption
49    captionLarge: TypographyStyle;
50    captionMiddle: TypographyStyle;
51    captionSmall: TypographyStyle;
52
53    constructor() {
54        // Display
55        this.displayLarge = {
56            weight: ArkTypographyWeights.light,
57            size: ArkResourcesHelper.$r('sys.float.Display_L')
58        };
59        this.displayMiddle = {
60            weight: ArkTypographyWeights.light,
61            size: ArkResourcesHelper.$r('sys.float.Display_M')
62        };
63        this.displaySmall = {
64            weight: ArkTypographyWeights.light,
65            size: ArkResourcesHelper.$r('sys.float.Display_S')
66        };
67
68        // Title
69        this.titleLarge = {
70            weight: ArkTypographyWeights.bold,
71            size: ArkResourcesHelper.$r('sys.float.Title_L')
72        };
73        this.titleMiddle = {
74            weight: ArkTypographyWeights.bold,
75            size: ArkResourcesHelper.$r('sys.float.Title_M')
76        };
77        this.titleSmall = {
78            weight: ArkTypographyWeights.bold,
79            size: ArkResourcesHelper.$r('sys.float.Title_S')
80        };
81
82        // Subtitle
83        this.subtitleLarge = {
84            weight: ArkTypographyWeights.medium,
85            size: ArkResourcesHelper.$r('sys.float.Subtitle_L')
86        };
87        this.subtitleMiddle = {
88            weight: ArkTypographyWeights.medium,
89            size: ArkResourcesHelper.$r('sys.float.Subtitle_M')
90        };
91        this.subtitleSmall = {
92            weight: ArkTypographyWeights.medium,
93            size: ArkResourcesHelper.$r('sys.float.Subtitle_S')
94        };
95
96        // Body
97        this.bodyLarge = {
98            weight: ArkTypographyWeights.medium,
99            size: ArkResourcesHelper.$r('sys.float.Body_L')
100        };
101        this.bodyMiddle = {
102            weight: ArkTypographyWeights.regular,
103            size: ArkResourcesHelper.$r('sys.float.Body_M')
104        };
105        this.bodySmall = {
106            weight: ArkTypographyWeights.regular,
107            size: ArkResourcesHelper.$r('sys.float.Body_S')
108        };
109
110        // Caption
111        this.captionLarge = {
112            weight: ArkTypographyWeights.medium,
113            size: ArkResourcesHelper.$r('sys.float.Caption_L')
114        };
115        this.captionMiddle = {
116            weight: ArkTypographyWeights.medium,
117            size: ArkResourcesHelper.$r('sys.float.Caption_M')
118        };
119        this.captionSmall = {
120            weight: ArkTypographyWeights.medium,
121            size: ArkResourcesHelper.$r('sys.float.Caption_S')
122        };
123    }
124}