1 #ifndef MUPDF_BIDI_IMP_H 2 #define MUPDF_BIDI_IMP_H 3 4 /* For use with Bidi Reference Implementation 5 For more information see the associated file bidi-std.c 6 7 Credits: 8 ------- 9 Written by: Asmus Freytag 10 Command line interface by: Rick McGowan 11 Verification (v24): Doug Felt 12 13 Disclaimer and legal rights: 14 --------------------------- 15 Copyright (C) 1999-2009, ASMUS, Inc. All Rights Reserved. 16 Distributed under the Terms of Use in http://www.unicode.org/copyright.html. 17 18 THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 21 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE 22 BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, 23 OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 24 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 25 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE SOFTWARE. 26 */ 27 28 /* Bidirectional Character Types 29 * as defined by the Unicode Bidirectional Algorithm Table 3-7. 30 * The list of bidirectional character types here is not grouped the 31 * same way as the table 3-7, since the numeric values for the types 32 * are chosen to keep the state and action tables compact. 33 */ 34 enum 35 { 36 /* input types */ 37 /* ON MUST be zero, code relies on ON = N = 0 */ 38 BDI_ON = 0, /* Other Neutral */ 39 BDI_L, /* Left-to-right Letter */ 40 BDI_R, /* Right-to-left Letter */ 41 BDI_AN, /* Arabic Number */ 42 BDI_EN, /* European Number */ 43 BDI_AL, /* Arabic Letter (Right-to-left) */ 44 BDI_NSM, /* Non-spacing Mark */ 45 BDI_CS, /* Common Separator */ 46 BDI_ES, /* European Separator */ 47 BDI_ET, /* European Terminator (post/prefix e.g. $ and %) */ 48 49 /* resolved types */ 50 BDI_BN, /* Boundary neutral (type of RLE etc after explicit levels)*/ 51 52 /* input types, */ 53 BDI_S, /* Segment Separator (TAB) used only in L1 */ 54 BDI_WS, /* White space used only in L1 */ 55 BDI_B, /* Paragraph Separator (aka as PS) */ 56 57 /* types for explicit controls */ 58 BDI_RLO, /* these are used only in X1-X9 */ 59 BDI_RLE, 60 BDI_LRO, 61 BDI_LRE, 62 BDI_PDF, 63 64 /* resolved types, also resolved directions */ 65 BDI_N = BDI_ON /* alias, where ON, WS and S are treated the same */ 66 }; 67 68 typedef int fz_bidi_level; /* Note: Max level is 125 */ 69 typedef uint8_t fz_bidi_chartype; 70 71 enum 72 { 73 BIDI_LEVEL_MAX = 125 /* Updated for 6.3.0 */ 74 }; 75 76 void fz_bidi_resolve_neutrals(fz_bidi_level baselevel, fz_bidi_chartype *pcls, const fz_bidi_level *plevel, size_t cch); 77 void fz_bidi_resolve_implicit(const fz_bidi_chartype *pcls, fz_bidi_level *plevel, size_t cch); 78 void fz_bidi_resolve_weak(fz_context *ctx, fz_bidi_level baselevel, fz_bidi_chartype *pcls, fz_bidi_level *plevel, size_t cch); 79 void fz_bidi_resolve_whitespace(fz_bidi_level baselevel, const fz_bidi_chartype *pcls, fz_bidi_level *plevel, size_t cch); 80 size_t fz_bidi_resolve_explicit(fz_bidi_level level, fz_bidi_chartype dir, fz_bidi_chartype *pcls, fz_bidi_level *plevel, size_t cch, fz_bidi_level nNest); 81 size_t fz_bidi_resolve_paragraphs(fz_bidi_chartype *types, size_t cch); 82 83 #endif 84