Guilherme Delgado
02/16/2024, 7:36 PM@Composable
expect fun platformFont(resourceId: String, weight: FontWeight, style: FontStyle): Font
androidMain:
private val idCache = mutableMapOf<String, Int>()
@Composable
actual fun platformFont(resourceId: String, weight: FontWeight, style: FontStyle): Font {
val context = LocalContext.current
val id = idCache.getOrPut(resourceId) {
context.resources.getIdentifier(resourceId, "fonts", context.packageName)
}
return Font(resId = id, weight = weight, style = style)
}
desktopMain:
@Composable
actual fun platformFont(resourceId: String, weight: FontWeight, style: FontStyle): Font =
androidx.compose.ui.text.platform.Font("font/${resourceId}.ttf", weight, style)
I can make it work with the above setup (even for iOS), but I’ve no clue how to do it for wasm 😞 any help? Thanks!Konstantin Tskhovrebov
02/16/2024, 7:38 PMGuilherme Delgado
02/16/2024, 7:40 PMGuilherme Delgado
02/17/2024, 2:05 PM<vector xmlns:android="<http://schemas.android.com/apk/res/android>" <<<<<<<<<
android:width="38dp"
android:height="46dp"
android:viewportWidth="38"
android:viewportHeight="46">
to be accepted in commonMain?Guilherme Delgado
02/17/2024, 2:13 PMGuilherme Delgado
02/17/2024, 2:13 PMGuilherme Delgado
02/17/2024, 2:18 PMGuilherme Delgado
02/19/2024, 12:19 PM