Use Custom Fonts In Jetpack Compose

Jayant Kumar🇮🇳
2 min readSep 10, 2024
Photo by CHUTTERSNAP on Unsplash

In this article we will see how to use custom fonts in Jetpack Compose.

Add Custom Fonts in Font Folder

Well our first task is to add all the required fonts in the res/font folder.

If the font folder is not exists then create one by right click on res folder → New → folder → Font Folder.

Custom fonts

Here we paste all the required fonts.

Bind Custom fonts with respective Font Weights

open type.kt file and paste the below code there.

val customFont = FontFamily(
Font(R.font.montserrat_regular, weight = FontWeight.Normal),
Font(R.font.montserrat_thin, weight = FontWeight.Thin),
Font(R.font.montserrat_light, weight = FontWeight.Light),
Font(R.font.montserrat_extra_light, weight = FontWeight.ExtraLight),
Font(R.font.montserrat_medium, weight = FontWeight.Medium),
Font(R.font.montserrat_semi_bold, weight = FontWeight.SemiBold),
Font(R.font.montserrat_bold, weight = FontWeight.Bold),
Font(R.font.montserrat_extra_bold, weight = FontWeight.ExtraBold),
Font(R.font.montserrat_black, weight =…

--

--

Jayant Kumar🇮🇳

Hello , My name is Jayant, I am a tech youtuber and software Engineer from India 🇮🇳