1 | // Copyright 2014 The Flutter Authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. |
4 | |
5 | /// Constants for useful Unicode characters. |
6 | /// |
7 | /// Currently, these characters are all related to bidirectional text. |
8 | /// |
9 | /// See also: |
10 | /// |
11 | /// * <http://unicode.org/reports/tr9/>, which describes the Unicode |
12 | /// bidirectional text algorithm. |
13 | abstract final class Unicode { |
14 | /// `U+202A LEFT-TO-RIGHT EMBEDDING` |
15 | /// |
16 | /// Treat the following text as embedded left-to-right. |
17 | /// |
18 | /// Use [PDF] to end the embedding. |
19 | static const String LRE = '\u202A' ; |
20 | |
21 | /// `U+202B RIGHT-TO-LEFT EMBEDDING` |
22 | /// |
23 | /// Treat the following text as embedded right-to-left. |
24 | /// |
25 | /// Use [PDF] to end the embedding. |
26 | static const String RLE = '\u202B' ; |
27 | |
28 | /// `U+202C POP DIRECTIONAL FORMATTING` |
29 | /// |
30 | /// End the scope of the last [LRE], [RLE], [RLO], or [LRO]. |
31 | static const String PDF = '\u202C' ; |
32 | |
33 | /// `U+202A LEFT-TO-RIGHT OVERRIDE` |
34 | /// |
35 | /// Force following characters to be treated as strong left-to-right characters. |
36 | /// |
37 | /// For example, this causes Hebrew text to render backwards. |
38 | /// |
39 | /// Use [PDF] to end the override. |
40 | static const String LRO = '\u202D' ; |
41 | |
42 | /// `U+202B RIGHT-TO-LEFT OVERRIDE` |
43 | /// |
44 | /// Force following characters to be treated as strong right-to-left characters. |
45 | /// |
46 | /// For example, this causes English text to render backwards. |
47 | /// |
48 | /// Use [PDF] to end the override. |
49 | static const String RLO = '\u202E' ; |
50 | |
51 | /// `U+2066 LEFT-TO-RIGHT ISOLATE` |
52 | /// |
53 | /// Treat the following text as isolated and left-to-right. |
54 | /// |
55 | /// Use [PDI] to end the isolated scope. |
56 | static const String LRI = '\u2066' ; |
57 | |
58 | /// `U+2067 RIGHT-TO-LEFT ISOLATE` |
59 | /// |
60 | /// Treat the following text as isolated and right-to-left. |
61 | /// |
62 | /// Use [PDI] to end the isolated scope. |
63 | static const String RLI = '\u2067' ; |
64 | |
65 | /// `U+2068 FIRST STRONG ISOLATE` |
66 | /// |
67 | /// Treat the following text as isolated and in the direction of its first |
68 | /// strong directional character that is not inside a nested isolate. |
69 | /// |
70 | /// This essentially "auto-detects" the directionality of the text. It is not |
71 | /// 100% reliable. For example, Arabic text that starts with an English quote |
72 | /// will be detected as LTR, not RTL, which will lead to the text being in a |
73 | /// weird order. |
74 | /// |
75 | /// Use [PDI] to end the isolated scope. |
76 | static const String FSI = '\u2068' ; |
77 | |
78 | /// `U+2069 POP DIRECTIONAL ISOLATE` |
79 | /// |
80 | /// End the scope of the last [LRI], [RLI], or [FSI]. |
81 | static const String PDI = '\u2069' ; |
82 | |
83 | /// `U+200E LEFT-TO-RIGHT MARK` |
84 | /// |
85 | /// Left-to-right zero-width character. |
86 | static const String LRM = '\u200E' ; |
87 | |
88 | /// `U+200F RIGHT-TO-LEFT MARK` |
89 | /// |
90 | /// Right-to-left zero-width non-Arabic character. |
91 | static const String RLM = '\u200F' ; |
92 | |
93 | /// `U+061C ARABIC LETTER MARK` |
94 | /// |
95 | /// Right-to-left zero-width Arabic character. |
96 | static const String ALM = '\u061C' ; |
97 | } |
98 | |