From f618c55b25ebe8c0010175346b1187c8e37ad931 Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Wed, 13 May 2020 16:49:45 +0200 Subject: [PATCH] Embedded Allegro font struct directly inside font wrapped. --- allg5ui/font.go | 10 +++++----- allg5ui/renderer.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/allg5ui/font.go b/allg5ui/font.go index c046f3d..1f9c63a 100644 --- a/allg5ui/font.go +++ b/allg5ui/font.go @@ -15,7 +15,7 @@ func NewFontDefinition(name string, size int) FontDefinition { } type font struct { - f *allg5.Font + *allg5.Font } func newFont(f *allg5.Font) *font { @@ -23,24 +23,24 @@ func newFont(f *allg5.Font) *font { } func (f *font) Destroy() { - f.f.Destroy() + f.Font.Destroy() } func (f *font) Height() float32 { if f == nil { return 0 } - return f.f.Height() + return f.Font.Height() } func (f *font) WidthOf(t string) float32 { - return f.f.TextWidth(t) + return f.TextWidth(t) } func (f *font) Measure(t string) geom.RectangleF32 { if f == nil { return geom.RectangleF32{} } - var x, y, w, h = f.f.TextDimensions(t) + var x, y, w, h = f.TextDimensions(t) return geom.RectF32(x, y, x+w, y+h) } diff --git a/allg5ui/renderer.go b/allg5ui/renderer.go index 6fc9072..4c8ffd4 100644 --- a/allg5ui/renderer.go +++ b/allg5ui/renderer.go @@ -265,7 +265,7 @@ func (r *Renderer) text(p geom.PointF32, font string, c color.Color, t string, a return } x, y := snap(p) - f.f.Draw(x, y, newColor(c), align, t) + f.Draw(x, y, newColor(c), align, t) } func (r *Renderer) Text(p geom.PointF32, font string, c color.Color, t string) {