compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

Support text hyphenation

Open brewin opened this issue 1 year ago • 1 comments

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

Affected platforms

  • iOS

Versions

  • Libraries:

    • Compose Multiplatform version: 1.6.10-dev1623
  • Kotlin version:

  • OS version(s) (required for Desktop and iOS issues): iOS 17.4

  • OS architecture (x86 or arm64): arm64

  • Device (model or simulator for iOS issues): All

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

brewin avatar May 09 '24 18:05 brewin

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.

MatkovIvan avatar May 13 '24 09:05 MatkovIvan

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

okushnikov avatar Jul 14 '24 15:07 okushnikov