当前位置:网站首页>Go language GUI framework Fyne Chinese garbled or not displayed

Go language GUI framework Fyne Chinese garbled or not displayed

2022-04-23 18:42:00 Simple tutorial

Have to say fyne It's really very good Go Language third party GUI frame .

Simple is not simple. In addition , At least I'm much taller than others .

But there are also several problems , The first thing to bear the brunt is Chinese garbled code . The solution , There are two kinds of , One is to use FYNE_FONT Specify the font path

FYNE_FONT=./fonts/alibaba/Alibaba-PuHuiTi-Regular.ttf go run main.go

I put down Alibaba's Pratt & Whitney font , You can use any font that supports Chinese

Yes, of course , There is a drawback to this approach , Namely , You will lack several other Fonts , such as

Cause: open fonts/alibaba/Alibaba-PuHuiTi-Italic.ttf: no such file or directory
Cause: open fonts/alibaba/Alibaba-PuHuiTi-BoldItalic.ttf: no such file or directory

Another kind , Custom theme , This can be referred to as https://github.com/fyne-io/fyne/issues/2660

版权声明
本文为[Simple tutorial]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231839244355.html