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.95k stars 1.16k forks source link

SpanStyle(baselineShift = BaselineShift(1f)) doesn't work #1109

Open igordmn opened 3 years ago

igordmn commented 3 years ago

Compose 1.0.0-alpha3, Windows 10

import androidx.compose.material.Text
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.style.BaselineShift
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.window.singleWindowApplication

fun main() = singleWindowApplication {
    Text(
        buildAnnotatedString {
            append("Line0\n")
            append("Line1\n")
            withStyle(SpanStyle(baselineShift = BaselineShift(1f))) {
                append("Line2\n")
            }
            append("Line3\n")
            append("Line4\n")
        }
    )
}

Android: image

Desktop: image

igordmn commented 2 years ago

Here we add support for BaselineShift. It works with this:

import androidx.compose.material.Text
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.style.BaselineShift
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.window.singleWindowApplication

fun main() = singleWindowApplication {
    Text(
        buildAnnotatedString {
            append("Line0\n")
            append("Line1")
            withStyle(SpanStyle(baselineShift = BaselineShift(1f))) {
                append("Line2\n")
            }
            append("Line3\n")
            append("Line4\n")
        }
    )
}

But still doesn't work with the example from the issue.

VeselovAlex commented 2 years ago

Reported to Skia, see #12722

okushnikov commented 3 weeks ago

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