Member-only story

How to Implement Custom Fonts using Downloadable Google Fonts?

A step-by-step guide to implementing custom font by downloading (instead of manually copying) Google fonts and using them in your Jetpack Compose app.

Vincent Tsen
2 min readMar 31, 2023

Roboto is the default font used by Material 3. However, we often want to change it for our app. Instead of manually copying the font asset, you can now download the Google font asynchronously and use them in your Jetpack Compose app.

This is a quick guide to changing the default Roboto font to Arvo font.

1. Add the dependency

build.gradle.kts example

dependencies {
/*...*/
implementation("androidx.compose.ui:ui-text-google-fonts:1.3.2")
}

2. Copy font_cert.xml

Copy the font-cert.xml to your res\values folder.

3. Create Font Provider

In Type.kt, create the GoogleFont.Provider:

@OptIn(ExperimentalTextApi::class)
private val fontProvider = GoogleFont.Provider(
providerAuthority = "com.google.android.gms.fonts",
providerPackage = "com.google.android.gms",
certificates =…

--

--

No responses yet