text/v2: rename SizeInPoints -> SizeInPixels

This commit is contained in:
Hajime Hoshi 2023-11-15 13:14:36 +09:00
parent 5fa2c00014
commit f2180a5dc5
5 changed files with 11 additions and 11 deletions

View File

@ -373,6 +373,6 @@ func (t *Tile) Draw(boardImage *ebiten.Image) {
textOp.SecondaryAlign = text.AlignCenter
text.Draw(boardImage, str, &text.GoTextFace{
Source: mplusFaceSource,
SizeInPoints: sizeInPoints,
SizeInPixels: sizeInPoints,
}, textOp)
}

View File

@ -98,7 +98,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
text.Draw(screen, arabicText, &text.GoTextFace{
Source: arabicFaceSource,
Direction: text.DirectionRightToLeft,
SizeInPoints: 24,
SizeInPixels: 24,
Language: language.Arabic,
}, op)
@ -108,7 +108,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
op.GeoM.Translate(20, 110)
text.Draw(screen, hindiText, &text.GoTextFace{
Source: devanagariFaceSource,
SizeInPoints: 24,
SizeInPixels: 24,
Language: language.Hindi,
}, op)
@ -118,7 +118,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
op.GeoM.Translate(20, 160)
text.Draw(screen, thaiText, &text.GoTextFace{
Source: thaiFaceSource,
SizeInPoints: 24,
SizeInPixels: 24,
Language: language.Thai,
}, op)
@ -130,7 +130,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
text.Draw(screen, japaneseText, &text.GoTextFace{
Source: japaneseFaceSource,
Direction: text.DirectionTopToBottomAndRightToLeft,
SizeInPoints: 24,
SizeInPixels: 24,
Language: language.Japanese,
}, op)
}

View File

@ -44,7 +44,7 @@ type faceCacheKey struct {
goTextFaceSourceID uint64
goTextFaceDirection Direction
goTextFaceSizeInPoints float64
goTextFaceSizeInPixels float64
goTextFaceLanguage string
goTextFaceScript string
goTextFaceVariations string

View File

@ -40,7 +40,7 @@ type GoTextFace struct {
Source *GoTextFaceSource
Direction Direction
SizeInPoints float64
SizeInPixels float64
// Language is a hiint for a language (BCP 47).
Language language.Tag
@ -179,7 +179,7 @@ func MustParseTag(str string) Tag {
// Metrics implements Face.
func (g *GoTextFace) Metrics() Metrics {
scale := g.Source.scale(g.SizeInPoints)
scale := g.Source.scale(g.SizeInPixels)
var m Metrics
if h, ok := g.Source.f.FontHExtents(); ok {
@ -238,7 +238,7 @@ func (g *GoTextFace) faceCacheKey() faceCacheKey {
return faceCacheKey{
goTextFaceSourceID: g.Source.id,
goTextFaceDirection: g.Direction,
goTextFaceSizeInPoints: g.SizeInPoints,
goTextFaceSizeInPixels: g.SizeInPixels,
goTextFaceLanguage: g.Language.String(),
goTextFaceScript: g.Script.String(),
goTextFaceVariations: g.ensureVariationsString(),
@ -250,7 +250,7 @@ func (g *GoTextFace) outputCacheKey(text string) goTextOutputCacheKey {
return goTextOutputCacheKey{
text: text,
direction: g.Direction,
sizeInPoints: g.SizeInPoints,
sizeInPoints: g.SizeInPixels,
language: g.Language.String(),
script: g.Script.String(),
variations: g.ensureVariationsString(),

View File

@ -147,7 +147,7 @@ func (g *GoTextFaceSource) shape(text string, face *GoTextFace) (shaping.Output,
Direction: face.diDirection(),
Face: face.Source.f,
FontFeatures: face.features,
Size: float64ToFixed26_6(face.SizeInPoints),
Size: float64ToFixed26_6(face.SizeInPixels),
Script: face.gScript(),
Language: language.Language(face.Language.String()),
}