Dov Feldstern wrote:
Abdelrazak Younes wrote:
It's not so bad, really, when you think about it. If I'm a user who uses
a Bidi language, then I know when I first install LyX, to set RTL to
true, and I'm done --- never have to think about it again.
I disagree here, even a normally non RTL user should be able to
correctly visualize a document containing some RTL text. But I agree
with what you say below:
OTOH, I guess it's really not so bad to just do the calculation all the
time. I mean, I have this switch on, and I don't feel that it slows me
down or anything. Maybe the option could be reversed --- by default,
have RTL support on, and allow users who happen to be working on really
slow machines and who do not use RTL languages to turn it off. For
everyone else, it probably doesn't really make a difference. (I guess
that profiling could be used to see how costly it really is.)
Also --- not that this is necessarily any proof that it's good ---
OpenOffice has the same kind of setting, somewhere.
So, if we don't manage to optimize the Bidi table calculation enough, we
can do this indeed: enable RTL by default and provide a way to disable
it in some performance settings dialog.
[...]
I am sure that we can intelligently avoid the calculation in an
automated way by looking at the unicode code-point. That's actually
the big point of unicode.
I don't understand what you mean. In order to determine if there's any
RTL letter, I have to look at every letter in the paragraph. Which I
don't have to do if I know ahead of time that there's no RTL language
there. I think that that's the time saved.
No, the time is saved when you don't have to compute the lookup tables.
In pre-unicode time (LyX < 1.5), we used a single byte for any language
including Hebrew and Arabic (and sometimes two chars for Arabic for
special composite shaping). We then need to know in advance the language
of the paragraph. Per letter distinction was not possible because a
letter could be interpreted differently depending of the encoding.
Unicode only helps me once
I'm looking at the letter. Am I missing something?
I think so. With Unicode, the character set is fixed and we have a range
reserved for Hebrew letters and another range reserved for Arabic
letters. Testing for Arabic is as simple as that:
bool is_arabic(char_type c)
{
return c >= 0x0600 /*1536*/ && c <= 0x06FF /*1791*/;
}
Abdel.