mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
text/v2: don't consider subpixels in Y direction in StdFace
This commit is contained in:
parent
a645fbb2b0
commit
38a0449b44
@ -126,14 +126,13 @@ 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) {
|
func (s *StdFace) glyphImage(r rune, origin fixed.Point26_6) (*ebiten.Image, float64, float64, fixed.Int26_6) {
|
||||||
b, a, _ := s.f.GlyphBounds(r)
|
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{
|
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),
|
|
||||||
}
|
}
|
||||||
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.
|
|
||||||
}
|
}
|
||||||
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