[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bidirectional text in tooltips

From: Jan Djärv
Subject: Re: Bidirectional text in tooltips
Date: Sat, 06 Nov 2010 18:23:03 +0100
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; sv-SE; rv: Gecko/20101004 Thunderbird/3.1.5

Well, not sure how it is supposed to look, but here are the NS and Gtk+ results. The first image is from NS, but Gtk+ looks the same. The ! has moved to the left, maybe that is intended?

For the second test, the NS does not align the same way Gtk+ does (I added some text to make this clear). I guess NS is wrong here.

        Jan D.

Eli Zaretskii skrev 2010-11-06 15.14:
I have committed to trunk revision 102265, which makes tooltips
support bidirectional text.  I made changes in w32fns.c and in xfns.c.
Only the former is fully tested, for the latter I could only test that
it builds correctly.  Please make sure the X build works as well (you
will find test cases near the end of this mail).

There remain two cases where I don't see in the sources the same code
as in xfns.c and w32fns.c.  One is the GTK build, which under
x_gtk_use_system_tooltips calls xg_prepare_tooltip and
xg_show_tooltip, which use GTK features to display tooltips.  Can
someone see if GTK does TRT when it shows tooltips with bidirectional
text (again, using the text cases below)?  If it doesn't, we will need
to find a way to fix that somehow.

The other case is NS.  IIUC, the place that calculates the width of
the tooltip is the setText method of the EmacsTooltip class,
implemented on nsmenu.m.  My reading of the setText method is that it
assumes a single line of text in the tip, is that right?  If so,
that's a bug in itself, I think.  In any case, if the NS build uses
the string length, it relies on the NS toolkit to DTRT, I think; can
someone please see if the results are satisfactory?

To test bidirectional tooltips, evaluate in "emacs -Q":

   (setq-default bidi-display-reordering t)

and then use these two test cases (copy-paste them into *scratch*):

(x-show-tip "שלום, עולם אכזר ומכוער!")

(x-show-tip "שלום, עולם אכזר ומכוער!

Hello, world!")

The first one should show a one-line tooltip, the second a 3-line
tooltip (with the 2nd line empty).  In both cases, the tooltip should
be just wide enough to display the entire text of each non-empty line.
(With previous code, you'd see an ugly 80-column wide tooltip in both
cases.)  In the second test case, the first line should be flushed all
the way to the right edge of the tooltip, while the last line should
be flushed to the left.


Attachment: ns1.png
Description: PNG image

Attachment: ns2.png
Description: PNG image

Attachment: gtk.png
Description: PNG image

reply via email to

[Prev in Thread] Current Thread [Next in Thread]