diff --git a/app/src/commonMain/composeResources/font/noto_sand_bold_italic.ttf b/app/src/commonMain/composeResources/font/noto_sand_bold_italic.ttf new file mode 100644 index 0000000..5783315 Binary files /dev/null and b/app/src/commonMain/composeResources/font/noto_sand_bold_italic.ttf differ diff --git a/app/src/commonMain/composeResources/font/noto_sans_bold.ttf b/app/src/commonMain/composeResources/font/noto_sans_bold.ttf new file mode 100644 index 0000000..c5588b4 Binary files /dev/null and b/app/src/commonMain/composeResources/font/noto_sans_bold.ttf differ diff --git a/app/src/commonMain/composeResources/font/noto_sans_italic.ttf b/app/src/commonMain/composeResources/font/noto_sans_italic.ttf new file mode 100644 index 0000000..f838ed9 Binary files /dev/null and b/app/src/commonMain/composeResources/font/noto_sans_italic.ttf differ diff --git a/app/src/commonMain/composeResources/font/noto_sans_regular.ttf b/app/src/commonMain/composeResources/font/noto_sans_regular.ttf new file mode 100644 index 0000000..65b29fc Binary files /dev/null and b/app/src/commonMain/composeResources/font/noto_sans_regular.ttf differ diff --git a/app/src/commonMain/kotlin/ui/theme/Typhography.kt b/app/src/commonMain/kotlin/ui/theme/Typhography.kt index eebba0b..55708c1 100644 --- a/app/src/commonMain/kotlin/ui/theme/Typhography.kt +++ b/app/src/commonMain/kotlin/ui/theme/Typhography.kt @@ -24,11 +24,15 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.intl.Locale import oni_seed_browser.app.generated.resources.Res import oni_seed_browser.app.generated.resources.economica_bold import oni_seed_browser.app.generated.resources.economica_bold_italic import oni_seed_browser.app.generated.resources.economica_italic import oni_seed_browser.app.generated.resources.economica_regular +import oni_seed_browser.app.generated.resources.noto_sans_bold +import oni_seed_browser.app.generated.resources.noto_sans_italic +import oni_seed_browser.app.generated.resources.noto_sans_regular import org.jetbrains.compose.resources.Font @Composable @@ -55,11 +59,39 @@ fun EconomicaFontFamily(): FontFamily = FontFamily( ) ) +/** Font containing chinese symbols. */ +@Composable +fun NotoSansFamily(): FontFamily = FontFamily( + Font( + resource = Res.font.noto_sans_regular, + weight = FontWeight.Normal, + style = FontStyle.Normal + ), + Font( + resource = Res.font.noto_sans_bold, + weight = FontWeight.Bold, + style = FontStyle.Normal + ), + Font( + resource = Res.font.noto_sans_italic, + weight = FontWeight.Normal, + style = FontStyle.Italic + ), + Font( + resource = Res.font.noto_sans_bold_italic, + weight = FontWeight.Bold, + style = FontStyle.Italic + ) +) + @Composable fun AppTypography(): Typography = - Typography().defaultFontFamily(EconomicaFontFamily()) + if (Locale.current.language != "zh") + Typography().defaultFontFamily(EconomicaFontFamily()) + else + Typography().defaultFontFamily(NotoSansFamily()) -fun Typography.defaultFontFamily(fontFamily: FontFamily): Typography { +private fun Typography.defaultFontFamily(fontFamily: FontFamily): Typography { return this.copy( displayLarge = this.displayLarge.copy(fontFamily = fontFamily), displayMedium = this.displayMedium.copy(fontFamily = fontFamily),