Add RecommendedHeight to TypeSetter

This commit is contained in:
Sasha Koshka 2024-09-19 23:57:23 -04:00
parent 197346d730
commit 4be5154df0

View File

@ -175,6 +175,14 @@ func (this *TypeSetter) PositionAt (index int) fixed.Point26_6 {
return position
}
// ReccomendedHeightFor returns the reccomended max height if the text were to
// have its maximum width set to the given width. This does not actually move
// any text, it only simulates it.
func (this *TypeSetter) RecommendedHeight (width fixed.Int26_6) fixed.Int26_6 {
this.needMeasurement()
return recommendHeight(this.tokens, this.face, width)
}
// SetAlign sets the horizontal and vertical alignment of the text.
func (this *TypeSetter) SetAlign (x, y Align) {
if this.xAlign == x && this.yAlign == y { return }