hi guys i am using fonts with experimental resourc...
# multiplatform
b
hi guys i am using fonts with experimental resource api in my KMP project and i am getting and error for Unresolved Te Reference :Font while i already imported import androidx.compose.ui.text.platform.Font and using it correctly
]
package theme import androidx.compose.material.Typography import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.platform.Font import androidx.compose.ui.unit.sp import kotlinx.coroutines.runBlocking import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.resource @OptIn(ExperimentalResourceApi::_class_) val Montserrat = _FontFamily_( _Font_( identity = "font/mons_black.ttf", weight = FontWeight.Black, data = runBlocking { _resource_("font/mons_black.ttf").readBytes() } ), _Font_( identity = "font/mons_bold.ttf", weight = FontWeight.Bold, data = runBlocking { _resource_("font/mons_bold.ttf").readBytes() } ), _Font_( identity = "font/mins_semibold.ttf", weight = FontWeight.SemiBold, data = runBlocking { _resource_("font/mins_semibold.ttf").readBytes() } ), _Font_( identity = "font/mins_regular.ttf", weight = FontWeight.Normal, data = runBlocking { _resource_("font/mins_regular.ttf").readBytes() } ), _Font_( identity = "font/mons_medium.ttf", weight = FontWeight.Medium, data = runBlocking { _resource_("font/mons_medium.ttf").readBytes() } ) )
If i use expect actual method for fonts its working but this is goven by compose right shouldnt it also work ?
r
imho you have to convert .ttf. to .otf as .ttf format is not yet supported. I've read that somewhere but dunno where
b
okkk @rudolf.hladik thanks for the update let me try and check