Python奇异果|标签文字上的阿拉伯文字 [英] Python kivy | Arabic text on Label text

查看:65
本文介绍了Python奇异果|标签文字上的阿拉伯文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试输入阿拉伯文字时遇到的问题 我的代码是:

My problem when i try type arabic text My code is :

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

when i execute Textinput text is a some of Square

推荐答案

您必须给标签提供支持阿拉伯语

You'll have to give the label a font that support Arabic

#option1 -- on each TextInput
TextInput:
    font_name: "path/to/a/font/that/support/arabic.ttf"

#option2 override for all TextInputs
<TextInput>:
    font_name: ...

docs 说:

警告 根据您的文本提供程序,字体文件可能会被忽略.但是,您几乎可以毫无问题地使用它. 如果所使用的字体缺少所用特定语言/符号的字形,则您会看到"[]"空白框字符,而不是实际的字形.解决方案是使用具有需要显示的字形的字体.例如,要显示unicodechar,请使用带有字形的字体,如freesans.ttf.

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.

这篇关于Python奇异果|标签文字上的阿拉伯文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