mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-13 06:27:28 +01:00
text/v2: refactoring: don't consider origin's posotion for the subpixel offset Y
This commit is contained in:
parent
e4f9d854d2
commit
29fe3f6d21
@ -128,12 +128,12 @@ func (s *StdFace) glyphImage(r rune, origin fixed.Point26_6) (*ebiten.Image, flo
|
|||||||
b, a, _ := s.f.GlyphBounds(r)
|
b, a, _ := s.f.GlyphBounds(r)
|
||||||
subpixelOffset := fixed.Point26_6{
|
subpixelOffset := fixed.Point26_6{
|
||||||
X: (adjustOffsetGranularity(origin.X) + b.Min.X) & ((1 << 6) - 1),
|
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{
|
key := glyphImageCacheKey{
|
||||||
rune: r,
|
rune: r,
|
||||||
xoffset: subpixelOffset.X,
|
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 {
|
img := theGlyphImageCache.getOrCreate(s, key, func() *ebiten.Image {
|
||||||
return s.glyphImageImpl(r, subpixelOffset, b)
|
return s.glyphImageImpl(r, subpixelOffset, b)
|
||||||
|
Loading…
Reference in New Issue
Block a user