1 /*
2  * Copyright (C) 2022 The Android Open Source Project
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 package com.android.compose.theme.typography
18 
19 import androidx.compose.ui.text.TextStyle
20 
21 internal class TypographyTokens(typeScaleTokens: TypeScaleTokens) {
22     val bodyLarge =
23         TextStyle(
24             fontFamily = typeScaleTokens.bodyLargeFont,
25             fontWeight = typeScaleTokens.bodyLargeWeight,
26             fontSize = typeScaleTokens.bodyLargeSize,
27             lineHeight = typeScaleTokens.bodyLargeLineHeight,
28             letterSpacing = typeScaleTokens.bodyLargeTracking,
29         )
30     val bodyMedium =
31         TextStyle(
32             fontFamily = typeScaleTokens.bodyMediumFont,
33             fontWeight = typeScaleTokens.bodyMediumWeight,
34             fontSize = typeScaleTokens.bodyMediumSize,
35             lineHeight = typeScaleTokens.bodyMediumLineHeight,
36             letterSpacing = typeScaleTokens.bodyMediumTracking,
37         )
38     val bodySmall =
39         TextStyle(
40             fontFamily = typeScaleTokens.bodySmallFont,
41             fontWeight = typeScaleTokens.bodySmallWeight,
42             fontSize = typeScaleTokens.bodySmallSize,
43             lineHeight = typeScaleTokens.bodySmallLineHeight,
44             letterSpacing = typeScaleTokens.bodySmallTracking,
45         )
46     val displayLarge =
47         TextStyle(
48             fontFamily = typeScaleTokens.displayLargeFont,
49             fontWeight = typeScaleTokens.displayLargeWeight,
50             fontSize = typeScaleTokens.displayLargeSize,
51             lineHeight = typeScaleTokens.displayLargeLineHeight,
52             letterSpacing = typeScaleTokens.displayLargeTracking,
53         )
54     val displayMedium =
55         TextStyle(
56             fontFamily = typeScaleTokens.displayMediumFont,
57             fontWeight = typeScaleTokens.displayMediumWeight,
58             fontSize = typeScaleTokens.displayMediumSize,
59             lineHeight = typeScaleTokens.displayMediumLineHeight,
60             letterSpacing = typeScaleTokens.displayMediumTracking,
61         )
62     val displaySmall =
63         TextStyle(
64             fontFamily = typeScaleTokens.displaySmallFont,
65             fontWeight = typeScaleTokens.displaySmallWeight,
66             fontSize = typeScaleTokens.displaySmallSize,
67             lineHeight = typeScaleTokens.displaySmallLineHeight,
68             letterSpacing = typeScaleTokens.displaySmallTracking,
69         )
70     val headlineLarge =
71         TextStyle(
72             fontFamily = typeScaleTokens.headlineLargeFont,
73             fontWeight = typeScaleTokens.headlineLargeWeight,
74             fontSize = typeScaleTokens.headlineLargeSize,
75             lineHeight = typeScaleTokens.headlineLargeLineHeight,
76             letterSpacing = typeScaleTokens.headlineLargeTracking,
77         )
78     val headlineMedium =
79         TextStyle(
80             fontFamily = typeScaleTokens.headlineMediumFont,
81             fontWeight = typeScaleTokens.headlineMediumWeight,
82             fontSize = typeScaleTokens.headlineMediumSize,
83             lineHeight = typeScaleTokens.headlineMediumLineHeight,
84             letterSpacing = typeScaleTokens.headlineMediumTracking,
85         )
86     val headlineSmall =
87         TextStyle(
88             fontFamily = typeScaleTokens.headlineSmallFont,
89             fontWeight = typeScaleTokens.headlineSmallWeight,
90             fontSize = typeScaleTokens.headlineSmallSize,
91             lineHeight = typeScaleTokens.headlineSmallLineHeight,
92             letterSpacing = typeScaleTokens.headlineSmallTracking,
93         )
94     val labelLarge =
95         TextStyle(
96             fontFamily = typeScaleTokens.labelLargeFont,
97             fontWeight = typeScaleTokens.labelLargeWeight,
98             fontSize = typeScaleTokens.labelLargeSize,
99             lineHeight = typeScaleTokens.labelLargeLineHeight,
100             letterSpacing = typeScaleTokens.labelLargeTracking,
101         )
102     val labelMedium =
103         TextStyle(
104             fontFamily = typeScaleTokens.labelMediumFont,
105             fontWeight = typeScaleTokens.labelMediumWeight,
106             fontSize = typeScaleTokens.labelMediumSize,
107             lineHeight = typeScaleTokens.labelMediumLineHeight,
108             letterSpacing = typeScaleTokens.labelMediumTracking,
109         )
110     val labelSmall =
111         TextStyle(
112             fontFamily = typeScaleTokens.labelSmallFont,
113             fontWeight = typeScaleTokens.labelSmallWeight,
114             fontSize = typeScaleTokens.labelSmallSize,
115             lineHeight = typeScaleTokens.labelSmallLineHeight,
116             letterSpacing = typeScaleTokens.labelSmallTracking,
117         )
118     val titleLarge =
119         TextStyle(
120             fontFamily = typeScaleTokens.titleLargeFont,
121             fontWeight = typeScaleTokens.titleLargeWeight,
122             fontSize = typeScaleTokens.titleLargeSize,
123             lineHeight = typeScaleTokens.titleLargeLineHeight,
124             letterSpacing = typeScaleTokens.titleLargeTracking,
125         )
126     val titleMedium =
127         TextStyle(
128             fontFamily = typeScaleTokens.titleMediumFont,
129             fontWeight = typeScaleTokens.titleMediumWeight,
130             fontSize = typeScaleTokens.titleMediumSize,
131             lineHeight = typeScaleTokens.titleMediumLineHeight,
132             letterSpacing = typeScaleTokens.titleMediumTracking,
133         )
134     val titleSmall =
135         TextStyle(
136             fontFamily = typeScaleTokens.titleSmallFont,
137             fontWeight = typeScaleTokens.titleSmallWeight,
138             fontSize = typeScaleTokens.titleSmallSize,
139             lineHeight = typeScaleTokens.titleSmallLineHeight,
140             letterSpacing = typeScaleTokens.titleSmallTracking,
141         )
142 }
143