After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 167746 - how to force auto_dir off in pango_layout used by widgets
how to force auto_dir off in pango_layout used by widgets
Product: gtk+
Classification: Platform
Component: Widget: Other
Other Linux
: Normal normal
: Small API
Assigned To: gtk-bugs
Depends on:
Reported: 2005-02-17 22:14 UTC by Felipe Heidrich
Modified: 2018-05-02 14:08 UTC
See Also:
GNOME target: ---
GNOME version: ---

Description Felipe Heidrich 2005-02-17 22:14:52 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.
Comment 1 Felipe Heidrich 2005-02-17 22:19:12 UTC
Do you think it is important for us to have the behaviour described above for 
a SWT Label created with SWT.RIGHT_TO_LEFT ?
Comment 2 Felipe Heidrich 2005-02-22 23:17:08 UTC
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.

Comment 3 Felipe Heidrich 2007-05-18 21:29:59 UTC
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.
Comment 4 Felipe Heidrich 2008-06-11 16:07:46 UTC
Why is this problem still marked as UNCONFIRMED ?
Please, take a look at this. See
It has a long list of bidi problems.
Comment 5 GNOME Infrastructure Team 2018-05-02 14:08:05 UTC
-- 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: