Slide 31
Slide 31 text
p
r
ivate val cache: MutableMap = mutableMapOf()
@OptIn(Expe
r
imentalResou
r
ceApi
: :
class)
@Composable
actual fun font(name: St
r
ing,
r
es: St
r
ing, weight: FontWeight, style:
FontStyle)
:
Font {
r
etu
r
n cache.getO
r
Put(
r
es) {
val byteA
r r
ay =
r
unBlocking {
r
esou
r
ce("font/$
r
es.ttf").
r
eadBytes()
}
and
r
oidx.compose.ui.text.platfo
r
m.Font(
r
es, byteA
r r
ay,
weight, style)
}
}