We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
b9b365a
go version
go version go1.21.1 darwin/amd64
Add NotoSansMongolian.ttf to examples/texti18n and apply this patch:
NotoSansMongolian.ttf
examples/texti18n
diff --git a/examples/texti18n/main.go b/examples/texti18n/main.go index fe604db8a..56b47ca06 100644 --- a/examples/texti18n/main.go +++ b/examples/texti18n/main.go @@ -70,6 +70,19 @@ func init() { thaiFaceSource = s } +//go:embed NotoSansMongolian-Regular.ttf +var mongolianTTF []byte + +var mongolianFaceSource *text.GoTextFaceSource + +func init() { + s, err := text.NewGoTextFaceSource(bytes.NewReader(mongolianTTF)) + if err != nil { + log.Fatal(err) + } + mongolianFaceSource = s +} + var japaneseFaceSource *text.GoTextFaceSource func init() { @@ -139,6 +152,25 @@ func (g *Game) Draw(screen *ebiten.Image) { op.GeoM.Translate(float64(x), float64(y)) text.Draw(screen, thaiText, f, op) } + { + const mongolianText = "ᠬᠦᠮᠦᠨ ᠪᠦᠷ ᠲᠥᠷᠥᠵᠦ ᠮᠡᠨᠳᠡᠯᠡᠬᠦ\nᠡᠷᠬᠡ ᠴᠢᠯᠥᠭᠡ ᠲᠡᠢ᠂ ᠠᠳᠠᠯᠢᠬᠠᠨ" + f := &text.GoTextFace{ + Source: mongolianFaceSource, + Direction: text.DirectionTopToBottomAndLeftToRight, + Size: 24, + Language: language.Mongolian, + // language.Mongolian.Script() returns "Cyrl" (Cyrillic), but we want Mongolian script here. + Script: language.MustParseScript("Mong"), + } + const lineSpacing = 48 + x, y := 20, 210 + w, h := text.Measure(mongolianText, f, lineSpacing) + vector.DrawFilledRect(screen, float32(x), float32(y), float32(w), float32(h), gray, false) + op := &text.DrawOptions{} + op.GeoM.Translate(float64(x), float64(y)) + op.LineSpacingInPixels = lineSpacing + text.Draw(screen, mongolianText, f, op) + } { const japaneseText = "あのイーハトーヴォの\nすきとおった風、\n夏でも底に冷たさを\nもつ青いそら…" f := &text.GoTextFace{
A vertical Mongolian script is rendered correctly
The glyphs are not rotated:
Apparently rotating glyphs is Ebitengine's responsibility.
See a rune's Vertical_Orientation property and rotate it correctly.
The text was updated successfully, but these errors were encountered:
examples/texti18n: WIP: bug fix: rotate some glyphs for vertical textts
47909f8
Closes #2849
2d87bbb
go-text/typesetting#111
Sorry, something went wrong.
6878bd7
No branches or pull requests
Ebitengine Version
b9b365a
Operating System
Go Version (
go version
)go version go1.21.1 darwin/amd64
What steps will reproduce the problem?
Add
NotoSansMongolian.ttf
toexamples/texti18n
and apply this patch:What is the expected result?
A vertical Mongolian script is rendered correctly
What happens instead?
The glyphs are not rotated:
Anything else you feel useful to add?
Apparently rotating glyphs is Ebitengine's responsibility.
See a rune's Vertical_Orientation property and rotate it correctly.
The text was updated successfully, but these errors were encountered: