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
|
/* For use with Bidi Reference Implementation
For more information see the associated file bidi-std.c
Credits:
-------
Written by: Asmus Freytag
Command line interface by: Rick McGowan
Verification (v24): Doug Felt
Disclaimer and legal rights:
---------------------------
Copyright (C) 1999-2009, ASMUS, Inc. All Rights Reserved.
Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE
BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES,
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE SOFTWARE.
*/
#include "mupdf/fitz.h"
/* Bidirectional Character Types
* as defined by the Unicode Bidirectional Algorithm Table 3-7.
* The list of bidirectional character types here is not grouped the
* same way as the table 3-7, since the numeric values for the types
* are chosen to keep the state and action tables compact.
*/
enum
{
/* input types */
/* ON MUST be zero, code relies on ON = N = 0 */
BDI_ON = 0, /* Other Neutral */
BDI_L, /* Left-to-right Letter */
BDI_R, /* Right-to-left Letter */
BDI_AN, /* Arabic Number */
BDI_EN, /* European Number */
BDI_AL, /* Arabic Letter (Right-to-left) */
BDI_NSM, /* Non-spacing Mark */
BDI_CS, /* Common Separator */
BDI_ES, /* European Separator */
BDI_ET, /* European Terminator (post/prefix e.g. $ and %) */
/* resolved types */
BDI_BN, /* Boundary neutral (type of RLE etc after explicit levels)*/
/* input types, */
BDI_S, /* Segment Separator (TAB) used only in L1 */
BDI_WS, /* White space used only in L1 */
BDI_B, /* Paragraph Separator (aka as PS) */
/* types for explicit controls */
BDI_RLO, /* these are used only in X1-X9 */
BDI_RLE,
BDI_LRO,
BDI_LRE,
BDI_PDF,
/* resolved types, also resolved directions */
BDI_N = BDI_ON /* alias, where ON, WS and S are treated the same */
};
void fz_bidi_resolve_neutrals(fz_bidi_level baselevel, fz_bidi_chartype *pcls, const fz_bidi_level *plevel, int cch);
void fz_bidi_resolve_implicit(const fz_bidi_chartype *pcls, fz_bidi_level *plevel, int cch);
void fz_bidi_resolve_weak(fz_context *ctx, fz_bidi_level baselevel, fz_bidi_chartype *pcls, fz_bidi_level *plevel, int cch);
void fz_bidi_resolve_whitespace(fz_bidi_level baselevel, const fz_bidi_chartype *pcls, fz_bidi_level *plevel, int cch);
int fz_bidi_resolve_explicit(fz_bidi_level level, fz_bidi_chartype dir, fz_bidi_chartype *pcls, fz_bidi_level *plevel, int cch, fz_bidi_level nNest);
|