Is there a way for compose to read fonts from asse...
# compose
z
Is there a way for compose to read fonts from assets and not from res\fonts?
c
Of course, there is a function for this:
Copy code
package androidx.compose.ui.text.font

fun Font(
    assetManager: AssetManager,
    path: String,
    weight: FontWeight = FontWeight.Normal,
    style: FontStyle = FontStyle.Normal
): Font = AndroidAssetFont(assetManager, path, weight, style)
z
This is great! thank you. It does require using
@ExperimentalTextApi
Do you feel this might be a problem?
c
I you are fine with later changing the code if this API breaks, you can use these. At our company, we are always use these experimental APIs. It is your choice to opt-in or not. 🙂
🤘 1