summaryrefslogtreecommitdiff
path: root/Build/source/libs/icu-xetex/data/brkitr/line_th.txt
blob: d89498bfd83fc09dae0caf5aed96f897dbfa5a85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# Copyright (c) 2002-2005, International Business Machines Corporation and
# others. All Rights Reserved.
#
#  file:  line.txt
#
#         Line Breaking Rules for ICU rules based break iteration.
#         Implement default line breaking as defined by Unicode TR 14.
#
#         TODO:  Rework the rules not pertaining to Thai to be based on the
#                default line break rules.  Not done yet because of interactions
#                between exact reverse rules and the Dictionary code.
#
#                These rules, in their current form, do not conform to TR-14 for
#                non-Thai breaks.
#

$LF = [\p{LineBreak = LF}];
$IN = [\p{LineBreak = IN}];
$SY = [\p{LineBreak = SY}];
$EX = [\p{LineBreak = EX}];
$BA = [\p{LineBreak = BA}];
$IS = [\p{LineBreak = IS}];
$BB = [\p{LineBreak = BB}];
$SA = [\p{LineBreak = SA}];
$CB = [\p{LineBreak = CB}];
$XX = [\p{LineBreak = XX}];
$HY = [\p{LineBreak = HY}];
$AI = [\p{LineBreak = AI}];
$ZW = [\p{LineBreak = ZW}];
$SG = [\p{LineBreak = SG}];
$AL = [\p{LineBreak = AL}];
$OP = [\p{LineBreak = OP}];
$BK = [\p{LineBreak = BK}];
$PO = [\p{LineBreak = PO}];
$NS = [\p{LineBreak = NS}];
$CL = [\p{LineBreak = CL}];
$NU = [\p{LineBreak = NU}];
$CM = [\p{LineBreak = CM}];
$PR = [\p{LineBreak = PR}];
$B2 = [\p{LineBreak = B2}];
$ID = [\p{LineBreak = ID}];
$SP = [\p{LineBreak = SP}];
$QU = [\p{LineBreak = QU}];
$CR = [\p{LineBreak = CR}];
$GL = [\p{LineBreak = GL}];

$JL = [\p{LineBreak = JL}];
$JV = [\p{LineBreak = JV}];
$JT = [\p{LineBreak = JT}];
$H2 = [\p{LineBreak = H2}];
$H3 = [\p{LineBreak = H3}];


$Extend = [\{p{Grapheme_Cluster_Break = Extend}];


#
#  Thai Dictionary related definitions and rules
#

$dictionary = [\u0e01-\u0e2e \u0e30-\u0e3a \u0e40-\u0e44 \u0e47-\u0e4e];  # this rule breaks the iterator with mixed Thai and English
$paiyannoi  = [\u0e2f];
$maiyamok   = [\u0e46];
$thai_etc   = $paiyannoi \u0e25 $paiyannoi;



#
#  Rule LB1.  By default, treat AI  (characters with ambiguous east Asian width) and
#                               SA  (South East Asian: Thai, Lao, Khmer) as $AL  (Alphabetic)
#
$ALPlus = $AL | $AI | [$SA - $dictionary];

#
#  Combining Marks.   X $CM*  behaves as if it were X.  Rule LB6.
#                     TODO:  This is going to produce some odd results, because of the non-combining
#                            chars that are included in $CM.  Use $Extend instead, where possible.
#
$ALcm = $ALPlus $CM*;
$IDcm = $ID $CM*;
$NUcm = $NU $Extend*;
$HYcm = $HY $Extend*;
$SPcm = $SP $Extend*;
$QUcm = $QU $Extend*;
$POcm = $PO $Extend*;
$OPcm = $OP $Extend*;
$BAcm = $BA $Extend*;
$BBcm = $BB $Extend*;
$NScm = $NS $Extend*;
$GLcm = $GL $Extend*;
$B2cm = $B2 $Extend*;
$INcm = $IN $Extend*;


#  New Lines.  Always break after, never break before.
#              Rule LB 3
#
#  Endings.    NewLine or Zero Width Space, or both.  Rules 4, 5
#              Because we never break before these things, $Endings
#              appears at the end of line break rule.
#
$NLF = $BK | $CR | $LF | $CR $LF;
$Endings = $SPcm* $ZW* $NLF?;
$EndingsMandatory = $SPcm* $NLF | $SPcm* $ZW $NLF?;


#
#  Openings  Sequences that can precede Words, and that should not be separated from them.
#            Rules LB 9, 10
#
$Openings = (($QUcm $SPcm*)? $OPcm $SPcm*)*;

#
#  Closings  Seqences that follow words, and that should not be separated from them,
#            Rule LB 8, 11, 15
$Closings =  ($SPcm*( ($CL ($SPcm* $NScm)?  |  $EX  | $IS  | $SY) $Extend*) | $BAcm | $HYcm  | $NScm | $maiyamok)*;

#
#  Words.  Includes mixed Alpha-numerics.
#          Rules 11a, 16, 17, 19, more or less.
#
$NumberInterior = $IDcm | ($NUcm | $ALcm | $IS $NUcm)+;
$Number         =  $PR? ($OPcm | $HYcm)? $NumberInterior $CL? $POcm?;   # Fancy Number     18
$Word           = (($IDcm | ($ALcm | $NUcm)+) ($POcm? | $INcm?));       # Alpha-numeric.   16, 17
$Dashes         = (($B2cm $SPcm*)*);                                    # Dashes           11a
$ThaiRange      = $dictionary+ | $thai_etc;
$WordLikeThing  = $Number | $Word | $Dashes | $ThaiRange;




$Word15 = ($BBcm* ($WordLikeThing)? ($BAcm | $HYcm | $NScm)*) |     # Rule 15. Stuff sticks around words.
          [^[:Cc:] $BK $CR $LF $ZW $SP $GL] $Extend*  |             # Allow characters that don't meet the
          [^$BK $CR $LF $ZW $SP $GL ];                              #  more elaborate definitions for WORD to be glued.


$GluedWord  = ($GLcm | $QUcm)? $Word15 (($GLcm | $QUcm) $Word15)*;  # "Glue" will stick anything below it together.
                                                                    # Rules 13, 14

#
#  The actual rules, a combination of everything defined above.
#
$Openings $GluedWord  $Closings $paiyannoi? $EndingsMandatory;
$Openings $GluedWord  $Closings  $Endings;

$Openings $GluedWord  $Closings $paiyannoi   / 
               ([^\u0e25 $Extend] | \u0e25[^$paiyannoi $Extend]);


 #"$word($nbsp+$word)*$paiyannoi/([^[\u0e25$_ignore_]]|"
 #                       + "\u0e25[^$paiyannoi$_ignore_]);"

#
# LB 18b.  Do not break a Korean syllable
#
$JL+ $JV* $JT* $Extend*;
$JV+ $JT* $Extend*;
$JT+ $Extend*;
$H2 $JV* $JT* $Extend*;
$H3 $JT* $Extend*;

#
#  Reverse Rules.
#
#     Back up to a hard break or a space that will cause a boundary.
#     Not all spaces cause line breaks.  $SpaceGlue represents a sequence
#     containing a space that may inhibit a break from occuring.
#
$SpaceGlue  = ([$ZW $CL $IS $NS $OP]  ($Extend* $SP)) | (($Extend* $SP)+ $OP);
$ClumpingChars = [^$SP $BK $CR $LF];

!. . $ClumpingChars*  ($SpaceGlue $ClumpingChars*)* (. | $LF $CR);