saket / extended-spans

Squiggly underlines and rounded corners for text in Compose UI
https://saket.me/compose-custom-text-spans/
Apache License 2.0
390 stars 9 forks source link

QUERY - How to align it in centre #4

Open md0092651 opened 1 month ago

md0092651 commented 1 month ago

First of all thanks for the awesome library.

I am creating a sample app with annotated string like this

 val text = buildAnnotatedString {
        withStyle(
            style = SpanStyle(
                fontSize = 90.sp
            )
        ){
            append(subjectText)
        }

        withStyle(SpanStyle(background = MaterialTheme.colorScheme.primaryContainer)) {
            append(tag)
        }
    }

the issue is the tag is not centre aligned.

is there any additional config to do so ? I played around the params of RoundedCornerSpanPainter but nothing works

2nd issue which I am facing it I have to give the topMargin = 45 SP manually else the background is full height

saket commented 1 month ago

Are the spans centered if you display the text without extended-spans?