Draft:Implicit directional marks
The Implicit directional marks are non-printing characters used in the computerized typesetting of bi-directional text containing mixed left-to-right scripts (such as Latin and Cyrillic) and right-to-left scripts (such as Persian, Arabic, Syriac and Hebrew). Unicode defines three such characters, the Left-to-right mark, the Right-to-left mark and the Arabic letter mark.
Unicode
[edit]In Unicode, the Implicit directional mark characters are encoded at U+061C ARABIC LETTER MARK, U+200E LEFT-TO-RIGHT MARK (‎) and U+200F RIGHT-TO-LEFT MARK (‏). In UTF-8 these are D8 9C
, E2 80 8E
and E2 80 8F
respectively.
Usage is prescribed in the Unicode Bidirectional Algorithm.[1]
Example of use in HTML
[edit]LRM
[edit]Suppose the writer wishes to use some English text (a left-to-right script) into a paragraph written in Arabic or Hebrew (a right-to-left script) with non-alphabetic characters to the right of the English text. For example, the writer wants to translate, "The language C++ is a programming language used..." into Arabic. Without an LRM control character, the result looks like this:
لغة C++ هي لغة برمجة تستخدم...
With an LRM entered in the HTML after the ++, it looks like this, as the writer intends:
لغة C++ هي لغة برمجة تستخدم...
In the first example, without an LRM control character, a web browser will render the ++ on the left of the "C" because the browser recognizes that the paragraph is in a right-to-left text (Arabic) and applies punctuation, which is neutral as to its direction, according to the direction of the adjacent text. The LRM control character causes the punctuation to be adjacent to only left-to-right text – the "C" and the LRM – and position as if it were in left-to-right text, i.e., to the right of the preceding text.
RLM
[edit]Suppose instead that the writer wishes to inject a run of Arabic or Hebrew (i.e. right-to-left) text into an English paragraph, with an exclamation point at the end of the run on the left hand side. "I enjoyed staying -- really! -- at his house." With the "really!" in Hebrew, the sentence renders as follows:
I enjoyed staying -- באמת! -- at his house.
(Note that in a computer's memory, the order of the Hebrew characters is ב,א,מ,ת.)
With an RLM added after the exclamation mark, it renders as follows:
I enjoyed staying -- באמת! -- at his house.
(Standards-compliant browsers will render the exclamation mark on the right in the first example, and on the left in the second.)
This happens because the browser recognizes that the paragraph is in a LTR script (Latin), and applies punctuation, which is neutral as to its direction, in coordination with the surrounding (left-to-right) text. The RLM causes the punctuation to be surrounded by only RTL text—the Hebrew and the RLM—and hence be positioned as if it were in right-to-left text, i.e., to the left of the preceding text.
ALM
[edit]Similar to the right-to-left mark (RLM), it is used to change the way adjacent characters are grouped with respect to text direction, with some difference on how it affects the bidirectional level resolutions for nearby characters.
See also
[edit]References
[edit]- ^ UNICODE 12.0 Standard, http://www.unicode.org/versions/Unicode12.0.0/UnicodeStandard-12.0.pdf, p. 880
External links
[edit]- Proposal to encode the Arabic Letter Mark (ALM)
- Unicode standard annex #9: The bidirectional algorithm
- Unicode character (U+061C)
- Unicode character (U+200F)
- Unicode character (U+200E)