[Top][All Lists]

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

Re: Persian RTL problem

From: Eli Zaretskii
Subject: Re: Persian RTL problem
Date: Tue, 27 Sep 2011 20:37:46 +0300

> From: mehran khajavi <address@hidden>
> Date: Tue, 27 Sep 2011 15:49:07 +0330
> Cc: address@hidden, address@hidden
> In some buffers for example ERC irc channels RTL doesn't work
> It aligned as Left , Is there any function to set buffer as RTL?
> or is there any option to set if most of the text is in Persian language set
> this line as RTL?

I think you want bidi-paragraph-direction, it's described in the user
manual.  When it is set to its default nil value, Emacs determines the
paragraph direction dynamically from the paragraph contents.  It is
possible that ERC sets this variable to `left-to-right', in which case
all the paragraphs will be aligned to the left.  This is a user
variable, specific to each buffer, so you can change it if the default
does not suit you.

> 2.there is some bugs that I see in Emacs 24 pretest with RTL
> according to attachment , text that bordered with sign "1" should be in
> right of the buffer
> when I enter a blank line and enter the same line it will be aligned in the
> right way(signed as 4)
> after that I entered an English text without blank line (signed as 2),it
> aligned at right but it should be in left

These are all by design.  Emacs does not consider each line a separate
paragraph, because that would look dreadfully in usual Emacs
plain-text buffers that have a newline at the end of each line.
Instead, Emacs implements what the Unicode Bidirectional Algorithm
(UBA) calls "higher protocols" to define paragraph beginning; an empty
line signals a new paragraph.  See the manual for details (node
"Bidirectional Editing").

> numbers of persian language will be aligned at left but it should aligned in
> right(signed as 3)

This is what the UBA mandates.  Arabic numbers are not strong
directional characters, they are weak characters.  Only paragraphs
that begin with a character of type R (strong right-to-left) or AL
(strong right-to-left Arabic) cause the paragraph direction to become
right-to-left.  If you follow the numbers with a Persian letter, the
paragraph will become right-to-left.

Here's the relevant portion from the UBA:

  3.3.1 The Paragraph Level
  P1. Split the text into separate paragraphs. A paragraph separator is kept 
with the previous paragraph. Within each paragraph, apply all the other rules 
of this algorithm.

  P2. In each paragraph, find the first character of type L, AL, or R.

  Because paragraph separators delimit text in this algorithm, this will 
generally be the first strong character after a paragraph separator or at the 
very beginning of the text. Note that the characters of type LRE, LRO, RLE, or 
RLO are ignored in this rule. This is because typically they are used to 
indicate that the embedded text is the opposite direction than the paragraph 

  P3. If a character is found in P2 and it is of type AL or R, then set the 
paragraph embedding level to one; otherwise, set it to zero.

"Paragraph embedding level" being one means the paragraph is aligned
to the right and displayed right to left.


reply via email to

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