Python绝望|标签文本上的阿拉伯文本
Python kivy | Arabic text on Label text
我尝试输入阿拉伯文字时遇到的问题
我的代码是:
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 text 是一些 Square
您必须为标签提供支持阿拉伯语
的字体
#option1 -- on each TextInput
TextInput:
font_name: "path/to/a/font/that/support/arabic.ttf"
#option2 override for all TextInputs
<TextInput>:
font_name: ...
来自 docs 的警告说:
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 ‘[]’ 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.
我尝试输入阿拉伯文字时遇到的问题 我的代码是:
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 text 是一些 Square
您必须为标签提供支持阿拉伯语
的字体#option1 -- on each TextInput
TextInput:
font_name: "path/to/a/font/that/support/arabic.ttf"
#option2 override for all TextInputs
<TextInput>:
font_name: ...
来自 docs 的警告说:
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 ‘[]’ 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.