蟒蛇|标签文本上的阿拉伯文文本 [英] Python kivy | Arabic text on Label text

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

问题描述

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

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

推荐答案

你必须给标签一个支持阿拉伯语

#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.

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

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