moko-resources icon indicating copy to clipboard operation
moko-resources copied to clipboard

@ReadOnlyComposable on fontFamilyResource and FontResource.asFont

Open jmadaminov opened this issue 1 year ago • 0 comments

Is it possible to make these functions have @ReadOnlyComposable also? To make it a bit more efficient

// @ReadOnlyComposable <-- is it possible?
@Composable
fun fontFamilyResource(fontResource: FontResource): FontFamily {
    return fontResource.asFont()
        ?.let { FontFamily(it) }
        ?: FontFamily.Default
}

// @ReadOnlyComposable <-- is it possible?
@Composable
expect fun FontResource.asFont(
    weight: FontWeight = FontWeight.Normal,
    style: FontStyle = FontStyle.Normal,
): Font?

jmadaminov avatar Jan 25 '24 12:01 jmadaminov