phase1geo / Minder

Mind-mapping application for Elementary OS
GNU General Public License v3.0
1.03k stars 67 forks source link

RTL text support enhancement #162

Open wada3n opened 4 years ago

wada3n commented 4 years ago

There is a small issue while writing in the nodes or connections in Arabic, for example, or Right to Left texts in general, Where the text comes out of the writing box frame. The best solution is to make the beginning of the text the rightmost corner of the box, and the more you type, the larger the box.

Peek 2020-06-30 12-28

phase1geo commented 4 years ago

How can I test this out for myself? I am English-speaking only and have the corresponding qwerty keyboard, for context.

wada3n commented 4 years ago

You can try it by adding an Arabic keyboard layout from ‘System Settings’->Click ‘Keyboard’ -> Click ‘+’ on the bottom left of the ‘Layout’ tab. -> Search for Arabic -> choose one and click ‘Add Layout’. Then choose this added layout and press any keys on the keyboard to add just meaningless words.

Or you can make a copy and paste from this list and try it directly in the canvas: مرحبا السلام عليكم أهلا وسهلا كيف الحال

phase1geo commented 4 years ago

Okay, I am able to reproduce the issue.

Out of curiosity, I noticed that using the left arrow key (when editing the Arabic text) causes the cursor to move to the right and the right arrow key causes the cursor to move to the left. Is that the expected behavior for RTL text editing? Seems that I should be detecting what type of text was entered in the node and adjust the key events to work appropriately.

wada3n commented 4 years ago

The Normal behavior, when you press the right arrow key it moves to the right and when you press the left arrow key it moves to the left. In fact, this is a general issue in right-to-left text editing, so you find a lot of software (such as LibreOffice) that creates a feature for editing RTL texts and changing its own behavior. But in general, I think GTK applications have solved this problem You can try Code and Files in Elementary os and you will find that normal behavior is used. I will try to find out more about it, I have to find an easy solution, and tell you

wada3n commented 4 years ago

هل يمكنك مساعدتنا لو تكرمت هنا أخي @bilelmoussaoui can you help us here?

wada3n commented 4 years ago

I think it is generally related to “halign” property. in gtk_widget_set_halign () and GTK_ALIGN_START and GTK_ALIGN_END Where you control the texts in GTK: https://valadoc.org/gtk+-3.0/Gtk.Align.html

Waiting for the opinion and assistance of developer @bilelmoussaoui, personally, I am not a gtk developer, and I do not know enough about that, so excuse me if I make a mistake.

phase1geo commented 4 years ago

The text in Minder nodes is not rendered in a widget. It is drawn via Cairo and Pango, so halign is not useful here.

I will have to give the solution some thought. A new version of Minder will be released very soon, but it will not contain the fix for this issue.

phase1geo commented 4 years ago

I have fixed the issue of drawing the RTL text within a node in the devel branch. This will be generally available in the next stable release.

I do not have support for proper cursor movement when text is within RTL text (left moves the cursor right and right moves the cursor left). I won't be able to fix this until elementary OS uses the latest GTK/GDK library which contains the method I will need to implement this fix.

wada3n commented 4 years ago

This is awesome, it works just as it should. In fact there has been a significant improvement over recent changes with the handling of texts. Thank you very much for the enormous effort you are making, waiting for the new version of elementary OS!