Dov Feldstern wrote:
and I don't have any idea why we need the \rtl flag in lyxrc. Why is
RTL display not derived from the language?
Good question. I guess it should...
I think that the reason for having the flag is just for efficiency: in
the end, the direction *is* determined by the language. However, this
means that you have to check every single letter to determine whether it
belongs to an RTL or LTR language. This is the Bidi algorithm, which was
implemented in LyX by Dekel Tsur, and the implementation is LyX is very
good. However, it is costly. So if we know that we won't be using RTL
languages, it's more efficient to just turn off this flag, and then the
whole Bidi algorithm is skipped.
Yes, looks you're right... thanks for the analysis! But I am pretty sure
that we can optimize that. So I stand on my point, RTL support should be
automatically detected. It is really wrong (and confusing to the user)
to put a check box to avoid some part of the code.
is really bad for this kind of settings.
So yes, the direction is ultimately determined by the language, but
there's still a point in having the flag.
Just in case you're wondering where all this is in the code: I only just
started mapping it out, but basically the Bidi algorithm is implemented
in Bidi.C (surprising, no? ;) ). The actual computation takes place in
Bidi::computeTables. And the first thing there is to check if the flag
is set, and if not, just set an inner flag (don't ask me what the
meaning of the name "start_" is), and immediately return, rather than
performing the costly calculation.
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.
Abdel.