all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: emacs-devel@gnu.org
Subject: Bidirectional text in tooltips
Date: Sat, 06 Nov 2010 16:14:51 +0200	[thread overview]
Message-ID: <838w16o7xg.fsf@gnu.org> (raw)

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.

TIA




             reply	other threads:[~2010-11-06 14:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-06 14:14 Eli Zaretskii [this message]
2010-11-06 17:23 ` Bidirectional text in tooltips Jan Djärv
2010-11-06 17:46   ` Eli Zaretskii
2010-11-06 17:28 ` Jan Djärv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=838w16o7xg.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.