all: rename sizeInPoints -> sizeInPixels

This commit is contained in:
Hajime Hoshi 2023-11-15 14:03:22 +09:00
parent f2180a5dc5
commit 586a4b6d6e
3 changed files with 8 additions and 8 deletions

View File

@ -358,12 +358,12 @@ func (t *Tile) Draw(boardImage *ebiten.Image) {
boardImage.DrawImage(tileImage, op)
str := strconv.Itoa(v)
sizeInPoints := 48.0
sizeInPixels := 48.0
switch {
case 3 < len(str):
sizeInPoints = 24
sizeInPixels = 24
case 2 < len(str):
sizeInPoints = 32
sizeInPixels = 32
}
textOp := &text.DrawOptions{}
@ -373,6 +373,6 @@ func (t *Tile) Draw(boardImage *ebiten.Image) {
textOp.SecondaryAlign = text.AlignCenter
text.Draw(boardImage, str, &text.GoTextFace{
Source: mplusFaceSource,
SizeInPixels: sizeInPoints,
SizeInPixels: sizeInPixels,
}, textOp)
}

View File

@ -250,7 +250,7 @@ func (g *GoTextFace) outputCacheKey(text string) goTextOutputCacheKey {
return goTextOutputCacheKey{
text: text,
direction: g.Direction,
sizeInPoints: g.SizeInPixels,
sizeInPixels: g.SizeInPixels,
language: g.Language.String(),
script: g.Script.String(),
variations: g.ensureVariationsString(),

View File

@ -29,7 +29,7 @@ import (
type goTextOutputCacheKey struct {
text string
direction Direction
sizeInPoints float64
sizeInPixels float64
language string
script string
variations string
@ -215,6 +215,6 @@ func (g *GoTextFaceSource) shape(text string, face *GoTextFace) (shaping.Output,
return out, gs
}
func (g *GoTextFaceSource) scale(sizeInPoints float64) float64 {
return sizeInPoints / float64(g.f.Upem())
func (g *GoTextFaceSource) scale(sizeInPixels float64) float64 {
return sizeInPixels / float64(g.f.Upem())
}