Matplotlib: Writing right-to-left text (Hebrew, Arabic, etc.)

For Arabic you need both bidi.algorithm.get_display and arabic_reshaper modules: from bidi.algorithm import get_display import matplotlib.pyplot as plt import arabic_reshaper reshaped_text = arabic_reshaper.reshape(u’لغةٌ عربيّة’) artext = get_display(reshaped_text) plt.text(0.25, 0.45, artext , name=”Times New Roman”,fontsize=50) plt.show()

Right-to-Left and Left-to-Right printed nicely

Put a Right-to-Left Embedding character, u’\u202B’, at the beginning of each Hebrew word, and a Pop Directional Formatting character, u’\u202C’, at the end of each word. This will set the Hebrew words apart as RTL sections in an otherwise LTR document. (Note that while this will produce the correct output, you’re also dependent on the … Read more

How to handle RTL languages on pre 4.2 versions of Android?

Sadly, I don’t think there’s a good solution (“good” meaning “does the job and is readily available”). For our own Android apps that support Hebrew, we use a custom rendering mechanism that we developed over many years. The rendering mechanism does everything: proprietary fonts; bidirectional (bidi) analysis; glyph placement; line break analysis; text flow; etc. … Read more