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

Support text hyphenation #4792

Open brewin opened 4 months ago

brewin commented 4 months ago

Describe the bug Automatic text hyphenation does not work on iOS.

Affected platforms

Versions

To Reproduce

@Composable
fun App() {
    MaterialTheme {
        Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
            Text(
                text = text,
                modifier = Modifier.width(200.dp).background(Color.LightGray).padding(8.dp),
                style = MaterialTheme.typography.bodyMedium.copy(
                    lineBreak = LineBreak.Paragraph,
                    hyphens = Hyphens.Auto
                )
            )
        }
    }
}

expect fun getPlatformName(): String

private val text =
    "This is compose multiplatform text on ${getPlatformName()}. This is more compose" +
        " multiplatform text on ${getPlatformName()}. This is even more compose multiplatform" +
        " text on ${getPlatformName()}. Supercalifragilisticexpialidocious!"

Screenshots

MatkovIvan commented 4 months ago

It's currently not supported. As I see, it's not implemented in an underlying skia library either. On Android, Compose uses a system line breaker for this.

okushnikov commented 2 months ago

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