From 06ca0157bf9aa6f89173dbea5aad9a28000a7800 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 20 Dec 2023 13:38:07 +0900 Subject: [PATCH] examples/texti18n: sort texts in an alphabetical order of languages --- examples/texti18n/main.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/examples/texti18n/main.go b/examples/texti18n/main.go index d45a59742..24b8e83b6 100644 --- a/examples/texti18n/main.go +++ b/examples/texti18n/main.go @@ -138,20 +138,6 @@ func (g *Game) Draw(screen *ebiten.Image) { op.GeoM.Translate(float64(x), float64(y)) text.Draw(screen, hindiText, f, op) } - { - const thaiText = "โดยที่การยอมรับนับถือเกียรติศักดิ์ประจำตัว" - f := &text.GoTextFace{ - Source: thaiFaceSource, - Size: 24, - Language: language.Thai, - } - x, y := 20, 160 - w, h := text.Measure(thaiText, f, 0) - vector.DrawFilledRect(screen, float32(x), float32(y), float32(w), float32(h), gray, false) - op := &text.DrawOptions{} - op.GeoM.Translate(float64(x), float64(y)) - text.Draw(screen, thaiText, f, op) - } { const myanmarText = "လူခပ်သိမ်း၏ မျိုးရိုးဂုဏ်သိက္ခာနှင့်တကွ" f := &text.GoTextFace{ @@ -159,13 +145,27 @@ func (g *Game) Draw(screen *ebiten.Image) { Size: 24, Language: language.Burmese, } - x, y := 20, 210 + x, y := 20, 160 w, h := text.Measure(myanmarText, f, 0) vector.DrawFilledRect(screen, float32(x), float32(y), float32(w), float32(h), gray, false) op := &text.DrawOptions{} op.GeoM.Translate(float64(x), float64(y)) text.Draw(screen, myanmarText, f, op) } + { + const thaiText = "โดยที่การยอมรับนับถือเกียรติศักดิ์ประจำตัว" + f := &text.GoTextFace{ + Source: thaiFaceSource, + Size: 24, + Language: language.Thai, + } + x, y := 20, 220 + w, h := text.Measure(thaiText, f, 0) + vector.DrawFilledRect(screen, float32(x), float32(y), float32(w), float32(h), gray, false) + op := &text.DrawOptions{} + op.GeoM.Translate(float64(x), float64(y)) + text.Draw(screen, thaiText, f, op) + } { const japaneseText = "あのイーハトーヴォの\nすきとおった風、\n夏でも底に冷たさを\nもつ青いそら…" f := &text.GoTextFace{ @@ -175,7 +175,7 @@ func (g *Game) Draw(screen *ebiten.Image) { Language: language.Japanese, } const lineSpacing = 48 - x, y := screenWidth-20, 300 + x, y := screenWidth-20, 280 w, h := text.Measure(japaneseText, f, lineSpacing) // The left upper point is not x but x-w, since the text runs in the rigth-to-left direction as the secondary direction. vector.DrawFilledRect(screen, float32(x)-float32(w), float32(y), float32(w), float32(h), gray, false)