libunibreak 8.0
Loading...
Searching...
No Matches
linebreakdef.h
Go to the documentation of this file.
1/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
2
3/*
4 * Line breaking in a Unicode sequence. Designed to be used in a
5 * generic text renderer.
6 *
7 * Copyright (C) 2008-2026 Wu Yongwei <wuyongwei at gmail dot com>
8 * Copyright (C) 2013 Petr Filipsky <philodej at gmail dot com>
9 *
10 * This software is provided 'as-is', without any express or implied
11 * warranty. In no event will the author be held liable for any damages
12 * arising from the use of this software.
13 *
14 * Permission is granted to anyone to use this software for any purpose,
15 * including commercial applications, and to alter it and redistribute
16 * it freely, subject to the following restrictions:
17 *
18 * 1. The origin of this software must not be misrepresented; you must
19 * not claim that you wrote the original software. If you use this
20 * software in a product, an acknowledgement in the product
21 * documentation would be appreciated but is not required.
22 * 2. Altered source versions must be plainly marked as such, and must
23 * not be misrepresented as being the original software.
24 * 3. This notice may not be removed or altered from any source
25 * distribution.
26 *
27 * The main reference is Unicode Standard Annex 14 (UAX #14):
28 * <URL:http://www.unicode.org/reports/tr14/>
29 *
30 * When this library was designed, this annex was at Revision 19, for
31 * Unicode 5.0.0:
32 * <URL:http://www.unicode.org/reports/tr14/tr14-19.html>
33 *
34 * This library has been updated according to Revision 55, for
35 * Unicode 17.0.0:
36 * <URL:http://www.unicode.org/reports/tr14/tr14-55.html>
37 *
38 * The Unicode Terms of Use are available at
39 * <URL:http://www.unicode.org/copyright.html>
40 */
41
51
52#ifndef LINEBREAKDEF_H
53#define LINEBREAKDEF_H
54
55#include "unibreakdef.h"
56
62{
63 /* This is used to signal an error condition. */
65
66 /* The following break classes are treated in the pair table. */
99
100 /* The following break classes are treated in the pair table, but
101 * they are not part of Table 2 of UAX #14-37. */
109
110 /* The following break classes are not treated in the pair table */
121};
122
135
148
154
165
176
182{
183 const char *lang;
184 size_t namelen;
185 const struct LineBreakProperties *lbp;
186};
187
197{
198 /* --- Hot state (touched on every character) --- */
201 size_t posLast;
208
209 bool fLb8aZwj;
214
215 bool fLangCjk;
221 bool fPrevEA;
223
224 /* --- Lookahead-fixup state (rarely used) --- */
225 size_t posPending;
230};
231
232/* Declarations */
233extern const struct LineBreakProperties lb_prop_supplementary[];
234extern const unsigned int lb_prop_supplementary_len;
235extern const char lb_prop_bmp[];
236extern const struct LineBreakPropertiesLang lb_prop_lang_map[];
237
238#endif /* LINEBREAKDEF_H */
const unsigned int lb_prop_supplementary_len
Definition linebreakdata.c:791
const char lb_prop_bmp[]
Line breaking properties for BMP.
Definition linebreakdata.c:795
const struct LineBreakProperties lb_prop_supplementary[]
Line breaking properties for supplementary planes.
Definition linebreakdata.c:9
const struct LineBreakPropertiesLang lb_prop_lang_map[]
Association data of language-specific line breaking properties with language names.
Definition linebreakdef.c:120
Lb25State
LB25 state for numeric expression context tracking.
Definition linebreakdef.h:128
@ LB25_PREFIX
Seen PR or PO (prefix).
Definition linebreakdef.h:130
@ LB25_PREFIXOP
Saw (PR|PO) then OP or HY.
Definition linebreakdef.h:131
@ LB25_NUM
Inside NU (NU|SY|IS)*.
Definition linebreakdef.h:132
@ LB25_NUMCLOSE
Saw NU (NU|SY|IS)* (CL|CP).
Definition linebreakdef.h:133
@ LB25_NONE
Not in numeric expression.
Definition linebreakdef.h:129
LineBreakClass
Line break classes.
Definition linebreakdef.h:62
@ LBP_WJ
Word joiner.
Definition linebreakdef.h:89
@ LBP_GL
Glue.
Definition linebreakdef.h:71
@ LBP_VI
Virama.
Definition linebreakdef.h:106
@ LBP_CL
Closing punctuation.
Definition linebreakdef.h:68
@ LBP_NS
Non-starters.
Definition linebreakdef.h:72
@ LBP_RI
Regional indicator.
Definition linebreakdef.h:95
@ LBP_AK
Aksara.
Definition linebreakdef.h:102
@ LBP_ID
Ideographic.
Definition linebreakdef.h:81
@ LBP_JL
Hangul L Jamo.
Definition linebreakdef.h:92
@ LBP_SA
South-East Asian.
Definition linebreakdef.h:117
@ LBP_AS
Aksara Start.
Definition linebreakdef.h:104
@ LBP_B2
Break on either side (but not pair).
Definition linebreakdef.h:86
@ LBP_SY
Symbols allowing break after.
Definition linebreakdef.h:74
@ LBP_CB
Contingent break.
Definition linebreakdef.h:108
@ LBP_XX
Unknown.
Definition linebreakdef.h:120
@ LBP_EM
Emoji modifier.
Definition linebreakdef.h:97
@ LBP_CJ
Conditional Japanese starter.
Definition linebreakdef.h:113
@ LBP_ZWJ
Zero width joiner.
Definition linebreakdef.h:98
@ LBP_EX
Exclamation/Interrogation.
Definition linebreakdef.h:73
@ LBP_SP
Space.
Definition linebreakdef.h:119
@ LBP_JV
Hangul V Jamo.
Definition linebreakdef.h:93
@ LBP_JT
Hangul T Jamo.
Definition linebreakdef.h:94
@ LBP_BK
Break (mandatory).
Definition linebreakdef.h:112
@ LBP_HY
Hyphen.
Definition linebreakdef.h:83
@ LBP_NU
Numeric.
Definition linebreakdef.h:78
@ LBP_BA
Break after.
Definition linebreakdef.h:84
@ LBP_H2
Hangul LV.
Definition linebreakdef.h:90
@ LBP_EB
Emoji base.
Definition linebreakdef.h:96
@ LBP_CR
Carriage return.
Definition linebreakdef.h:114
@ LBP_Undefined
Undefined.
Definition linebreakdef.h:64
@ LBP_HH
Unambiguous Hyphen.
Definition linebreakdef.h:107
@ LBP_LF
Line feed.
Definition linebreakdef.h:115
@ LBP_PR
Prefix.
Definition linebreakdef.h:76
@ LBP_BB
Break before.
Definition linebreakdef.h:85
@ LBP_IS
Infix separator.
Definition linebreakdef.h:75
@ LBP_AL
Alphabetic.
Definition linebreakdef.h:79
@ LBP_ZW
Zero-width space.
Definition linebreakdef.h:87
@ LBP_VF
Virama Final.
Definition linebreakdef.h:105
@ LBP_HL
Hebrew letter.
Definition linebreakdef.h:80
@ LBP_QU
Ambiguous quotation.
Definition linebreakdef.h:70
@ LBP_CP
Closing parenthesis.
Definition linebreakdef.h:69
@ LBP_PO
Postfix.
Definition linebreakdef.h:77
@ LBP_AI
Ambiguous (alphabetic or ideograph).
Definition linebreakdef.h:111
@ LBP_OP
Opening punctuation.
Definition linebreakdef.h:67
@ LBP_NL
Next line.
Definition linebreakdef.h:116
@ LBP_SG
Surrogates.
Definition linebreakdef.h:118
@ LBP_CM
Combining marks.
Definition linebreakdef.h:88
@ LBP_IN
Inseparable characters.
Definition linebreakdef.h:82
@ LBP_H3
Hangul LVT.
Definition linebreakdef.h:91
@ LBP_AP
Aksara Pre-Base.
Definition linebreakdef.h:103
PendingRule
Identifies which lookahead rule currently has a tentative break pending resolution by the next charac...
Definition linebreakdef.h:141
@ PENDING_LB15B
LB15b: tentative break before a Pf&QU.
Definition linebreakdef.h:143
@ PENDING_LB15C
LB15c: tentative break before IS after SP.
Definition linebreakdef.h:144
@ PENDING_LB28A4
LB28a sub-rule 4: tentative break after aksara.
Definition linebreakdef.h:146
@ PENDING_LB19A
LB19a: tentative break before a Pi&QU.
Definition linebreakdef.h:145
@ PENDING_NONE
No pending tentative break.
Definition linebreakdef.h:142
BreakOutputType
Definition linebreakdef.h:150
@ LBOT_PER_CODE_UNIT
Definition linebreakdef.h:151
@ LBOT_PER_CODE_POINT
Definition linebreakdef.h:152
Struct for entries of auxiliary line breaking properties derived from the General_Category property.
Definition linebreakdef.h:172
utf32_t start
Start codepoint.
Definition linebreakdef.h:173
utf32_t end
End codepoint, inclusive.
Definition linebreakdef.h:174
Context representing internal state of the line breaking algorithm.
Definition linebreakdef.h:197
bool fLb28aAkVi
(AK|◌|AS) VI seen (LB28a)
Definition linebreakdef.h:213
bool fQuPrevEA
Char before previous QU is East Asian.
Definition linebreakdef.h:222
enum Lb25State eLb25
LB25 state for numeric expression.
Definition linebreakdef.h:206
bool fLb28aPrevAksara
Previous char is aksara (LB28a).
Definition linebreakdef.h:212
bool fPrevPotentialEmoji
Previous char is potential emoji.
Definition linebreakdef.h:217
bool fLb8aZwj
Flag for ZWJ (LB8a).
Definition linebreakdef.h:209
size_t posLast
Last position in input string.
Definition linebreakdef.h:201
enum LineBreakClass lbcCur
Breaking class of current codepoint.
Definition linebreakdef.h:202
bool fPrevQuPf
Previous char is QU of class Pf.
Definition linebreakdef.h:220
bool fLb25Mark
Flag for pending fixup.
Definition linebreakdef.h:227
bool fLangStrict
-strict suffix
Definition linebreakdef.h:216
bool fPrevEA
Previous char is East Asian.
Definition linebreakdef.h:221
enum PendingRule ePending
Pending lookahead rule.
Definition linebreakdef.h:205
int cLb30aRI
Count of RI characters (LB30a).
Definition linebreakdef.h:207
bool fLangCjk
zh/ja/ko language
Definition linebreakdef.h:215
size_t posPending
Position of tentative break.
Definition linebreakdef.h:225
enum LineBreakClass lbcNew
Breaking class of next codepoint.
Definition linebreakdef.h:203
bool fLb21aHebrew
Flag for Hebrew letters (LB21a).
Definition linebreakdef.h:210
bool fQuPiInitial
Previous Pi QU is in initial context.
Definition linebreakdef.h:218
enum LineBreakClass lbcLast
Breaking class of last codepoint.
Definition linebreakdef.h:204
bool fPendingRevert
Flag for pending revert.
Definition linebreakdef.h:229
const struct LineBreakProperties * lbpLang
Pointer to LineBreakProperties.
Definition linebreakdef.h:199
char cPendingOrigBrk
Break value to restore on revert.
Definition linebreakdef.h:228
size_t posLb25Fixup
Position to fix for LB25.
Definition linebreakdef.h:226
bool fLb20aWordInit
Previous char is word-initial hyphen.
Definition linebreakdef.h:211
bool fPrevQuPi
Previous char is QU of class Pi.
Definition linebreakdef.h:219
Struct for association of language-specific line breaking properties with language names.
Definition linebreakdef.h:182
size_t namelen
Length of name to match.
Definition linebreakdef.h:184
const struct LineBreakProperties * lbp
Pointer to associated data.
Definition linebreakdef.h:185
const char * lang
Language name.
Definition linebreakdef.h:183
Struct for entries of line break properties.
Definition linebreakdef.h:160
utf32_t start
Start codepoint.
Definition linebreakdef.h:161
enum LineBreakClass prop
The line breaking property.
Definition linebreakdef.h:163
utf32_t end
End codepoint, inclusive.
Definition linebreakdef.h:162
unsigned int utf32_t
Type for UTF-32 data points.
Definition unibreakbase.h:49
Header file for private definitions in the libunibreak library.