diff --git a/GITHUB_CHANGELOG.md b/GITHUB_CHANGELOG.md index 20eeb55da9..a2d4178527 100644 --- a/GITHUB_CHANGELOG.md +++ b/GITHUB_CHANGELOG.md @@ -35,6 +35,7 @@ Compatibility list: * [Lawnchair] Swipe to dismiss announcement perform haptic on successful dismiss * [Lawnchair] Remove Inter v3 fonts from Lawnchair entirely (to reduce apk size) * [Lawnchair] Add Google Sans variable font as fallback to Google Sans Flex (to support the most of the world languages, yes that increases sizes) +* [Launcher] Google Sans variable normal style #### Fixes * [Launcher3] Widget preview crash for no reason at all on compatible Android version diff --git a/lawnchair/src/app/lawnchair/ui/theme/GoogleSansFlex.kt b/lawnchair/src/app/lawnchair/ui/theme/GoogleSansFlex.kt index 8c2bce3cfe..98afad2d46 100644 --- a/lawnchair/src/app/lawnchair/ui/theme/GoogleSansFlex.kt +++ b/lawnchair/src/app/lawnchair/ui/theme/GoogleSansFlex.kt @@ -11,6 +11,88 @@ import com.android.launcher3.R // Thanks https://gitlab.com/nongthaihoang/google-sans-prime/-/commit/0f7b9d29f6ffe5005d22d81af264a86106f2450d object GoogleSansFlex { object Display { + object Normal { + /** + * Google Sans Flex Normal (400), Normal + * + * Fallback to Google Sans for unsupported glyphs + **/ + @OptIn(ExperimentalTextApi::class) + val Large = FontFamily( + Font( + R.font.googlesansflex_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Normal.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(57.sp), + ), + ), + Font( + R.font.googlesans_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Normal.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(57.sp), + ), + ), + ) + + /** + * Google Sans Flex Normal (400), Normal + * + * Fallback to Google Sans for unsupported glyphs + **/ + @OptIn(ExperimentalTextApi::class) + val Medium = FontFamily( + Font( + R.font.googlesansflex_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Normal.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(45.sp), + ), + ), + Font( + R.font.googlesans_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Normal.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(45.sp), + ), + ), + ) + + /** + * Google Sans Flex Normal (400), Normal + * + * Fallback to Google Sans for unsupported glyphs + **/ + @OptIn(ExperimentalTextApi::class) + val Small = FontFamily( + Font( + R.font.googlesansflex_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Normal.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(36.sp), + ), + ), + Font( + R.font.googlesans_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Normal.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(36.sp), + ), + ), + ) + } object Emphasized { /** * Google Sans Flex Medium (500), Emphasized @@ -98,6 +180,88 @@ object GoogleSansFlex { } } object Headline { + object Normal { + /** + * Google Sans Flex Normal (400), Normal + * + * Fallback to Google Sans for unsupported glyphs + **/ + @OptIn(ExperimentalTextApi::class) + val Large = FontFamily( + Font( + R.font.googlesansflex_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Normal.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(32.sp), + ), + ), + Font( + R.font.googlesans_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Normal.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(32.sp), + ), + ), + ) + + /** + * Google Sans Flex Normal (400), Normal + * + * Fallback to Google Sans for unsupported glyphs + **/ + @OptIn(ExperimentalTextApi::class) + val Medium = FontFamily( + Font( + R.font.googlesansflex_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Normal.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(28.sp), + ), + ), + Font( + R.font.googlesans_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Normal.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(28.sp), + ), + ), + ) + + /** + * Google Sans Flex Normal (400), Normal + * + * Fallback to Google Sans for unsupported glyphs + **/ + @OptIn(ExperimentalTextApi::class) + val Small = FontFamily( + Font( + R.font.googlesansflex_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Normal.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(24.sp), + ), + ), + Font( + R.font.googlesans_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Normal.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(24.sp), + ), + ), + ) + } object Emphasized { /** * Google Sans Flex Medium (500), Emphasized @@ -185,6 +349,87 @@ object GoogleSansFlex { } } object Title { + object Normal { + /** + * Google Sans Flex Medium (500), Normal + * + * Fallback to Google Sans for unsupported glyphs + **/ + @OptIn(ExperimentalTextApi::class) + val Large = FontFamily( + Font( + R.font.googlesansflex_variable, + variationSettings = FontVariation.Settings( + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(22.sp), + ), + ), + Font( + R.font.googlesans_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Medium.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(22.sp), + ), + ), + ) + + /** + * Google Sans Flex Medium (500), Normal + * + * Fallback to Google Sans for unsupported glyphs + **/ + @OptIn(ExperimentalTextApi::class) + val Medium = FontFamily( + Font( + R.font.googlesansflex_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Medium.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(16.sp), + ), + ), + Font( + R.font.googlesans_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Medium.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(16.sp), + ), + ), + ) + + /** + * Google Sans Flex Medium (500), Normal + * + * Fallback to Google Sans for unsupported glyphs + **/ + @OptIn(ExperimentalTextApi::class) + val Small = FontFamily( + Font( + R.font.googlesansflex_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Medium.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(14.sp), + ), + ), + Font( + R.font.googlesans_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Medium.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(14.sp), + ), + ), + ) + } object Emphasized { /** * Google Sans Flex Medium (500), Emphasized @@ -272,6 +517,88 @@ object GoogleSansFlex { } } object Body { + object Normal { + /** + * Google Sans Flex Normal (400), Normal + * + * Fallback to Google Sans for unsupported glyphs + **/ + @OptIn(ExperimentalTextApi::class) + val Large = FontFamily( + Font( + R.font.googlesansflex_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Normal.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(16.sp), + ), + ), + Font( + R.font.googlesans_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Normal.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(16.sp), + ), + ), + ) + + /** + * Google Sans Flex Normal (400), Normal + * + * Fallback to Google Sans for unsupported glyphs + **/ + @OptIn(ExperimentalTextApi::class) + val Medium = FontFamily( + Font( + R.font.googlesansflex_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Normal.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(14.sp), + ), + ), + Font( + R.font.googlesans_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Normal.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(14.sp), + ), + ), + ) + + /** + * Google Sans Flex Normal (400), Normal + * + * Fallback to Google Sans for unsupported glyphs + **/ + @OptIn(ExperimentalTextApi::class) + val Small = FontFamily( + Font( + R.font.googlesansflex_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Normal.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(12.sp), + ), + ), + Font( + R.font.googlesans_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Normal.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(12.sp), + ), + ), + ) + } object Emphasized { /** * Google Sans Flex Medium (500), Emphasized @@ -359,6 +686,88 @@ object GoogleSansFlex { } } object Label { + object Normal { + /** + * Google Sans Flex Medium (500), Normal + * + * Fallback to Google Sans for unsupported glyphs + **/ + @OptIn(ExperimentalTextApi::class) + val Small = FontFamily( + Font( + R.font.googlesansflex_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Medium.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(11.sp), + ), + ), + Font( + R.font.googlesans_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Medium.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(11.sp), + ), + ), + ) + + /** + * Google Sans Flex Medium (500), Normal + * + * Fallback to Google Sans for unsupported glyphs + **/ + @OptIn(ExperimentalTextApi::class) + val Medium = FontFamily( + Font( + R.font.googlesansflex_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Medium.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(12.sp), + ), + ), + Font( + R.font.googlesans_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Medium.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(12.sp), + ), + ), + ) + + /** + * Google Sans Flex Medium (500), Normal + * + * Fallback to Google Sans for unsupported glyphs + **/ + @OptIn(ExperimentalTextApi::class) + val Large = FontFamily( + Font( + R.font.googlesansflex_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Medium.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(14.sp), + ), + ), + Font( + R.font.googlesans_variable, + variationSettings = FontVariation.Settings( + FontVariation.weight(FontWeight.Medium.weight), + FontVariation.width(100f), + FontVariation.grade(0), + FontVariation.opticalSizing(14.sp), + ), + ), + ) + } object Emphasized { /** * Google Sans Flex Semibold (600), Emphasized diff --git a/lawnchair/src/app/lawnchair/ui/theme/Type.kt b/lawnchair/src/app/lawnchair/ui/theme/Type.kt index 34ba83fc20..d0a9b86353 100644 --- a/lawnchair/src/app/lawnchair/ui/theme/Type.kt +++ b/lawnchair/src/app/lawnchair/ui/theme/Type.kt @@ -24,21 +24,21 @@ private val base = Typography() @OptIn(ExperimentalMaterial3ExpressiveApi::class) val Typography = Typography( - displayLarge = base.displayLarge.copy(fontFamily = GoogleSansFlex.Display.Emphasized.Large), - displayMedium = base.displayMedium.copy(fontFamily = GoogleSansFlex.Display.Emphasized.Medium), - displaySmall = base.displaySmall.copy(fontFamily = GoogleSansFlex.Display.Emphasized.Large), - headlineLarge = base.headlineLarge.copy(fontFamily = GoogleSansFlex.Headline.Emphasized.Large), - headlineMedium = base.headlineMedium.copy(fontFamily = GoogleSansFlex.Headline.Emphasized.Medium), - headlineSmall = base.headlineSmall.copy(fontFamily = GoogleSansFlex.Headline.Emphasized.Large), - titleLarge = base.titleLarge.copy(fontFamily = GoogleSansFlex.Title.Emphasized.Large), - titleMedium = base.titleMedium.copy(fontFamily = GoogleSansFlex.Title.Emphasized.Medium), - titleSmall = base.titleSmall.copy(fontFamily = GoogleSansFlex.Title.Emphasized.Small), - bodyLarge = base.bodyLarge.copy(fontFamily = GoogleSansFlex.Body.Emphasized.Large, letterSpacing = 0.sp), - bodyMedium = base.bodyMedium.copy(fontFamily = GoogleSansFlex.Body.Emphasized.Medium, letterSpacing = 0.1.sp), - bodySmall = base.bodySmall.copy(fontFamily = GoogleSansFlex.Body.Emphasized.Small), - labelLarge = base.labelLarge.copy(fontFamily = GoogleSansFlex.Label.Emphasized.Large), - labelMedium = base.labelMedium.copy(fontFamily = GoogleSansFlex.Label.Emphasized.Medium), - labelSmall = base.labelSmall.copy(fontFamily = GoogleSansFlex.Label.Emphasized.Small), + displayLarge = base.displayLarge.copy(fontFamily = GoogleSansFlex.Display.Normal.Large), + displayMedium = base.displayMedium.copy(fontFamily = GoogleSansFlex.Display.Normal.Medium), + displaySmall = base.displaySmall.copy(fontFamily = GoogleSansFlex.Display.Normal.Large), + headlineLarge = base.headlineLarge.copy(fontFamily = GoogleSansFlex.Headline.Normal.Large), + headlineMedium = base.headlineMedium.copy(fontFamily = GoogleSansFlex.Headline.Normal.Medium), + headlineSmall = base.headlineSmall.copy(fontFamily = GoogleSansFlex.Headline.Normal.Large), + titleLarge = base.titleLarge.copy(fontFamily = GoogleSansFlex.Title.Normal.Large), + titleMedium = base.titleMedium.copy(fontFamily = GoogleSansFlex.Title.Normal.Medium), + titleSmall = base.titleSmall.copy(fontFamily = GoogleSansFlex.Title.Normal.Small), + bodyLarge = base.bodyLarge.copy(fontFamily = GoogleSansFlex.Body.Normal.Large, letterSpacing = 0.sp), + bodyMedium = base.bodyMedium.copy(fontFamily = GoogleSansFlex.Body.Normal.Medium, letterSpacing = 0.1.sp), + bodySmall = base.bodySmall.copy(fontFamily = GoogleSansFlex.Body.Normal.Small), + labelLarge = base.labelLarge.copy(fontFamily = GoogleSansFlex.Label.Normal.Large), + labelMedium = base.labelMedium.copy(fontFamily = GoogleSansFlex.Label.Normal.Medium), + labelSmall = base.labelSmall.copy(fontFamily = GoogleSansFlex.Label.Normal.Small), displayLargeEmphasized = base.displayLargeEmphasized.copy(fontFamily = GoogleSansFlex.Display.Emphasized.Large), displayMediumEmphasized = base.displayMediumEmphasized.copy(fontFamily = GoogleSansFlex.Display.Emphasized.Medium), displaySmallEmphasized = base.displaySmallEmphasized.copy(fontFamily = GoogleSansFlex.Display.Emphasized.Large),