Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for text decoration line styles via PlatformTextStyle #999

Merged
merged 6 commits into from Jan 25, 2024

Conversation

m-sasha
Copy link

@m-sasha m-sasha commented Jan 18, 2024

Proposed Changes

Skia already supports different text decoration (e.g. underline) styles (e.g. solid, dashed, dotted etc.), but we don't expose this.

This PR exposes it via PlatformTextStyle.

image
import androidx.compose.material.Text
import androidx.compose.ui.text.ExperimentalTextApi
import androidx.compose.ui.text.PlatformTextStyle
import androidx.compose.ui.text.TextDecorationLineStyle
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.window.singleWindowApplication

@OptIn(ExperimentalTextApi::class)
fun main() = singleWindowApplication {
    Text(
        "Hello, Compose",
        style = TextStyle(
            textDecoration = TextDecoration.Underline,
            platformStyle = PlatformTextStyle(
                textDecorationLineStyle = TextDecorationLineStyle.Dotted
            )
        )
    )
}

Note that this isn't supported on Android.

Testing

Test: Manually.

Copy link
Member

@MatkovIvan MatkovIvan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few things that break binary compatibility here. Please run ./gradlew desktopApiDump to check this (and commit the updated dump)

@m-sasha m-sasha force-pushed the m-sasha/platform-decoration-style branch from 38a77db to 2141d4d Compare January 19, 2024 21:29
@m-sasha m-sasha added the enhancement New feature or request label Jan 22, 2024
@m-sasha
Copy link
Author

m-sasha commented Jan 22, 2024

@MatkovIvan @igordmn ping

@MatkovIvan
Copy link
Member

CI is failing, my previous comment is not resolved

@m-sasha
Copy link
Author

m-sasha commented Jan 22, 2024

CI doesn't run. I don't know what to do about that.

What isn't resolved?

@m-sasha m-sasha requested a review from igordmn January 25, 2024 13:34
@m-sasha m-sasha merged commit 4af0e9e into jb-main Jan 25, 2024
6 checks passed
@m-sasha m-sasha deleted the m-sasha/platform-decoration-style branch January 25, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes in API enhancement New feature or request
Projects
None yet
3 participants