|
17 | 17 | package com.example.compose.jetchat.theme |
18 | 18 |
|
19 | 19 | import androidx.compose.material3.Typography |
| 20 | +import androidx.compose.ui.text.ExperimentalTextApi |
20 | 21 | import androidx.compose.ui.text.TextStyle |
21 | | -import androidx.compose.ui.text.font.Font |
22 | 22 | import androidx.compose.ui.text.font.FontFamily |
23 | 23 | import androidx.compose.ui.text.font.FontWeight |
| 24 | +import androidx.compose.ui.text.googlefonts.Font |
| 25 | +import androidx.compose.ui.text.googlefonts.GoogleFont |
24 | 26 | import androidx.compose.ui.unit.sp |
25 | 27 | import com.example.compose.jetchat.R |
26 | 28 |
|
27 | | -private val MontserratFontFamily = FontFamily( |
28 | | - Font(R.font.montserrat_regular), |
29 | | - Font(R.font.montserrat_light, FontWeight.Light), |
30 | | - Font(R.font.montserrat_medium, FontWeight.Medium), |
31 | | - Font(R.font.montserrat_semibold, FontWeight.SemiBold) |
| 29 | +@OptIn(ExperimentalTextApi::class) |
| 30 | +val provider = GoogleFont.Provider( |
| 31 | + providerAuthority = "com.google.android.gms.fonts", |
| 32 | + providerPackage = "com.google.android.gms", |
| 33 | + certificates = R.array.com_google_android_gms_fonts_certs |
32 | 34 | ) |
33 | 35 |
|
34 | | -private val KarlaFontFamily = FontFamily( |
35 | | - Font(R.font.karla_regular), |
36 | | - Font(R.font.karla_bold, FontWeight.Bold) |
| 36 | +@OptIn(ExperimentalTextApi::class) |
| 37 | +val MontserratFont = GoogleFont("Montserrat") |
| 38 | + |
| 39 | +@OptIn(ExperimentalTextApi::class) |
| 40 | +val KarlaFont = GoogleFont("Karla") |
| 41 | + |
| 42 | +@OptIn(ExperimentalTextApi::class) |
| 43 | +val MontserratFontFamily = FontFamily( |
| 44 | + Font(googleFont = MontserratFont, fontProvider = provider), |
| 45 | + androidx.compose.ui.text.font.Font(R.font.montserrat_regular), |
| 46 | + Font(googleFont = MontserratFont, fontProvider = provider, weight = FontWeight.Light), |
| 47 | + androidx.compose.ui.text.font.Font(R.font.montserrat_light, weight = FontWeight.Light), |
| 48 | + Font(googleFont = MontserratFont, fontProvider = provider, weight = FontWeight.Medium), |
| 49 | + androidx.compose.ui.text.font.Font(R.font.montserrat_medium, weight = FontWeight.Medium), |
| 50 | + Font(googleFont = MontserratFont, fontProvider = provider, weight = FontWeight.SemiBold), |
| 51 | + androidx.compose.ui.text.font.Font(R.font.montserrat_semibold, weight = FontWeight.SemiBold), |
| 52 | +) |
| 53 | + |
| 54 | +@OptIn(ExperimentalTextApi::class) |
| 55 | +val KarlaFontFamily = FontFamily( |
| 56 | + Font(googleFont = KarlaFont, fontProvider = provider), |
| 57 | + androidx.compose.ui.text.font.Font(R.font.karla_regular), |
| 58 | + Font(googleFont = KarlaFont, fontProvider = provider, weight = FontWeight.Bold), |
| 59 | + androidx.compose.ui.text.font.Font(R.font.karla_bold, weight = FontWeight.Bold), |
37 | 60 | ) |
38 | 61 |
|
39 | 62 | val JetchatTypography = Typography( |
|
0 commit comments