package gfx import ( "github.com/hajimehoshi/ebiten/v2" "github.com/hajimehoshi/ebiten/v2/text/v2" ) type Font struct { Font *text.GoTextFace effects []Effect } func (f *Font) ApplyEffects(time float32, op *ebiten.DrawImageOptions) (bool, error) { return ApplyEffects(f.effects, time, op) } func (f *Font) Measure(t string) (float64, float64) { return text.Measure(t, f.Font, 0) } func (f *Font) DrawText(image *ebiten.Image, t string, time float32, op *text.DrawOptions) (bool, error) { if op == nil { op = &text.DrawOptions{} } playing, err := f.ApplyEffects(time, &op.DrawImageOptions) if err != nil { return false, err } text.Draw(image, t, f.Font, op) return playing, nil }