Hey <@U010Q6P7AQ5>, Can we get a non suspending `F...
# doodle
c
Hey @Nick, Can we get a non suspending
FontLoader
that takes in a loaded
Font
but can change the
size
weight
style
and returns null if the op can't be done.
n
The reason for doing this is the framework tries to guarantee that you never have a
Font
that can’t be rendered when you use it. That eliminates a class of render jank from apps by default. But it comes at a cost since you need to preload Fonts or use async logic that only renders when your font loads. That said, I have been thinking about whether I can assume any loaded font would work at any arbitrary size. That would make it easier to work with fonts if so. I know that not all font faces support all weights or styles, so a synchronous method to get a variant like that couldn’t work. The reason i say it can’t work synchronous is that the browser APIs for validating fonts are all async. So Doodle wouldn’t be able to synchronously check if your requested variant were renderable. Which violates the consistency principle above. I’ll keep thinking about this though since I’d love to have an easier to use API here as well, while keeping the guarantees.
c
Understood.