Changed allg5ui.font.Measure() implementation to be more consistent with the sdlui implementation.
This commit is contained in:
parent
b434a71f00
commit
2238f8749a
@ -42,6 +42,8 @@ func (f *font) Measure(t string) geom.RectangleF32 {
|
|||||||
if f == nil {
|
if f == nil {
|
||||||
return geom.RectangleF32{}
|
return geom.RectangleF32{}
|
||||||
}
|
}
|
||||||
var x, y, w, h = f.TextDimensions(t)
|
// allg5.Font.TextDimentions (previous implementation) seems to return the closest fit rectangle to the drawn text (so depending on the glyphs). allg5.Font.TextWidth is giving the full width (not trimmed) which gives a better result together with allg5.Font.Height.
|
||||||
return geom.RectF32(x, y, x+w, y+h)
|
w := f.TextWidth(t)
|
||||||
|
h := f.Height()
|
||||||
|
return geom.RectRelF32(0, 0, w, h)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user