From e4f9d854d2d725200e5a6a409608d0fd9129bf8d Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 13 Nov 2023 02:41:38 +0900 Subject: [PATCH] Revert "text/v2: don't consider subpixels in Y direction in StdFace" This reverts commit 38a0449b44b3f3a8094586b5a53c406a49c0c495. Reason: the rendering result has changed unexpectedly --- text/v2/std.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/text/v2/std.go b/text/v2/std.go index 35633debe..a684beb5d 100644 --- a/text/v2/std.go +++ b/text/v2/std.go @@ -126,13 +126,14 @@ func (s *StdFace) appendGlyphs(glyphs []Glyph, text string, originX, originY flo func (s *StdFace) glyphImage(r rune, origin fixed.Point26_6) (*ebiten.Image, float64, float64, fixed.Int26_6) { b, a, _ := s.f.GlyphBounds(r) - // As a StdFace is always horizontal line, subpixels in Y direction doesn't have to be considered. 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), } key := glyphImageCacheKey{ rune: r, xoffset: subpixelOffset.X, + // yoffset is always an integer, so this doesn't have to be a key. } img := theGlyphImageCache.getOrCreate(s, key, func() *ebiten.Image { return s.glyphImageImpl(r, subpixelOffset, b)