Reputation: 1761
i have a label that show a multiline text in persian
kv file:
<FarsiLabel@Label>:
font_name: 'tabassom'
FarsiLabel:
text: set_text('پیروزی برای افرادی امکان پذیر است که از مبارزه دست نمی کشند\n')
text_size: self.size
halign: 'center'
color: utils.get_color_from_hex('546E7A')
set_text method:
def set_text(text):
text = unicode(text, 'utf-8')
result = arabic_reshaper.reshape(text)
result = get_display(result)
return result
result(incorrect):
correct result(gimp):
I've found that the problem in the python-bidi get_display method, but i don't know how to solve it
question is: how to solve this problem?
Upvotes: 4
Views: 977
Reputation: 12087
That's how bidi.algorithm.get_display
works, it inverts the order of letters. So what you consider it as the first word is the last word in output.
You should detect the width of the label in characters and do the segmentation in lines yourself. Then apply get_display
on each line.
Upvotes: 2