I am loading the same app on desktop and web, but ...
# compose
a
I am loading the same app on desktop and web, but the fonts look different. the web one is somehow thinner(?). can't tell exactly what it is Any idea what's going on and how to resolve this? text style in 🧵
😯 2
Copy code
val Inter = FontFamily(Font(Res.font.Inter))

val ContentColor = Color.Black.copy(0.8f)

val Body = TextStyle.Default.copy(
        color = ContentColor,
        fontSize = 14.sp,
        fontWeight = FontWeight.Normal,
        fontFamily = Inter
    )
Compose Web is JS Target
a
thanks for linking the chat. it seems very related. havent checked the code but this message by Zach seems to imply that compose is not doing the rendering but the underlying platform. https://kotlinlang.slack.com/archives/C01F2HV7868/p1728149192848169?thread_ts=1728089469.717169&cid=C01F2HV7868
but still. if this is the case, the text rendered in web should match how it is rendered on html, no?
m
This may not even be a Compose issue. I am seeing exactly the same behaviour when I compare a PDF file to an SVG file generated from it and both viewed in the same browser. The files look identically except that the SVG text renders a tiny bit thinner.
a
Something i found interesting. First line is html text. Bottom is compose web. It's as if 'normal' weight on compose web is the same as light (html)
a
the text rendered in web should match how it is rendered on html, no?
If you use Compose HTML, then yes. If you use Compose for Web (WASM), the rendering is done by Skia instead of the browser, so no.
a
I'll open an issue and see how it goes
the rendering is done by Skia instead of the browser, so no.
@Albert Chang if the rendering is done by skia, I understand that it should be rendered the same on desktop and web (even if it is different than on HTML). is that wrong?
a
Wrong. There are many factors that can affect the rendering result. Even Compose for desktop itself doesn't render the same on all platforms, and browser is yet another different platform.
👍 1