I kinda recall someone talking about how in a text...
# compose
s
I kinda recall someone talking about how in a text block, you can ask it to prefer to be laid out with all lines having an equal-ish words on each line in case the text goes over to second line. So something like
Copy code
This is some long text where
it gets cut off somewhere
Instead of
Copy code
This is some long text where it gets cut off
somewhere
But I really can’t find something here, am I imagining it perhaps 🤔
o
s
Aha I think on
TextStyle
I see a parameter called
LineBreak
which can be configured to have a pre-defined “Heading” style, which I think more or less does what I want. Found here. I will go with it and see how it works
Damn I can’t believe I didn’t remember or even just find the question that I myself asked here 😵‍💫 It does kinda explain though how I sort of found my way around to the correct API, I think it was in a place in my brain, hidden very well. Thanks a lot, and I need to check if something is wrong with my memory after this, I don’t know how I will recover from such a blow 😂
z
☝🏻 me after every time I forget an actor’s name
s
Copying from whats new in compose march 2023 blog post: Configure line breaking behavior using TextStyle.lineBreak. Use built-in semantic configurations like Heading, Paragraph, or Simple, or construct your own LineBreak configuration with the desired Strategy, Strictness, and WordBreak values. Add hyphenation support using TextStyle.hyphens.
s
Yep thanks for the link! So far with the things I was testing, Heading is what I wanted in this use case, so nice to have these sane defaults to pick from before having to play with the individual parameters ourselves. Super nice API I love it, great job on it!