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 textOp.SecondaryAlign = text.AlignCenter
text.Draw(boardImage, str, &text.GoTextFace{ text.Draw(boardImage, str, &text.GoTextFace{
Source: mplusFaceSource, Source: mplusFaceSource,
SizeInPoints: sizeInPoints, SizeInPixels: sizeInPoints,
}, textOp) }, textOp)
} }

View File

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

View File

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

View File

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

View File

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