| before | after |
Current Blender does not support languages that need complex text layout as in:
- languages that are written from right to left (e.g. Hebrew).
- text where characters needs to be merged into one glyph (e.g. ligature feature in Latin characters).
- languages that need both features (e.g. Arabic).
This patch adds complex text layout feature to blender using raqm HOST-Oman/libraqm. Raqm is a small library that encapsulates the logic for complex text layout. It currently provides bidirectional text support (using FriBiDi), shaping (using HarfBuzz), with proper script itemization. By the virtue of this, raqm can support most writing systems covered by Unicode.
As a native Arabic speaker, I can tell that it is essential for Blender users that will need it to type in Arabic to have this feature, since, as you can see in the image above, Arabic text without this feature is almost unrecognisable. And, I know that is also true for many other languages.
So, if you could please review my patch and if there are any modifications/suggestions, I am willing to work on it until it is hopefully accepted. That will make Blender much more international and it'll make life much easier for international designers to use an open source 3D design software like Blender :)
Core modifications were in font.c and freetypefont.c, a new function to deal with
raqm is added in freetypefont.c
BLI_shape_text() where, input text and the FT_Face are given to raqm, which will do the layout and returns glyph information (e.g. x_offset, x_advance, index, cluster...). And, changing the main function in font.c, BKE_vfont_to_curve_ex() to deal mainly with glyphs instead of characters.
Regards,
Mazoon

