[#951] Add Archivo font
* [#951] Add Archivo font - Font added - License documentation file updated - This slightly changes the provided font accessibility. Both Inter and Archivo are now available with the `ZcashTheme.typography` API. - Closes #951 * Update license documents
This commit is contained in:
parent
d86212cbda
commit
54e522090a
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2021 Zcash
|
||||
Copyright (c) 2021-2023 Zcash
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
# Third Party Licenses
|
||||
|
||||
The majority of the contents of this Git repository are covered under the [LICENSE](../LICENSE). However certain items, as described below, are under different license.
|
||||
The majority of the contents of this Git repository are covered under the [LICENSE](../LICENSE). However certain
|
||||
items, as described below, are under different license.
|
||||
|
||||
## Electric Coin Company copyrights trademarks
|
||||
## Fonts
|
||||
We use these fonts from Google Fonts:
|
||||
- [Inter](https://fonts.google.com/specimen/Inter) font family
|
||||
- [Archivo](https://fonts.google.com/specimen/Archivo) font family
|
||||
|
||||
|
||||
## Inter Font
|
||||
We use fonts from Inter font family. The fonts are downloaded from [Google Fonts](https://fonts.google.com/specimen/Inter) and are licensed under the [Open Font License](https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL).
|
||||
Both are licensed under the [Open Font License](https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL).
|
||||
|
|
|
@ -45,7 +45,7 @@ fun Chip(
|
|||
) {
|
||||
Text(
|
||||
text = (index.value + 1).toString(),
|
||||
style = ZcashTheme.typography.chipIndex,
|
||||
style = ZcashTheme.extendedTypography.chipIndex,
|
||||
color = ZcashTheme.colors.chipIndex
|
||||
)
|
||||
Text(
|
||||
|
|
|
@ -74,7 +74,7 @@ fun ListItem(
|
|||
) {
|
||||
Text(
|
||||
text = text,
|
||||
style = ZcashTheme.typography.listItem,
|
||||
style = ZcashTheme.extendedTypography.listItem,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
modifier = modifier
|
||||
)
|
||||
|
@ -87,7 +87,7 @@ fun ListHeader(
|
|||
) {
|
||||
Text(
|
||||
text = text,
|
||||
style = ZcashTheme.typography.listItem,
|
||||
style = ZcashTheme.extendedTypography.listItem,
|
||||
color = ZcashTheme.colors.onBackgroundHeader,
|
||||
modifier = modifier
|
||||
)
|
||||
|
@ -124,7 +124,7 @@ fun HeaderWithZecIcon(
|
|||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.amount_with_zec_currency_symbol, amount),
|
||||
style = ZcashTheme.typography.zecBalance,
|
||||
style = ZcashTheme.extendedTypography.zecBalance,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
modifier = modifier
|
||||
)
|
||||
|
|
|
@ -11,6 +11,8 @@ import co.electriccoin.zcash.ui.design.theme.internal.LightColorPalette
|
|||
import co.electriccoin.zcash.ui.design.theme.internal.LightExtendedColorPalette
|
||||
import co.electriccoin.zcash.ui.design.theme.internal.LocalExtendedColors
|
||||
import co.electriccoin.zcash.ui.design.theme.internal.LocalExtendedTypography
|
||||
import co.electriccoin.zcash.ui.design.theme.internal.LocalTypographies
|
||||
import co.electriccoin.zcash.ui.design.theme.internal.PrimaryTypography
|
||||
import co.electriccoin.zcash.ui.design.theme.internal.Typography
|
||||
|
||||
@Composable
|
||||
|
@ -34,7 +36,7 @@ fun ZcashTheme(
|
|||
ProvideDimens {
|
||||
MaterialTheme(
|
||||
colorScheme = baseColors,
|
||||
typography = Typography,
|
||||
typography = PrimaryTypography,
|
||||
content = content
|
||||
)
|
||||
}
|
||||
|
@ -47,7 +49,11 @@ object ZcashTheme {
|
|||
@Composable
|
||||
get() = LocalExtendedColors.current
|
||||
|
||||
val typography: ExtendedTypography
|
||||
val typography: Typography
|
||||
@Composable
|
||||
get() = LocalTypographies.current
|
||||
|
||||
val extendedTypography: ExtendedTypography
|
||||
@Composable
|
||||
get() = LocalExtendedTypography.current
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ private val provider = GoogleFont.Provider(
|
|||
// We use bestEffort here to be able to get the closest font weight, if accidentally use
|
||||
// an unspecified font weight and not the default one.
|
||||
private val InterFont = GoogleFont(name = "Inter", bestEffort = true)
|
||||
private val ArchivoFont = GoogleFont(name = "Archivo", bestEffort = true)
|
||||
|
||||
private val InterFontFamily = FontFamily(
|
||||
Font(googleFont = InterFont, fontProvider = provider, weight = FontWeight.Normal), // W400
|
||||
|
@ -29,6 +30,12 @@ private val InterFontFamily = FontFamily(
|
|||
Font(googleFont = InterFont, fontProvider = provider, weight = FontWeight.SemiBold), // W600
|
||||
Font(googleFont = InterFont, fontProvider = provider, weight = FontWeight.Bold) // W700
|
||||
)
|
||||
private val ArchivoFontFamily = FontFamily(
|
||||
Font(googleFont = ArchivoFont, fontProvider = provider, weight = FontWeight.Normal), // W400
|
||||
Font(googleFont = ArchivoFont, fontProvider = provider, weight = FontWeight.Medium), // W500
|
||||
Font(googleFont = ArchivoFont, fontProvider = provider, weight = FontWeight.SemiBold), // W600
|
||||
Font(googleFont = ArchivoFont, fontProvider = provider, weight = FontWeight.Bold) // W700
|
||||
)
|
||||
|
||||
private val Zboto = FontFamily(
|
||||
Font(R.font.zboto, FontWeight.Normal)
|
||||
|
@ -36,7 +43,7 @@ private val Zboto = FontFamily(
|
|||
|
||||
// If you change this definition of our Typography, don't forget to check if you use only
|
||||
// the defined font weights above, otherwise the closest one will be used.
|
||||
internal val Typography = Typography(
|
||||
internal val PrimaryTypography = Typography(
|
||||
headlineLarge = TextStyle(
|
||||
fontFamily = InterFontFamily,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
|
@ -59,6 +66,35 @@ internal val Typography = Typography(
|
|||
)
|
||||
)
|
||||
|
||||
internal val SecondaryTypography = Typography(
|
||||
headlineLarge = TextStyle(
|
||||
fontFamily = ArchivoFontFamily,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
fontSize = 30.sp
|
||||
),
|
||||
bodyLarge = TextStyle(
|
||||
fontFamily = ArchivoFontFamily,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 16.sp
|
||||
),
|
||||
bodySmall = TextStyle(
|
||||
fontFamily = ArchivoFontFamily,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 16.sp
|
||||
),
|
||||
labelLarge = TextStyle(
|
||||
fontFamily = ArchivoFontFamily,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 16.sp
|
||||
)
|
||||
)
|
||||
|
||||
@Immutable
|
||||
data class Typography(
|
||||
val primary: Typography,
|
||||
val secondary: Typography
|
||||
)
|
||||
|
||||
@Immutable
|
||||
data class ExtendedTypography(
|
||||
val chipIndex: TextStyle,
|
||||
|
@ -66,15 +102,23 @@ data class ExtendedTypography(
|
|||
val zecBalance: TextStyle
|
||||
)
|
||||
|
||||
@Suppress("CompositionLocalAllowlist")
|
||||
val LocalTypographies = staticCompositionLocalOf {
|
||||
Typography(
|
||||
primary = PrimaryTypography,
|
||||
secondary = SecondaryTypography
|
||||
)
|
||||
}
|
||||
|
||||
@Suppress("CompositionLocalAllowlist")
|
||||
val LocalExtendedTypography = staticCompositionLocalOf {
|
||||
ExtendedTypography(
|
||||
chipIndex = Typography.bodyLarge.copy(
|
||||
chipIndex = PrimaryTypography.bodyLarge.copy(
|
||||
fontSize = 10.sp,
|
||||
baselineShift = BaselineShift.Superscript,
|
||||
fontWeight = FontWeight.Bold
|
||||
),
|
||||
listItem = Typography.bodyLarge.copy(
|
||||
listItem = PrimaryTypography.bodyLarge.copy(
|
||||
fontSize = 24.sp
|
||||
),
|
||||
zecBalance = TextStyle(
|
||||
|
|
|
@ -68,7 +68,7 @@ fun ChipDropDown(
|
|||
) {
|
||||
Text(
|
||||
text = (chipIndex.value + 1).toString(),
|
||||
style = ZcashTheme.typography.chipIndex,
|
||||
style = ZcashTheme.extendedTypography.chipIndex,
|
||||
color = ZcashTheme.colors.chipIndex
|
||||
)
|
||||
Spacer(modifier = Modifier.padding(horizontal = 2.dp, vertical = 0.dp))
|
||||
|
|
Loading…
Reference in New Issue