widget{,/material}: surface line height manipulation

This commit surfaces fields to manipulate the line height of all label and editor
types. It's unfortunate how this spreads through the API, but I don't see a good
way to eliminate that right now.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
Chris Waldon
2023-07-18 16:26:45 -04:00
committed by Elias Naur
parent acab582487
commit ddf770b9d5
6 changed files with 81 additions and 19 deletions
+8
View File
@@ -35,6 +35,12 @@ type Editor struct {
text textView
// Alignment controls the alignment of text within the editor.
Alignment text.Alignment
// LineHeight determines the gap between baselines of text. If zero, a sensible
// default will be used.
LineHeight unit.Sp
// LineHeightScale is multiplied by LineHeight to determine the final gap
// between baselines. If zero, a sensible default will be used.
LineHeightScale float32
// SingleLine force the text to stay on a single line.
// SingleLine also sets the scrolling direction to
// horizontal.
@@ -504,6 +510,8 @@ func (e *Editor) initBuffer() {
e.text.SetSource(e.buffer)
}
e.text.Alignment = e.Alignment
e.text.LineHeight = e.LineHeight
e.text.LineHeightScale = e.LineHeightScale
e.text.SingleLine = e.SingleLine
e.text.Mask = e.Mask
e.text.WrapPolicy = e.WrapPolicy