I have a problem with Persian/Arabic characters in KivyMD
, which in some places it seems that arabic_reshaper
and bidi.algorithm
are not working. this is my code:
from kivymd.app import MDApp
from kivymd.uix.screen import Screen
from kivy.lang import Builder
import arabic_reshaper
import bidi.algorithm
screen_helper_up = """
Screen:
NavigationLayout:
ScreenManager:
Screen:
BoxLayout:
orientation: 'vertical'
MDToolbar:
#1
title: app.res3 + 'A'
font_name:'arial'
left_action_items: [["menu", lambda x: nav_drawer.toggle_nav_drawer()]]
elevation:10
MDTextField:
#2
text: app.res3 + 'B'
#3
helper_text: app.res3 + 'C'
#4
hint_text: app.res3 + 'D'
font_name: 'arial'
helper_text_mode: "persistent"
font_size: 30
line_color_focus: self.theme_cls.opposite_bg_normal
pos_hint: {'center_x': 0.5, 'center_y': 0.3}
size_hint: (0.5,0.4)
icon_right: "android"
Widget:
Label:
#5
text: app.res3 + 'E'
font_name:'arial'
markup: True
font_size: 100
color: 0,0,0,1
MDNavigationDrawer:
id: nav_drawer
"""
class DemoApp(MDApp):
text3 = ("امیر")
reshaped_texts3 = arabic_reshaper.reshape(text3)
res3 = bidi.algorithm.get_display(reshaped_texts3)
def build(self):
screen = Screen()
screen = Builder.load_string(screen_helper_up)
return screen
DemoApp().run()
In the lines after #2 and #5 the text:"امیر" is shown perfectly but in lines after #1 , #3 and #4 it is shown as small rectangles, as it is shown below: enter image description here
In other word the word "امیر" in MDTextField -> text
and Label
is displayed perfectly but in MDToolbar -> title
, helper_text
and hint_text
the word "امیر" is written in unknown characters
i search SOF and there is another topic here but seems to be away from subject: TOPIC
I also red about this topic in KivyMD discord group and github pages but in some specific positions as I said above the problem still exists.
any suggestions would be appriciated.