@@ -2,19 +2,31 @@ package com.getcode.theme
22
33import androidx.compose.material.Typography
44import androidx.compose.runtime.Composable
5+ import androidx.compose.ui.text.ExperimentalTextApi
6+ import androidx.compose.ui.text.PlatformTextStyle
57import androidx.compose.ui.text.TextStyle
68import androidx.compose.ui.text.font.Font
79import androidx.compose.ui.text.font.FontFamily
10+ import androidx.compose.ui.text.font.FontVariation
811import androidx.compose.ui.text.font.FontWeight
912import androidx.compose.ui.text.style.TextAlign
1013import androidx.compose.ui.unit.sp
1114import com.getcode.R
1215
16+ @OptIn(ExperimentalTextApi ::class )
1317private val Avenir = FontFamily (
18+ Font (R .font.avenir_next_regular, FontWeight .Thin ),
19+ Font (R .font.avenir_next_regular, FontWeight .ExtraLight ),
1420 Font (R .font.avenir_next_regular, FontWeight .Light ),
1521 Font (R .font.avenir_next_regular, FontWeight .Normal ),
16- Font (R .font.avenir_next_demi, FontWeight .Medium ),
17- Font (R .font.avenir_next_demi, FontWeight .SemiBold )
22+ Font (R .font.avenir_next_medium, FontWeight .Medium ),
23+ Font (
24+ resId = R .font.avenir_next_demi,
25+ weight = FontWeight .SemiBold ,
26+ ),
27+ Font (R .font.avenir_next_demi, FontWeight .Bold ),
28+ Font (R .font.avenir_next_demi, FontWeight .ExtraBold ),
29+ Font (R .font.avenir_next_demi, FontWeight .Black )
1830)
1931
2032private val RobotoMono = FontFamily (
@@ -65,7 +77,7 @@ internal val typography = Typography(
6577 fontFamily = Avenir ,
6678 fontSize = 20 .sp,
6779 fontWeight = FontWeight .SemiBold ,
68- lineHeight = 26 .sp
80+ lineHeight = 26 .sp,
6981 ),
7082 subtitle2 = TextStyle ( // Screen Title
7183 fontFamily = Avenir ,
@@ -119,4 +131,14 @@ val Typography.displayLarge: TextStyle
119131 @Composable get() = h1.copy(fontSize = 55 .sp)
120132
121133fun TextStyle.withRobotoMono (weight : FontWeight ? = this.fontWeight) = with (RobotoMono , weight)
122- fun TextStyle.with (fontFamily : FontFamily , weight : FontWeight ? = this.fontWeight): TextStyle = copy(fontFamily = fontFamily, fontWeight = weight)
134+ fun TextStyle.with (fontFamily : FontFamily , weight : FontWeight ? = this.fontWeight): TextStyle = copy(fontFamily = fontFamily, fontWeight = weight)
135+
136+ fun ascenderHeight (ascenderHeight : Float ): FontVariation .Setting {
137+ require(ascenderHeight in 649f .. 854f ) { " 'Ascender Height' must be in 649f..854f" }
138+ return FontVariation .Setting (" YTAS" , ascenderHeight)
139+ }
140+
141+ fun counterWidth (counterWidth : Int ): FontVariation .Setting {
142+ require(counterWidth in 323 .. 603 ) { " 'Counter width' must be in 323..603" }
143+ return FontVariation .Setting (" XTRA" , counterWidth.toFloat())
144+ }
0 commit comments