GNOME Bugzilla – Bug 167746
how to force auto_dir off in pango_layout used by widgets
Last modified: 2018-05-02 14:08:05 UTC
Distribution/Version: FC3 Here is my problem: In a LTR widget (label) I have the text: "felipe." When I change the direction of this widget to RTL I would like to have ".felipe" If I'm drawning the widget myself I just need to create the widget and call: gtk_widget_set_direction (drawingArea, GTK_TEXT_DIR_RTL); Then during the expose event I use: PangoLayout* layout = gtk_widget_create_pango_layout (drawingArea, text); pango_layout_set_auto_dir (layout, 0); The code above will draw ".felipe" for me. How can I do the same using a GtkLabel (instead of a custom widget?) ? I suppose I could add RLM in the beginning of the string but I think it would be pretty hacky.
Semion: Do you think it is important for us to have the behaviour described above for a SWT Label created with SWT.RIGHT_TO_LEFT ?
Adding RLM (u200F) works for label and buttons but will never work for an entry widget or a textview. Pango is doing the right thing to determine the paragraph level but the Unicode Bidirectional Algorithm also mention "when higher-level protocol specifies the paragraph level, it is not necessary to apply rules P2 and P3." meaning "sometimes the application knows better what it wants". Pango is fine, it has pango_layout_set_auto_dir(FALSE) that allows the application to override the paragraph level using pango_context_set_base_dir(). I would like to see GTK+ to offer the same flexibility Pango does.
Please, look into this problem. Specially for Text widgets - right now gtkentry "guess" the direction of the text by searching the string for the first strong character. Image one needs to write a letter in hebrew but so it happens the first word is in english ? The orientation will be wrong and the widget offers you no api to fix it. On windows one can change the direction of notepad using the context menu or shortcut key control+right_shift (need to enable bidi in control panel). on mac the textedit also has this option up in the menubar. I would expect gtk_widget_set_direction to change the paragraph level of the text in the widget but it doesn't. In gtklabel gtk_widget_set_direction only changes the widget to be right-aligned. in gtkentry it doesn't do anything apparently (?). Please, fix gtk_widget_set_direction.
Why is this problem still marked as UNCONFIRMED ? Please, take a look at this. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=236513 It has a long list of bidi problems.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/244.