os/textandloc/fontservices/textshaperplugin/IcuSource/common/ubidi_props.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
*******************************************************************************
sl@0
     3
*
sl@0
     4
*   Copyright (C) 2004-2005, International Business Machines
sl@0
     5
*   Corporation and others.  All Rights Reserved.
sl@0
     6
*
sl@0
     7
*******************************************************************************
sl@0
     8
*   file name:  ubidi_props.h
sl@0
     9
*   encoding:   US-ASCII
sl@0
    10
*   tab size:   8 (not used)
sl@0
    11
*   indentation:4
sl@0
    12
*
sl@0
    13
*   created on: 2004dec30
sl@0
    14
*   created by: Markus W. Scherer
sl@0
    15
*
sl@0
    16
*   Low-level Unicode bidi/shaping properties access.
sl@0
    17
*/
sl@0
    18
sl@0
    19
#ifndef __UBIDI_PROPS_H__
sl@0
    20
#define __UBIDI_PROPS_H__
sl@0
    21
sl@0
    22
#include "unicode/utypes.h"
sl@0
    23
#include "unicode/uset.h"
sl@0
    24
#include "uset_imp.h"
sl@0
    25
#include "udataswp.h"
sl@0
    26
sl@0
    27
U_CDECL_BEGIN
sl@0
    28
sl@0
    29
/* library API -------------------------------------------------------------- */
sl@0
    30
sl@0
    31
struct UBiDiProps;
sl@0
    32
typedef struct UBiDiProps UBiDiProps;
sl@0
    33
sl@0
    34
U_CAPI UBiDiProps * U_EXPORT2
sl@0
    35
ubidi_openProps(UErrorCode *pErrorCode);
sl@0
    36
sl@0
    37
U_CAPI UBiDiProps * U_EXPORT2
sl@0
    38
ubidi_openBinary(const uint8_t *bin, int32_t length, UErrorCode *pErrorCode);
sl@0
    39
sl@0
    40
U_CAPI void U_EXPORT2
sl@0
    41
ubidi_closeProps(UBiDiProps *bdp);
sl@0
    42
sl@0
    43
sl@0
    44
U_CAPI const UBiDiProps * U_EXPORT2
sl@0
    45
ubidi_getSingleton(UErrorCode *pErrorCode);
sl@0
    46
sl@0
    47
/**
sl@0
    48
 * Get a singleton dummy object, one that works with no real data.
sl@0
    49
 * This can be used when the real data is not available.
sl@0
    50
 * Using the dummy can reduce checks for available data after an initial failure.
sl@0
    51
 */
sl@0
    52
U_CAPI const UBiDiProps * U_EXPORT2
sl@0
    53
ubidi_getDummy(UErrorCode *pErrorCode);
sl@0
    54
sl@0
    55
sl@0
    56
U_CAPI int32_t U_EXPORT2
sl@0
    57
ubidi_swap(const UDataSwapper *ds,
sl@0
    58
           const void *inData, int32_t length, void *outData,
sl@0
    59
           UErrorCode *pErrorCode);
sl@0
    60
sl@0
    61
U_CAPI void U_EXPORT2
sl@0
    62
ubidi_addPropertyStarts(const UBiDiProps *bdp, const USetAdder *sa, UErrorCode *pErrorCode);
sl@0
    63
sl@0
    64
/* property access functions */
sl@0
    65
sl@0
    66
U_CFUNC int32_t
sl@0
    67
ubidi_getMaxValue(const UBiDiProps *bdp, UProperty which);
sl@0
    68
sl@0
    69
U_CAPI UCharDirection U_EXPORT2
sl@0
    70
ubidi_getClass(const UBiDiProps *bdp, UChar32 c);
sl@0
    71
sl@0
    72
U_CAPI UBool U_EXPORT2
sl@0
    73
ubidi_isMirrored(const UBiDiProps *bdp, UChar32 c);
sl@0
    74
sl@0
    75
U_CAPI UChar32 U_EXPORT2
sl@0
    76
ubidi_getMirror(const UBiDiProps *bdp, UChar32 c);
sl@0
    77
sl@0
    78
U_CAPI UBool U_EXPORT2
sl@0
    79
ubidi_isBidiControl(const UBiDiProps *bdp, UChar32 c);
sl@0
    80
sl@0
    81
U_CAPI UBool U_EXPORT2
sl@0
    82
ubidi_isJoinControl(const UBiDiProps *bdp, UChar32 c);
sl@0
    83
sl@0
    84
U_CAPI UJoiningType U_EXPORT2
sl@0
    85
