K Merle
08/22/2022, 1:40 PMText
composable, if word does not fit in the line, it goes to the next line. Is it possible to still leave the word in the same line and have that hard break of the word? Example:
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lore
m Ipsum has been the industry's standar
d dummy text ever since the 1500s.
Zach Klippenstein (he/him) [MOD]
08/22/2022, 1:48 PMK Merle
08/22/2022, 3:32 PMRick Regan
08/22/2022, 7:11 PMAlex Vanyo
08/22/2022, 11:51 PMval sourceText = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s."
val modifiedText = sourceText.toList().joinToString("\u200B")
Text(modifiedText)
Rick Regan
08/22/2022, 11:59 PM" \u200B"
instead of "\uFEFF"
in my code I don’t get the non-breaking behavior.Alex Vanyo
08/23/2022, 12:04 AM\uFEFF
also works for me, although the Wikipedia article says that one is deprecated?\u2060
also works. I’m just trying all of these out for fun, not sure how supported this is or if this is a reasonable approach. There’s also TransformedText
and VisualTransformation
, which might be the correct thing to do for something like thisRick Regan
08/23/2022, 1:01 AM\uFEFF
was deprecated! (Thanks.) Maybe I will switch to \u2060
, which appears to works as well.Text
uses, and at the time I experimented with all of them (a left or right parenthesis, for example, never caused a problem — and still don’t). Space, period, and forward slash were the three that I needed to insert the non-breaking space after. Now it appears only space requires it.
(I don’t know that I would remove the code in my app that inserts them, just to be safe — unless I got a definitive reason why the behavior changed.)TransformedText
as the better way to do this.K Merle
08/23/2022, 5:10 AMSiyamed
08/23/2022, 5:13 AMK Merle
08/23/2022, 5:17 AMRick Regan
08/23/2022, 12:49 PMText
. The use of the non-breaking space for the few problematic symbols was how I dealt with it. Having fewer symbols to account for is better in some sense, but still I’d like to know if it’s a bug or a feature.
I’ll see if I can figure out when it changed (I’m on the latest Compose and Material 3 currently, and API 33 for that matter).Siyamed
08/23/2022, 2:25 PMRick Regan
08/23/2022, 2:28 PMText
width) and not line breaking behavior of forward slash and period. Sorry for the false alarm.