JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.99k stars 1.16k forks source link

Annotated string with gradient spans is not rendered on skiko targets #4897

Closed gleb-skobinsky closed 3 months ago

gleb-skobinsky commented 4 months ago

Describe the bug Gradients in annotated strings are not rendered.

Affected platforms

Versions

To Reproduce Steps to reproduce the behavior:

  1. Run this code snippet:
    @Composable
    @Preview
    fun App() {
    MaterialTheme {
        val annotatedString = remember {
            buildAnnotatedString {
                pushStyle(SpanStyle(fontSize = 56.sp))
                withStyle(SpanStyle(brush = textGradient)) {
                    append("Text with gradient")
                }
                withStyle(SpanStyle(color = Color.Black)) {
                    append(", and without")
                }
            }
        }
        Box(Modifier.fillMaxSize(), Alignment.Center) {
            Text(annotatedString, textAlign = TextAlign.Center, lineHeight = 64.sp)
        }
    }
    }
  2. On android the output is ok: photo_2024-05-30 12 02 57

On iOS the span with gradient is not visible: photo_2024-05-30 12 02 55

Expected behavior Same rendering for all platforms.

You can reproduce the issue with this repo: https://github.com/gleb-skobinsky/BugReport

elijah-semyonov commented 4 months ago

Reproduced on all skiko-based targets indeed.

okushnikov commented 1 month ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.