ubidi_getJoiningType(const UBiDiProps *bdp, UChar32 c);
sl@0
    86
sl@0
    87
U_CAPI UJoiningGroup U_EXPORT2
sl@0
    88
ubidi_getJoiningGroup(const UBiDiProps *bdp, UChar32 c);
sl@0
    89
sl@0
    90
/* file definitions --------------------------------------------------------- */
sl@0
    91
sl@0
    92
#define UBIDI_DATA_NAME "ubidi"
sl@0
    93
#define UBIDI_DATA_TYPE "icu"
sl@0
    94
sl@0
    95
/* format "BiDi" */
sl@0
    96
#define UBIDI_FMT_0 0x42
sl@0
    97
#define UBIDI_FMT_1 0x69
sl@0
    98
#define UBIDI_FMT_2 0x44
sl@0
    99
#define UBIDI_FMT_3 0x69
sl@0
   100
sl@0
   101
/* indexes into indexes[] */
sl@0
   102
enum {
sl@0
   103
    UBIDI_IX_INDEX_TOP,
sl@0
   104
    UBIDI_IX_LENGTH,
sl@0
   105
    UBIDI_IX_TRIE_SIZE,
sl@0
   106
    UBIDI_IX_MIRROR_LENGTH,
sl@0
   107
sl@0
   108
    UBIDI_IX_JG_START,
sl@0
   109
    UBIDI_IX_JG_LIMIT,
sl@0
   110
sl@0
   111
    UBIDI_MAX_VALUES_INDEX=15,
sl@0
   112
    UBIDI_IX_TOP=16
sl@0
   113
};
sl@0
   114
sl@0
   115
/* definitions for 16-bit bidi/shaping properties word ---------------------- */
sl@0
   116
sl@0
   117
enum {
sl@0
   118
 /* UBIDI_CLASS_SHIFT=0, */     /* bidi class: 5 bits (4..0) */
sl@0
   119
    UBIDI_JT_SHIFT=5,           /* joining type: 3 bits (7..5) */
sl@0
   120
sl@0
   121
    /* UBIDI__SHIFT=8, reserved: 2 bits (9..8) */
sl@0
   122
sl@0
   123
    UBIDI_JOIN_CONTROL_SHIFT=10,
sl@0
   124
    UBIDI_BIDI_CONTROL_SHIFT=11,
sl@0
   125
sl@0
   126
    UBIDI_IS_MIRRORED_SHIFT=12,         /* 'is mirrored' */
sl@0
   127
    UBIDI_MIRROR_DELTA_SHIFT=13,        /* bidi mirroring delta: 3 bits (15..13) */
sl@0
   128
sl@0
   129
    UBIDI_MAX_JG_SHIFT=16               /* max JG value in indexes[UBIDI_MAX_VALUES_INDEX] bits 23..16 */
sl@0
   130
};
sl@0
   131
sl@0
   132
#define UBIDI_CLASS_MASK        0x0000001f
sl@0
   133
#define UBIDI_JT_MASK           0x000000e0
sl@0
   134
sl@0
   135
#define UBIDI_MAX_JG_MASK       0x00ff0000
sl@0
   136
sl@0
   137
#define UBIDI_GET_CLASS(props) ((props)&UBIDI_CLASS_MASK)
sl@0
   138
#define UBIDI_GET_FLAG(props, shift) (((props)>>(shift))&1)
sl@0
   139
sl@0
   140
enum {
sl@0
   141
    UBIDI_ESC_MIRROR_DELTA=-4,
sl@0
   142
    UBIDI_MIN_MIRROR_DELTA=-3,
sl@0
   143
    UBIDI_MAX_MIRROR_DELTA=3
sl@0
   144
};
sl@0
   145
sl@0
   146
/* definitions for 32-bit mirror table entry -------------------------------- */
sl@0
   147
sl@0
   148
enum {
sl@0
   149
    /* the source Unicode code point takes 21 bits (20..0) */
sl@0
   150
    UBIDI_MIRROR_INDEX_SHIFT=21,
sl@0
   151
    UBIDI_MAX_MIRROR_INDEX=0x7ff
sl@0
   152
};
sl@0
   153
sl@0
   154
#define UBIDI_GET_MIRROR_CODE_POINT(m) (UChar32)((m)&0x1fffff)
sl@0
   155
sl@0
   156
#define UBIDI_GET_MIRROR_INDEX(m) ((m)>>UBIDI_MIRROR_INDEX_SHIFT)
sl@0
   157
sl@0
   158
U_CDECL_END
sl@0
   159
sl@0
   160
#endif