mirror of
https://github.com/Ashinch/ReadYou.git
synced 2025-01-31 19:45:18 +01:00
Remove Google Sans fonts
This commit is contained in:
parent
0e643465dc
commit
d05bfdaa9e
@ -9,11 +9,9 @@ import me.ash.reader.R
|
||||
import me.ash.reader.ui.ext.DataStoreKeys
|
||||
import me.ash.reader.ui.ext.dataStore
|
||||
import me.ash.reader.ui.ext.put
|
||||
import me.ash.reader.ui.theme.googleSansDisplay
|
||||
import me.ash.reader.ui.theme.googleSansText
|
||||
|
||||
sealed class ReadingFontsPreference(val value: Int) : Preference() {
|
||||
object GoogleSans : ReadingFontsPreference(0)
|
||||
object System : ReadingFontsPreference(0)
|
||||
object Serif : ReadingFontsPreference(1)
|
||||
object SansSerif : ReadingFontsPreference(2)
|
||||
object Monospace : ReadingFontsPreference(3)
|
||||
@ -28,7 +26,7 @@ sealed class ReadingFontsPreference(val value: Int) : Preference() {
|
||||
|
||||
fun toDesc(context: Context): String =
|
||||
when (this) {
|
||||
GoogleSans -> "Google Sans"
|
||||
System -> context.getString(R.string.system_default)
|
||||
Serif -> "Serif"
|
||||
SansSerif -> "Sans-Serif"
|
||||
Monospace -> "Monospace"
|
||||
@ -36,9 +34,9 @@ sealed class ReadingFontsPreference(val value: Int) : Preference() {
|
||||
External -> context.getString(R.string.external_fonts)
|
||||
}
|
||||
|
||||
fun asFontFamily(isDisplay: Boolean = false): FontFamily =
|
||||
fun asFontFamily(): FontFamily =
|
||||
when (this) {
|
||||
GoogleSans -> if (isDisplay) googleSansDisplay else googleSansText
|
||||
System -> FontFamily.Default
|
||||
Serif -> FontFamily.Serif
|
||||
SansSerif -> FontFamily.SansSerif
|
||||
Monospace -> FontFamily.Monospace
|
||||
@ -48,12 +46,12 @@ sealed class ReadingFontsPreference(val value: Int) : Preference() {
|
||||
|
||||
companion object {
|
||||
|
||||
val default = GoogleSans
|
||||
val values = listOf(GoogleSans, Serif, SansSerif, Monospace, Cursive, External)
|
||||
val default = System
|
||||
val values = listOf(System, Serif, SansSerif, Monospace, Cursive, External)
|
||||
|
||||
fun fromPreferences(preferences: Preferences): ReadingFontsPreference =
|
||||
when (preferences[DataStoreKeys.ReadingFonts.key]) {
|
||||
0 -> GoogleSans
|
||||
0 -> System
|
||||
1 -> Serif
|
||||
2 -> SansSerif
|
||||
3 -> Monospace
|
||||
|
@ -139,6 +139,7 @@ fun WebView(
|
||||
@Stable
|
||||
fun argbToCssColor(argb: Int): String = String.format("#%06X", 0xFFFFFF and argb)
|
||||
|
||||
// TODO: Google sans is deprecated
|
||||
@Stable
|
||||
fun getStyle(argb: Int): String = """
|
||||
<html><head><style>
|
||||
|
@ -92,7 +92,7 @@ fun bodyStyle(): TextStyle =
|
||||
@ReadOnlyComposable
|
||||
fun h1Style(): TextStyle =
|
||||
TextStyle(
|
||||
fontFamily = LocalReadingFonts.current.asFontFamily(isDisplay = true),
|
||||
fontFamily = LocalReadingFonts.current.asFontFamily(),
|
||||
fontWeight = if (LocalReadingSubheadBold.current.value) FontWeight.SemiBold else FontWeight.Normal,
|
||||
fontSize = 28.sp,
|
||||
letterSpacing = 0.sp,
|
||||
@ -105,7 +105,7 @@ fun h1Style(): TextStyle =
|
||||
@ReadOnlyComposable
|
||||
fun h2Style(): TextStyle =
|
||||
TextStyle(
|
||||
fontFamily = LocalReadingFonts.current.asFontFamily(isDisplay = true),
|
||||
fontFamily = LocalReadingFonts.current.asFontFamily(),
|
||||
fontWeight = if (LocalReadingSubheadBold.current.value) FontWeight.SemiBold else FontWeight.Normal,
|
||||
fontSize = 28.sp,
|
||||
letterSpacing = 0.sp,
|
||||
@ -118,7 +118,7 @@ fun h2Style(): TextStyle =
|
||||
@ReadOnlyComposable
|
||||
fun h3Style(): TextStyle =
|
||||
TextStyle(
|
||||
fontFamily = LocalReadingFonts.current.asFontFamily(isDisplay = true),
|
||||
fontFamily = LocalReadingFonts.current.asFontFamily(),
|
||||
fontWeight = if (LocalReadingSubheadBold.current.value) FontWeight.SemiBold else FontWeight.Normal,
|
||||
fontSize = 19.sp,
|
||||
letterSpacing = 0.sp,
|
||||
@ -131,7 +131,7 @@ fun h3Style(): TextStyle =
|
||||
@ReadOnlyComposable
|
||||
fun h4Style(): TextStyle =
|
||||
TextStyle(
|
||||
fontFamily = LocalReadingFonts.current.asFontFamily(isDisplay = true),
|
||||
fontFamily = LocalReadingFonts.current.asFontFamily(),
|
||||
fontWeight = if (LocalReadingSubheadBold.current.value) FontWeight.SemiBold else FontWeight.Normal,
|
||||
fontSize = 17.sp,
|
||||
letterSpacing = 0.sp,
|
||||
@ -144,7 +144,7 @@ fun h4Style(): TextStyle =
|
||||
@ReadOnlyComposable
|
||||
fun h5Style(): TextStyle =
|
||||
TextStyle(
|
||||
fontFamily = LocalReadingFonts.current.asFontFamily(isDisplay = true),
|
||||
fontFamily = LocalReadingFonts.current.asFontFamily(),
|
||||
fontWeight = if (LocalReadingSubheadBold.current.value) FontWeight.SemiBold else FontWeight.Normal,
|
||||
fontSize = 17.sp,
|
||||
letterSpacing = 0.sp,
|
||||
@ -157,7 +157,7 @@ fun h5Style(): TextStyle =
|
||||
@ReadOnlyComposable
|
||||
fun h6Style(): TextStyle =
|
||||
TextStyle(
|
||||
fontFamily = LocalReadingFonts.current.asFontFamily(isDisplay = true),
|
||||
fontFamily = LocalReadingFonts.current.asFontFamily(),
|
||||
fontWeight = if (LocalReadingSubheadBold.current.value) FontWeight.SemiBold else FontWeight.Normal,
|
||||
fontSize = 17.sp,
|
||||
letterSpacing = 0.sp,
|
||||
|
@ -64,7 +64,7 @@ fun Metadata(
|
||||
text = if (titleUpperCase.value) titleUpperCaseString else title,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
style = MaterialTheme.typography.headlineLarge.copy(
|
||||
fontFamily = LocalReadingFonts.current.asFontFamily(isDisplay = true),
|
||||
fontFamily = LocalReadingFonts.current.asFontFamily(),
|
||||
fontWeight = if (titleBold.value) FontWeight.SemiBold else FontWeight.Normal,
|
||||
),
|
||||
textAlign = titleAlign.toTextAlign(),
|
||||
|
@ -152,7 +152,7 @@ fun ColorAndStylePage(
|
||||
}
|
||||
SettingItem(
|
||||
title = stringResource(R.string.basic_fonts),
|
||||
desc = "Google Sans",
|
||||
desc = stringResource(R.string.system_default),
|
||||
enable = false,
|
||||
onClick = {},
|
||||
) {}
|
||||
|
@ -48,7 +48,7 @@ fun TitleAndTextPreview() {
|
||||
text = if (titleUpperCase.value) titleUpperCaseString else stringResource(id = R.string.title),
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
style = MaterialTheme.typography.headlineLarge.copy(
|
||||
fontFamily = LocalReadingFonts.current.asFontFamily(isDisplay = true),
|
||||
fontFamily = LocalReadingFonts.current.asFontFamily(),
|
||||
fontWeight = if (titleBold.value) FontWeight.SemiBold else FontWeight.Normal,
|
||||
),
|
||||
textAlign = titleAlign.toTextAlign(),
|
||||
|
@ -9,158 +9,92 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.sp
|
||||
import me.ash.reader.R
|
||||
|
||||
val googleSansDisplay: FontFamily = FontFamily(
|
||||
Font(
|
||||
resId = R.font.google_sans_display_regular,
|
||||
weight = FontWeight.Normal,
|
||||
style = FontStyle.Normal
|
||||
),
|
||||
Font(
|
||||
resId = R.font.google_sans_display_medium,
|
||||
weight = FontWeight.Medium,
|
||||
style = FontStyle.Normal
|
||||
),
|
||||
Font(
|
||||
resId = R.font.google_sans_display_bold,
|
||||
weight = FontWeight.Bold,
|
||||
style = FontStyle.Normal
|
||||
),
|
||||
)
|
||||
|
||||
val googleSansText: FontFamily = FontFamily(
|
||||
Font(
|
||||
resId = R.font.google_sans_text_regular,
|
||||
weight = FontWeight.Normal,
|
||||
style = FontStyle.Normal
|
||||
),
|
||||
Font(
|
||||
resId = R.font.google_sans_text_italic,
|
||||
weight = FontWeight.Normal,
|
||||
style = FontStyle.Italic
|
||||
),
|
||||
Font(
|
||||
resId = R.font.google_sans_text_medium,
|
||||
weight = FontWeight.Medium,
|
||||
style = FontStyle.Normal
|
||||
),
|
||||
Font(
|
||||
resId = R.font.google_sans_text_medium_italic,
|
||||
weight = FontWeight.Medium,
|
||||
style = FontStyle.Italic
|
||||
),
|
||||
Font(
|
||||
resId = R.font.google_sans_text_bold,
|
||||
weight = FontWeight.Bold,
|
||||
style = FontStyle.Normal
|
||||
),
|
||||
Font(
|
||||
resId = R.font.google_sans_text_bold_italic,
|
||||
weight = FontWeight.Bold,
|
||||
style = FontStyle.Italic
|
||||
),
|
||||
)
|
||||
|
||||
val AppTypography = Typography(
|
||||
displayLarge = TextStyle(
|
||||
fontFamily = googleSansDisplay,
|
||||
fontWeight = FontWeight.W400,
|
||||
fontSize = 57.sp,
|
||||
lineHeight = 64.sp,
|
||||
letterSpacing = -0.25.sp,
|
||||
),
|
||||
displayMedium = TextStyle(
|
||||
fontFamily = googleSansDisplay,
|
||||
fontWeight = FontWeight.W400,
|
||||
fontSize = 45.sp,
|
||||
lineHeight = 52.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
displaySmall = TextStyle(
|
||||
fontFamily = googleSansDisplay,
|
||||
fontWeight = FontWeight.W400,
|
||||
fontSize = 36.sp,
|
||||
lineHeight = 44.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
headlineLarge = TextStyle(
|
||||
fontFamily = googleSansDisplay,
|
||||
fontWeight = FontWeight.W400,
|
||||
fontSize = 32.sp,
|
||||
lineHeight = 40.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
headlineMedium = TextStyle(
|
||||
fontFamily = googleSansDisplay,
|
||||
fontWeight = FontWeight.W400,
|
||||
fontSize = 28.sp,
|
||||
lineHeight = 36.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
headlineSmall = TextStyle(
|
||||
fontFamily = googleSansDisplay,
|
||||
fontWeight = FontWeight.W400,
|
||||
fontSize = 24.sp,
|
||||
lineHeight = 32.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
titleLarge = TextStyle(
|
||||
fontFamily = googleSansDisplay,
|
||||
fontWeight = FontWeight.W400,
|
||||
fontSize = 22.sp,
|
||||
lineHeight = 28.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
titleMedium = TextStyle(
|
||||
fontFamily = googleSansText,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 16.sp,
|
||||
lineHeight = 24.sp,
|
||||
letterSpacing = 0.1.sp,
|
||||
),
|
||||
titleSmall = TextStyle(
|
||||
fontFamily = googleSansText,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 14.sp,
|
||||
lineHeight = 20.sp,
|
||||
letterSpacing = 0.1.sp,
|
||||
),
|
||||
labelLarge = TextStyle(
|
||||
fontFamily = googleSansText,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 14.sp,
|
||||
lineHeight = 20.sp,
|
||||
letterSpacing = 0.1.sp,
|
||||
),
|
||||
bodyLarge = TextStyle(
|
||||
fontFamily = googleSansText,
|
||||
fontWeight = FontWeight.W400,
|
||||
fontSize = 16.sp,
|
||||
lineHeight = 24.sp,
|
||||
letterSpacing = 0.5.sp,
|
||||
),
|
||||
bodyMedium = TextStyle(
|
||||
fontFamily = googleSansText,
|
||||
fontWeight = FontWeight.W400,
|
||||
fontSize = 14.sp,
|
||||
lineHeight = 20.sp,
|
||||
letterSpacing = 0.25.sp,
|
||||
),
|
||||
bodySmall = TextStyle(
|
||||
fontFamily = googleSansText,
|
||||
fontWeight = FontWeight.W400,
|
||||
fontSize = 12.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.4.sp,
|
||||
),
|
||||
labelMedium = TextStyle(
|
||||
fontFamily = googleSansText,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 12.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.5.sp,
|
||||
),
|
||||
labelSmall = TextStyle(
|
||||
fontFamily = googleSansText,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 11.sp,
|
||||
lineHeight = 16.sp,
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -351,4 +351,5 @@
|
||||
<string name="username">用户名</string>
|
||||
<string name="password">密码</string>
|
||||
<string name="connection">连接信息</string>
|
||||
</resources>
|
||||
<string name="system_default">系统默认</string>
|
||||
</resources>
|
||||
|
@ -390,4 +390,5 @@
|
||||
<string name="username">Username</string>
|
||||
<string name="password">Password</string>
|
||||
<string name="connection">Connection</string>
|
||||
<string name="system_default">System Default</string>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user