AhmedBinFaisal
AhmedBinFaisal

Reputation: 1

Incorrect Arabic letters encoding with "kivy"

I am new in kivy, and initially I'd like to thank

every person that will take care of my question..

@@When I use Arabic letters in the

strings they don't apper correctly when I run the

code, although I refer to utf-8 as the encoding

at the py. or kv. files.

-My operating system is winows 7

How can I solve it?

Here is a very simple code that shows my problem:

# -*- coding: utf-8 -*-

import kivy
from kivy.app import App
from kivy.uix.label import Label


class FirstApp(App):
     def build(self):   
        return Label(text='بسم الله')


if __name__ == '__main__':
    FirstApp().run()

and here is the result: incorrect encoding result

Upvotes: 0

Views: 985

Answers (1)

Trevor Merrifield
Trevor Merrifield

Reputation: 4691

The documentation explains the problem and solution:

The font kivy uses does not contain all the characters required for displaying all languages. When you use the built-in widgets, this results in a block being drawn where you expect a character.

If you want to display such characters, you can chose a font that supports them and deploy it universally via kv:

<Label>:
    font_name: '/<path>/<to>/<font>'

Note that this needs to be done before your widgets are loaded as kv rules are only applied at load time.

https://kivy.org/docs/api-kivy.uix.label.html#catering-for-unicode-languages.

Upvotes: 2

Related Questions