Closed MicroCBer closed 1 year ago
What do you mean by trim the string? The Size
returned by layout
or does it actually modify a String
object? For the layout
case, you could just wrap the TextLayout
in your custom widget and then have the custom widget's layout
return a custom size, perhaps with some padding.
What do you mean by trim the string? The
Size
returned bylayout
or does it actually modify aString
object? For thelayout
case, you could just wrap theTextLayout
in your custom widget and then have the custom widget'slayout
return a custom size, perhaps with some padding.
The size. I don't think it's a good idea to add some custom paddings cuz it would make the render result different from the one which directly use draw_text. but anyway, now I'm adding some custom paddings as it's the only way that can resolve my problem
it would make the render result different
Different in some way other than padding? Generally speaking, I wouldn't expect a widget's paint
to run differently if the parent's size is larger.
uh, I cannot reproduce now. I'll reopen the issue when I reproduce it again.
I'm making word-by-word desktop lyrics software with druid.
To do this, I've split the whole sentence into different tokens depending on the key time ( e.g.
Oh (100ms), spill (128ms)me (160ms)the (182ms)tale (204ms)
.Now I want to draw the lyrics word by word on my custom widget, but then I found that
TextLayout
would automatically trim the string so that the result is now like this. ( the gray part is drawn directly by draw_text and the white part is drawn word by word )So, is there any way to prevent this behavior or any other approach to my target?