examples/texti18n: use Jpan as a Japanese script

This commit is contained in:
Hajime Hoshi 2023-07-09 15:17:25 +09:00
parent 66410a03cb
commit 58f1415cac

View File

@ -113,6 +113,8 @@ func init() {
var japaneseOut shaping.Output var japaneseOut shaping.Output
func init() { func init() {
const japanese = language.Script(('j' << 24) | ('p' << 16) | ('a' << 8) | 'n')
face, err := font.ParseTTF(bytes.NewReader(fonts.MPlus1pRegular_ttf)) face, err := font.ParseTTF(bytes.NewReader(fonts.MPlus1pRegular_ttf))
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
@ -125,7 +127,7 @@ func init() {
Direction: di.DirectionTTB, Direction: di.DirectionTTB,
Face: face, Face: face,
Size: fixed.I(24), Size: fixed.I(24),
Script: language.Katakana_Or_Hiragana, Script: japanese,
Language: "ja", Language: "ja",
} }
japaneseOut = (&shaping.HarfbuzzShaper{}).Shape(input) japaneseOut = (&shaping.HarfbuzzShaper{}).Shape(input)