How to implement custom Text Styles using Kotlin and Jetpack Compose

A step by step guide on creating and using custom Jetpack Compose TextStyles using Kotlin in Android Studio. Open Source Github Repository Included.

Oscar de la Hera Gomez
Written by Oscar de la Hera Gomez
First published on 06/09/2023 at 17:42
Last Updated on 06/09/2023 at 18:25
Three flowers that represent Kotlin, Jetpack Compose and Android Studio side by side. Beneath them sits the text “*.”

A step by step guide on creating and using custom Jetpack Compose TextStyles using Kotlin in Android Studio. Open Source Github Repository Included.

SubscribeDownload Open Source Kotlin Starter Project

We recommend that you clone our Open Source Kotlin Starter Project, checking out the main branch and carrying out the steps below. The changes can be found on the tutorial/jetpack-compose/custom-textstyle.

git clone git@github.com:delasign/kotlin-android-starter-project.git

Step One: Add Custom Fonts

A screenshot of Android Studio showing the Type.kt file, with the Robot FontFamily as a Kotlin val.

Add a custom Typeface (Font Family) using the guide below.

How to add a custom font to an Android Studio project

Step Two: Apply TextStyle

A screenshot of Android Studio showing you how to implement a custom Jetpack Compose TextStyle. Sample code below.

Apply a custom TextStyle using code similar to the one below.

Read Android's TextStyle Documentation

Step Three: Test

A screenshot of an Android device showing the custom Jetpack Compose TextStyle.

Run your app to confirm that the TextStyle was applied.

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
SubscribeContact UsVisit our BlogView our ServicesView our Work

Partner with us

We would love to get to know you and see how we can help your organization with its goals and needs.
Let's Talk

Stay Informed

Get occasional updates about our company, research, and product launches.
Subscribe