From 29fe3f6d21f447779122eda268db9c38971687df Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 13 Nov 2023 02:44:09 +0900 Subject: [PATCH] text/v2: refactoring: don't consider origin's posotion for the subpixel offset Y --- text/v2/std.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/text/v2/std.go b/text/v2/std.go index a684beb5d..1659359f6 100644 --- a/text/v2/std.go +++ b/text/v2/std.go @@ -128,12 +128,12 @@ func (s *StdFace) glyphImage(r rune, origin fixed.Point26_6) (*ebiten.Image, flo b, a, _ := s.f.GlyphBounds(r) subpixelOffset := fixed.Point26_6{ X: (adjustOffsetGranularity(origin.X) + b.Min.X) & ((1 << 6) - 1), - Y: (fixed.I(origin.Y.Floor()) + b.Min.Y) & ((1 << 6) - 1), + Y: b.Min.Y & ((1 << 6) - 1), } key := glyphImageCacheKey{ rune: r, xoffset: subpixelOffset.X, - // yoffset is always an integer, so this doesn't have to be a key. + // yoffset is always the same if the rune is the same, so this doesn't have to be a key. } img := theGlyphImageCache.getOrCreate(s, key, func() *ebiten.Image { return s.glyphImageImpl(r, subpixelOffset, b)