How does one load custom fonts on compose web targ...
# compose-web
t
How does one load custom fonts on compose web targeting the canvas? The method has the following signature:
Copy code
fun Font(
    identity: String,
    data: ByteArray,
    weight: FontWeight = FontWeight.Normal,
    style: FontStyle = FontStyle.Normal
): Font = LoadedFont(identity, data, weight, style)
However I’m unsure how to create the the
ByteArray
for the
data
argument. The required
.tff
file is in resources, but I’m not sure what API to use to actually read it in js for the browser.
j
@Tunji Dahunsi did you find a solution to this?
t
I used an ugly work around. I used the desktop API, set a breakpoint, inspected it, grabbed the raw bytes from the IDE and saved that 😅
j
omg. honestly. not a bad idea
ill look into it. thanks!