• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
<lambda>null2  * Copyright (C) 2025 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.systemui.animation
18 
19 data class AxisDefinition(
20     val tag: String,
21     val minValue: Float,
22     val defaultValue: Float,
23     val maxValue: Float,
24     val animationStep: Float,
25 )
26 
27 object GSFAxes {
28     @JvmStatic
29     val WEIGHT =
30         AxisDefinition(
31             tag = "wght",
32             minValue = 1f,
33             defaultValue = 400f,
34             maxValue = 1000f,
35             animationStep = 10f,
36         )
37 
38     val WIDTH =
39         AxisDefinition(
40             tag = "wdth",
41             minValue = 25f,
42             defaultValue = 100f,
43             maxValue = 151f,
44             animationStep = 1f,
45         )
46 
47     val SLANT =
48         AxisDefinition(
49             tag = "slnt",
50             minValue = 0f,
51             defaultValue = 0f,
52             maxValue = -10f,
53             animationStep = 0.1f,
54         )
55 
56     val ROUND =
57         AxisDefinition(
58             tag = "ROND",
59             minValue = 0f,
60             defaultValue = 0f,
61             maxValue = 100f,
62             animationStep = 1f,
63         )
64 
65     val GRADE =
66         AxisDefinition(
67             tag = "GRAD",
68             minValue = 0f,
69             defaultValue = 0f,
70             maxValue = 100f,
71             animationStep = 1f,
72         )
73 
74     val OPTICAL_SIZE =
75         AxisDefinition(
76             tag = "opsz",
77             minValue = 6f,
78             defaultValue = 18f,
79             maxValue = 144f,
80             animationStep = 1f,
81         )
82 
83     // Not a GSF Axis, but present for FontInterpolator compatibility
84     val ITALIC =
85         AxisDefinition(
86             tag = "ITAL",
87             minValue = 0f,
88             defaultValue = 0f,
89             maxValue = 1f,
90             animationStep = 0.1f,
91         )
92 
93     private val AXIS_MAP =
94         listOf(WEIGHT, WIDTH, SLANT, ROUND, GRADE, OPTICAL_SIZE, ITALIC)
95             .map { def -> def.tag.lowercase() to def }
96             .toMap()
97 
98     fun getAxis(axis: String): AxisDefinition? = AXIS_MAP[axis.lowercase()]
99 }
100