Re: Automatic paragraph direction in gtktextlayout
- From: dov imagic weizmann ac il
- To: gtk-i18n-list gnome org, gtk-devel-list gnome org
- Subject: Re: Automatic paragraph direction in gtktextlayout
- Date: Wed, 3 Oct 2001 06:38:54 IST
Owen Taylor writes:
>
> Have you tried putting
>
> gtk-split-cursor = 0
>
> In your ~/.gtkrc-2.0? GTK+ (when XKB is available) can and
> does detect keyboard layout changes. (The only problem
> is it has to reverse engineer the directionality of the
> keyboard layout from the name of the keyboard group.
I just tried it and it works quite nicely, except from some bugs. As
far as the keyboard map name is concerned, it might be a good idea to
request the convention of adding the string "[RTL]" to the name of RTL
layouts. Also I think it would be a good idea to always add arrows to
the cursor, and not only to change their color. Either automatically
if RTL is ever used in the widget, or by a rc setting.
Btw, one more possible use of the keyboard layout would be to change
the directionality of the paragraph. This might be done automatically
for empty paragraphs.
Is it possible to request a keyboard layout change as well through
gdk? There are two possible cases where this might be desired:
1. In the example I gave a couple of months ago where someone
has to fill in the following form:
Native name: ________
Name in latin characters: ________
Here a style should indicate that the native name should be
in the native layout, and the latin character in a latin layout.
2. Clicking the mouse on RTL text in a BiDi text widget could make
the keyboard RTL and likewise for LTR.
> I'm not sure how this would relate to strong directionality
> though ... I guess the GtkTextView could automatically
> insert a LRM if the keyboard was in left to right mode
> and you began a new paragraph with a neutral or storng
> RTL character.
The problem with invisible characters is that they are extremely
difficult to deal with. Where do you place the cursor when you want
to erase a RLM? I just tried inserting a RLM and I really got lost
before I was able to erase it. At the very least there should be
right-button popup option "Display Zero-Width characters" which
should display these characters.
Another possibility would be to define a message signal for the text
viewer, and whenever the cursor would be before a zero-width character,
a message signal would be sent. An application program could then
display this message in an info label, e.g. below the text widget.
Of course a high level protocol could be used to parse the text on
insertion and make paragraphs LTR or RTL style based on the
unicode algorithm. The problem is that this requires support of the
application, and this will not be available for applications that
were not specially written for BiDi.
Another idea is that perhaps paragraph direction should be resolved
only on the insertion of new paragraphs. This would solve the 1000-line
lookup ahead problem.
> [stuff deleted]
> What I would say at this point is:
>
> * I think "same as last paragraph" is a bad idea,
> as well as being unimplementable. Luckily paragraphs
> without any directional characters are rare.
> In such cases, you should just fall back to
> LTR (as suggested by the Unicode algorithm) or
> to the GTK+ global default direction.
>
> * I'm not sure if auto-guessing is a good idea or
> not. The Unicode standard does say that you should
> do it when the directionality is _not_ specified
> by a "higher level protocol". It's not clear
> to me what a higher level protocol is in this
> context exactly.
>
> Since the Text widget certainly _can_ be used to
> display things where directionality is carried
> in markup, you'd at most want to autoguess
> direction if no "direction" attribute applied
> to the current paragraph.
Currently there are two modes of directionality. RTL and LTR. I think
that adding a third mode AUTO that resolved the directionality
according to the first strong character is more in the spirit of
unicode. As far as I understand a "higher level protocol" means some
kind of overriding. I understand that last paragraph mode is
unimplementable, but at least we should according to global
direction. The user should be able to select a paragraph and press
make RTL to change the direction of the paragraph.
I also think it would be good to have an option through which it is
possible to have the text widget add RLM and LRM when exporting the
paragraph. That way when e.g. sending an email, you can be sure that
the paragraphs have the right directionality when received and read.
One example of paragraphs without strong characters is a quoted
empty line. The decision is whether to display it as:
You wrote:
> xx yy xx.
> <- quoted paragraph without strong char
> Xxx yyy
or
:etorw uoY
.xx yy xx <
<
yyy xxx <
I think we need some serious user input at this point. But as I hinted
before, I don't think this issue is serious enough to stop version
2.0, and I wouldn't want to take up to much of Owen's time on it. It
might be a good idea for the BiDi community to write a "BiDi interaction
standards guide". That is also the only chance of getting a concistent
interface across gtk, open office, kde and abiword.
> Regards,
> Owen
>
Regards,
Dov
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]