https://kotlinlang.org logo
d

deviant

09/02/2022, 9:37 AM
hey guys, i have issue with unicode symbols in web compose (wasm): is it possible to load some modern font?
a

agrosner

09/02/2022, 11:03 AM
You can have webpack bundle font resources and then you can require them and load them as any other url into a font object
d

deviant

09/02/2022, 1:11 PM
doesn't work. also setting typefaces via MaterialTheme does nothing on web platform
a

agrosner

09/02/2022, 3:19 PM
ill pull up an example
d

deviant

09/02/2022, 3:21 PM
i managed it with platform specific typeface loader
Copy code
actual suspend fun platformTypography(): Typography = Typography(
    defaultFontFamily = FontFamily(
        Font(
            identity = "roboto",
            data = loadBytesFromPath("Roboto-Regular.ttf")
        )
    )
)
would be awesome if this code works in common module so we don't have repeat it on all platforms
a

agrosner

09/02/2022, 3:23 PM
oh nice. yeah its probably a WIP
what contructor is that
Font
in ?
e

ESchouten

09/07/2022, 6:53 PM
@deviant if you don't mind, what's the current state of Compose Web canvas in your experience?
d

deviant

09/08/2022, 7:24 AM
@ESchouten well it works 🙂 i have some performance issue in firefox. but chrome works fine. you can check this project https://github.com/mykola-dev/Tetris
j

jim

09/09/2022, 4:34 PM
@deviant Lack of keyboard support is the first thing I noticed, but 🤯 this is amazing!
4 Views