This repository has been archived by the owner on Nov 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Lucchetto <[email protected]>
- Loading branch information
Showing
7 changed files
with
124 additions
and
99 deletions.
There are no files selected for viewing
213 changes: 114 additions & 99 deletions
213
app/src/main/java/com/zhenxiang/superimage/ui/theme/Type.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,109 +1,124 @@ | ||
package com.zhenxiang.superimage.ui.theme | ||
|
||
import androidx.compose.material3.Typography | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.text.font.Font | ||
import androidx.compose.ui.text.font.FontFamily | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.sp | ||
import com.zhenxiang.superimage.R | ||
|
||
private val CrimsonText = FontFamily( | ||
Font(R.font.crimson_text_regular), | ||
Font(R.font.crimson_text_semibold, FontWeight.W600), | ||
Font(R.font.crimson_text_bold, FontWeight.Bold) | ||
) | ||
|
||
val Typography = Typography( | ||
displayMedium = TextStyle( | ||
fontWeight = FontWeight.Normal, | ||
fontFamily = CrimsonText, | ||
fontSize = 42.sp, | ||
lineHeight = 48.sp, | ||
letterSpacing = 0.sp | ||
), | ||
headlineLarge = TextStyle( | ||
fontWeight = FontWeight.SemiBold, | ||
fontFamily = CrimsonText, | ||
fontSize = 32.sp, | ||
lineHeight = 40.sp, | ||
letterSpacing = 0.sp | ||
), | ||
headlineMedium = TextStyle( | ||
fontWeight = FontWeight.SemiBold, | ||
fontFamily = CrimsonText, | ||
fontSize = 28.sp, | ||
lineHeight = 36.sp, | ||
letterSpacing = 0.sp | ||
), | ||
headlineSmall = TextStyle( | ||
fontWeight = FontWeight.Normal, | ||
fontFamily = CrimsonText, | ||
fontSize = 22.sp, | ||
lineHeight = 30.sp, | ||
letterSpacing = 0.sp | ||
), | ||
titleLarge = TextStyle( | ||
fontWeight = FontWeight.SemiBold, | ||
fontFamily = CrimsonText, | ||
fontSize = 22.sp, | ||
lineHeight = 28.sp, | ||
letterSpacing = 0.sp | ||
), | ||
titleMedium = TextStyle( | ||
fontWeight = FontWeight.SemiBold, | ||
fontFamily = CrimsonText, | ||
fontSize = 16.sp, | ||
lineHeight = 24.sp, | ||
letterSpacing = 0.15.sp | ||
), | ||
titleSmall = TextStyle( | ||
fontWeight = FontWeight.Bold, | ||
fontFamily = CrimsonText, | ||
fontSize = 14.sp, | ||
lineHeight = 20.sp, | ||
letterSpacing = 0.1.sp | ||
), | ||
bodyLarge = TextStyle( | ||
fontWeight = FontWeight.Normal, | ||
fontFamily = CrimsonText, | ||
fontSize = 16.sp, | ||
lineHeight = 24.sp, | ||
letterSpacing = 0.15.sp | ||
), | ||
bodyMedium = TextStyle( | ||
fontWeight = FontWeight.Normal, | ||
fontFamily = CrimsonText, | ||
fontSize = 14.sp, | ||
lineHeight = 20.sp, | ||
letterSpacing = 0.5.sp | ||
), | ||
bodySmall = TextStyle( | ||
fontWeight = FontWeight.Normal, | ||
fontFamily = CrimsonText, | ||
fontSize = 12.sp, | ||
lineHeight = 16.sp, | ||
letterSpacing = 0.15.sp | ||
), | ||
labelLarge = TextStyle( | ||
fontWeight = FontWeight.Normal, | ||
fontFamily = CrimsonText, | ||
fontSize = 18.sp, | ||
lineHeight = 24.sp, | ||
letterSpacing = 0.1.sp | ||
), | ||
labelMedium = TextStyle( | ||
fontWeight = FontWeight.SemiBold, | ||
fontFamily = CrimsonText, | ||
fontSize = 12.sp, | ||
lineHeight = 16.sp, | ||
letterSpacing = 0.5.sp | ||
), | ||
labelSmall = TextStyle( | ||
fontWeight = FontWeight.SemiBold, | ||
fontFamily = CrimsonText, | ||
fontSize = 11.sp, | ||
lineHeight = 16.sp, | ||
letterSpacing = 0.5.sp | ||
) | ||
) | ||
val Typography: Typography | ||
@Composable get() { | ||
val fontFamily = stringResource(R.string.font_family).let { | ||
when (it) { | ||
"source" -> FontFamily( | ||
Font(R.font.source_serif_pro_regular), | ||
Font(R.font.source_serif_pro_semibold, FontWeight.W600), | ||
Font(R.font.source_serif_pro_bold, FontWeight.Bold) | ||
) | ||
"crimson" -> FontFamily( | ||
Font(R.font.crimson_text_regular), | ||
Font(R.font.crimson_text_semibold, FontWeight.W600), | ||
Font(R.font.crimson_text_bold, FontWeight.Bold) | ||
) | ||
else -> throw IllegalStateException("Invalid font family for locale") | ||
} | ||
} | ||
|
||
return Typography( | ||
displayMedium = TextStyle( | ||
fontWeight = FontWeight.Normal, | ||
fontFamily = fontFamily, | ||
fontSize = 42.sp, | ||
lineHeight = 48.sp, | ||
letterSpacing = 0.sp | ||
), | ||
headlineLarge = TextStyle( | ||
fontWeight = FontWeight.SemiBold, | ||
fontFamily = fontFamily, | ||
fontSize = 32.sp, | ||
lineHeight = 40.sp, | ||
letterSpacing = 0.sp | ||
), | ||
headlineMedium = TextStyle( | ||
fontWeight = FontWeight.SemiBold, | ||
fontFamily = fontFamily, | ||
fontSize = 28.sp, | ||
lineHeight = 36.sp, | ||
letterSpacing = 0.sp | ||
), | ||
headlineSmall = TextStyle( | ||
fontWeight = FontWeight.Normal, | ||
fontFamily = fontFamily, | ||
fontSize = 22.sp, | ||
lineHeight = 30.sp, | ||
letterSpacing = 0.sp | ||
), | ||
titleLarge = TextStyle( | ||
fontWeight = FontWeight.SemiBold, | ||
fontFamily = fontFamily, | ||
fontSize = 22.sp, | ||
lineHeight = 28.sp, | ||
letterSpacing = 0.sp | ||
), | ||
titleMedium = TextStyle( | ||
fontWeight = FontWeight.SemiBold, | ||
fontFamily = fontFamily, | ||
fontSize = 16.sp, | ||
lineHeight = 24.sp, | ||
letterSpacing = 0.15.sp | ||
), | ||
titleSmall = TextStyle( | ||
fontWeight = FontWeight.Bold, | ||
fontFamily = fontFamily, | ||
fontSize = 14.sp, | ||
lineHeight = 20.sp, | ||
letterSpacing = 0.1.sp | ||
), | ||
bodyLarge = TextStyle( | ||
fontWeight = FontWeight.Normal, | ||
fontFamily = fontFamily, | ||
fontSize = 16.sp, | ||
lineHeight = 24.sp, | ||
letterSpacing = 0.15.sp | ||
), | ||
bodyMedium = TextStyle( | ||
fontWeight = FontWeight.Normal, | ||
fontFamily = fontFamily, | ||
fontSize = 14.sp, | ||
lineHeight = 20.sp, | ||
letterSpacing = 0.5.sp | ||
), | ||
bodySmall = TextStyle( | ||
fontWeight = FontWeight.Normal, | ||
fontFamily = fontFamily, | ||
fontSize = 12.sp, | ||
lineHeight = 16.sp, | ||
letterSpacing = 0.15.sp | ||
), | ||
labelLarge = TextStyle( | ||
fontWeight = FontWeight.Normal, | ||
fontFamily = fontFamily, | ||
fontSize = 18.sp, | ||
lineHeight = 24.sp, | ||
letterSpacing = 0.1.sp | ||
), | ||
labelMedium = TextStyle( | ||
fontWeight = FontWeight.SemiBold, | ||
fontFamily = fontFamily, | ||
fontSize = 12.sp, | ||
lineHeight = 16.sp, | ||
letterSpacing = 0.5.sp | ||
), | ||
labelSmall = TextStyle( | ||
fontWeight = FontWeight.SemiBold, | ||
fontFamily = fontFamily, | ||
fontSize = 11.sp, | ||
lineHeight = 16.sp, | ||
letterSpacing = 0.5.sp | ||
) | ||
) | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="default_font" translatable="false">crimson</string> | ||
<string name="source_serif_pro_font" translatable="false">source</string> | ||
</resources> |