Cherrio LLC
03/29/2023, 9:14 PMFontLoader
that takes in a loaded Font
but can change the size
weight
style
and returns null if the op can't be done.Nick
03/30/2023, 2:00 AMFont
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.Cherrio LLC
03/30/2023, 9:17 AM