GNOME Bugzilla – Bug 438944
incorrect title when using a rtl language
Last modified: 2007-06-03 06:35:08 UTC
The bug has been described on https://bugs.launchpad.net/ubuntu/+source/gedit/+bug/109723 "Binary package hint: gedit Running Ubuntu 7.04 with the default installation of gedit: I created a file on my desktop called ةجةكصڑڵگڦﭟﯙﻺ (Arabic letters) saved that name then opened it up in gedit. Gedit with the file title text moved to the left (like it should with Arabic characters) but the non arabic part of the title (the bit that says gedit and ~Desktop) is in the wrong place and slightly garbled. This only happens when the first character in the file name is aligned to the right (as with languages like Arabic and Hebrew), but not if the first letter is left aligned (like in standard English) This also happens when file names with Hebrew, Syriac and Thaana letters are used in file names. All characters used in finding this bug were from the Ubuntu Character Map. Screenshot of bug is attached in a comment below. ... http://librarian.launchpad.net/7400249/Bug109723Screenshot.png Screenshot of Bug 109723 Included : Screenshot of Bug 109723"
For me (Ubuntu 7.04) I get txt (~/Desktop) - gedit.ةجةكصڑڵگڦﭟﯙﻺ I don't think that's right, either. Doing the same for a png and opening it in GIMP gives png.ةجةكصڑڵگڦﭟﯙﻺ although Nautilus displays both as ةجةكصڑڵگڦﭟﯙﻺ.whatever (and so does ls). So this probably isn't so much a gimp problem as either a gtk or a metacity problem. I'll investigate further in a bit.
er, sorry, s/a gimp problem/a gedit problem/
I added a couple of lines to metacity to print titles as they were plotted: marnanel@ubuntu:~/proj/metacity/pristine/trunk$ src/metacity --replace Rhybudd rheolydd ffenestri: Setting title to ةجةكصڑڵگڦﭟﯙﻺ.txt (~/Desktop) - gedit Rhybudd rheolydd ffenestri: Setting title to ةجةكصڑڵگڦﭟﯙﻺ.png Rhybudd rheolydd ffenestri: Setting title to Gajim ... So the data's coming through just fine to metacity. So either it's a problem inside metacity or it's a problem in the libraries metacity uses to plot the strings: either way I'm reassigning it to metacity.
Created attachment 89267 [details] [review] Patch to show what titles are being set (for debugging) In case anyone else wants to know how to log window title setting...
Created attachment 89269 [details] [review] Set LTR/RTLness of paragraphs from base widget Aha, we have a solution. Okay, here's what's up. Pango has a concept of the "base direction" of a paragraph, which means whether it lays it out left-to-right or right-to-left. There are two ways it can figure this out, selected using pango_layout_set_auto_dir(). The default is to sniff the content, look for Hebrew or Arabic text early on, and if it finds it, to lay out the paragraph right-to-left; otherwise, to lay out the paragraph left-to-right. This is NOT what we want, and it's what we're getting. The other possibility is to get the direction from the content, i.e. in our case, from the underlying widget. This IS what we want. The patch turns this on. This solves the problem in an LTR locale (English). No problem was reported in an RTL locale, but of course I tested this in an RTL locale (Arabic) too, and it appeared to work as expected. (Bear in mind, however, that I don't speak Arabic or Hebrew, so if anyone who does can help us out here I'd be grateful.) wnck also exhibits this bug, and I'll raise a bug there next.
Committed and FIXED. Bug 443457 is the libwnck bug.
(In reply to comment #5) > The other possibility is to get the direction from the content, i.e. in our ^ from the conteXt (the PangoContext object). Bad typo.