Python kivy | Arabic text on Label text
当我尝试输入阿拉伯语文本时出现的问题
我的代码是:
1 2 3 4 5 6 7 8 | import kivy from kivy.app import App from kivy.uix.textinput import TextInput class TestApp(App): def build(self): return TextInput(text='ù…?±?-?¨?§ ?¨ù?ù… ') myapp=TestApp() myapp.run() |
当我执行
Textinput 文本是一些 Square
你必须给标签一个支持阿拉伯语的字体
1 2 3 4 5 6 7 | #option1 -- on each TextInput TextInput: font_name:"path/to/a/font/that/support/arabic.ttf" #option2 override for all TextInputs <TextInput>: font_name: ... |
来自文档的警告说:
Warning
Depending on your text provider, the font file may be ignored. However, you can mostly use this without problems.
If the font used lacks the glyphs for the particular language/symbols you are using, you will see a€?[]a€? blank box characters instead of the actual glyphs. The solution is to use a font that has the glyphs you need to display. For example, to display unicodechar, use a font like freesans.ttf that has the glyph.