I would like to put a contiguous overline over a s...
# compose
r
I would like to put a contiguous overline over a series of characters in a Text() composable, like you would notate a repeating decimal. The only options for
TextDecoration
appear to be
LineThrough
,
Underline
, and
None
. I tried putting "combining overline" unicode characters in the text but it puts an overline over each character, not one contiguous overline across all the characters. Is there a way to do this in Compose?
j
cc @Siyamed
r
Thinking about this a little more,
TextDecoration
was probably not the appropriate place to look to solve this because I'd want to be able to overbar a substring of the text. Perhaps then this is not a Compose specific question.
s
I didnt understand why TeztDecoration doesnt work dor this case
Are you using AnnotatedString (or factory function of it) to set the TextDecoration on the substring?
Currently the factory function is
Copy code
buildAnnotatedString {
 append(myString)
 setSpanStyle(3,5, SpanStyle(textDecoration = TextDecoration.Underline)
}
I am on mobile so the function signature might not be accurate, but they should be similar
r
My comment about TextDecoration was imagining a new "overline" option, but that that would not help in the Text() composable because it would overline the whole string. But I have not used AnnotatedString before so I will look into it and let you know.
I found a code example for AnnotatedString which I was able to modify to use TextDecoration.Underline to underline a subset of a string, so that's a good start (thanks!) I also applied the "combining overline" to a substring and that worked, in that it put a bar over each character. To get the "vinculum" for repeating decimals, I would need a contiguous overline. Is that something TextDecoration could support for Compose?
🙏 1
🙏 1
s
Decoration overline is a planned feature, but since it was not natively supported by android we deprioritized it. We want to add it but there would be a considerable time gap.
r
If there is an open feature request please point me to it so I could star it and comment on it. Thanks.