You can choose whether or not you want text to wrap

This commit is contained in:
2023-01-10 21:01:30 -05:00
parent a79f2eaf64
commit 3ddeeb5469
4 changed files with 56 additions and 10 deletions

View File

@@ -137,6 +137,21 @@ func (drawer *TextDrawer) LayoutBounds () (bounds image.Rectangle) {
return
}
// Em returns the width of an emspace.
func (drawer *TextDrawer) Em () (width fixed.Int26_6) {
if drawer.face == nil { return }
width, _ = drawer.face.GlyphAdvance('M')
return
}
// LineHeight returns the height of one line.
func (drawer *TextDrawer) LineHeight () (height fixed.Int26_6) {
if drawer.face == nil { return }
metrics := drawer.face.Metrics()
height = metrics.Height
return
}
func (drawer *TextDrawer) recalculate () {
drawer.layoutClean = true
drawer.layout = nil