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