[Top][All Lists]

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

Re: Unicode support

From: Roozbeh Pournader
Subject: Re: Unicode support
Date: Wed, 25 Jul 2001 14:14:02 +0430 (IRDT)

On Wed, 25 Jul 2001, Eli Zaretskii wrote:

> > What I believe to be the best experiment for the user, is having something
> > like a U+200D ZERO WIDTH JOINER move with the cursor: when she presses a
> > new "letter", remove the last ZWJ (if it exists), add the character to the
> > buffer, add the ZWJ, and reshape. If she typed a non-letter, remove the
> > ZWJ, add the new character, and reshape. Because the letters are much more
> > frequent than non-letter, this strategy will minimize the change of the
> > shapes on the screen (which is good for many things, from the
> > communication software, to the users's eyes).
> Changing shape after each typed character will probably have
> undesirable effects on many optimizations used by the Emacs redisplay
> engine, specifically those for inserting a single character.  That's
> why I suggested to go about it as we do with just-in-time font-lock,
> i.e. defer them a bit.

Please note that this is not changing shape after each typed character.
This is the minimum number of shape changing. This is only changing shape
after each non-letter that follows a letter. I think this should suit an
editor like emacs best.

Also, you don't need to implement it in the same way I mentioned. That was
only for behaviour explanation, specially for those who have worked with
MS tools. Even in a new editor, I won't implement it that way, removing
and reinserting the ZWJ, and reshaping the whole line each time. I will do
something like this for insertion (there is also a need for next_arabic, but
let's forget about it for now):

if (previous_action != INSERTION) {
    last_arabic = compute_last_arabic();
    last_shape = shape(last_arabic);
    join = (last_shape == INITIAL || last_shape == MEDIAL);

if (is_arabic_letter(key)) {
    join = insert_into_buffer(key, join);
    /* join is true if the last letter has been left-joining */
    last_arabic = last_buffer_index();
else if (is_non_spacing_mark(key)) {
else {
    join = FALSE;
    last_arabic = NOTHING;

With the above code, you only need to change the shape in the 'reshape'
function. When you insert a new character, you insert it with the most
probable shape, so the need for change minimizes...


reply via email to

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