mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
text,widget: test and fix minWidth alignment
This commit unifies and fixes the shaper's handling of the alignment minimum width. Previously it was only considered when the text was a single line, but in hindsight that was clearly a mistake. Now the maximum width of all shaped lines and the minimum width is used to set the text alignment. This commit also fixes an index test in package widget that was relying on the old (incorrect) alignment behavior. Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
@@ -36,11 +36,11 @@ func makePosTestText(fontSize, lineWidth int, alignOpposite bool) (bidiLTR, bidi
|
||||
ltrParams.Alignment = text.End
|
||||
rtlParams.Alignment = text.Start
|
||||
}
|
||||
shaper.LayoutString(ltrParams, 0, lineWidth, english, bidiSource)
|
||||
shaper.LayoutString(ltrParams, lineWidth, lineWidth, english, bidiSource)
|
||||
for g, ok := shaper.NextGlyph(); ok; g, ok = shaper.NextGlyph() {
|
||||
bidiLTR = append(bidiLTR, g)
|
||||
}
|
||||
shaper.LayoutString(rtlParams, 0, lineWidth, arabic, bidiSource)
|
||||
shaper.LayoutString(rtlParams, lineWidth, lineWidth, arabic, bidiSource)
|
||||
for g, ok := shaper.NextGlyph(); ok; g, ok = shaper.NextGlyph() {
|
||||
bidiRTL = append(bidiRTL, g)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user