[Top][All Lists]

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

Bidirectional text in tooltips

From: Eli Zaretskii
Subject: Bidirectional text in tooltips
Date: Sat, 06 Nov 2010 16:14:51 +0200

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.


reply via email to

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