# compose-web


02/28/2023, 8:21 AM
Hi everyone! I'm using compose web with skiko canvas I want to solve the following some problems. 1. Display Image -> I solved it using the svg to compose plugin. Is there any other general-purpose method? 2. Change Font 3. Change the mouse cursor icon according to the over of the button in the skiko canvas. what should I do?

Oleksandr Karpovich [JB]

02/28/2023, 8:28 AM
1. this could help a bit. 2. Font support is a TODO item. 3. Cursor Icon is rather a TODO item too (if I remember correctly). Although it's possible to add some hacks to make it work: to add Modifier.pointerInput on your button to listen to when the cursor enters and exits it. And then one can change the cursor as needed: = 'wait';


02/28/2023, 8:49 AM
2 is working for me, see
As you can see this is very much just a scratch-pad project so don't take anything as best practice; but the Font Loading concept is at least proven. Most relevant snippet:
Copy code
fun FontTestView(provideFontBytes: suspend () -> ByteArray) {
    var fontBytes by remember { mutableStateOf<ByteArray?>(null) }
    LaunchedEffect(Unit) {
        fontBytes = provideFontBytes()
    fontBytes?.let { bytes ->
        val skTypeface: Typeface = Typeface.makeFromData(Data.makeFromBytes(bytes))
        val typeface = Typeface(skTypeface)
        val fontFamily = FontFamily(typeface)
        Text("Hello, this is a test of font loading", fontFamily = fontFamily, fontSize = 24.sp)
The font is a standard TTF, included in
so that it ends up being copied as a file to the web-server - just hosted as a regular file alongside
Ktor Multiplatform Client for JS is used to load the bytes with an HTTP request.


02/28/2023, 10:10 AM
thank you all!