| 1 | /* |
| 2 | * |
| 3 | * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved |
| 4 | * |
| 5 | */ |
| 6 | |
| 7 | #ifndef __ARABICSHAPING_H |
| 8 | #define __ARABICSHAPING_H |
| 9 | |
| 10 | /** |
| 11 | * \file |
| 12 | * \internal |
| 13 | */ |
| 14 | |
| 15 | #include "LETypes.h" |
| 16 | #include "OpenTypeTables.h" |
| 17 | |
| 18 | U_NAMESPACE_BEGIN |
| 19 | |
| 20 | class LEGlyphStorage; |
| 21 | |
| 22 | class ArabicShaping /* not : public UObject because all methods are static */ { |
| 23 | public: |
| 24 | // shaping bit masks |
| 25 | enum ShapingBitMasks |
| 26 | { |
| 27 | MASK_SHAPE_RIGHT = 1, // if this bit set, shapes to right |
| 28 | MASK_SHAPE_LEFT = 2, // if this bit set, shapes to left |
| 29 | MASK_TRANSPARENT = 4, // if this bit set, is transparent (ignore other bits) |
| 30 | MASK_NOSHAPE = 8 // if this bit set, don't shape this char, i.e. tatweel |
| 31 | }; |
| 32 | |
| 33 | // shaping values |
| 34 | enum ShapeTypeValues |
| 35 | { |
| 36 | ST_NONE = 0, |
| 37 | ST_RIGHT = MASK_SHAPE_RIGHT, |
| 38 | ST_LEFT = MASK_SHAPE_LEFT, |
| 39 | ST_DUAL = MASK_SHAPE_RIGHT | MASK_SHAPE_LEFT, |
| 40 | ST_TRANSPARENT = MASK_TRANSPARENT, |
| 41 | ST_NOSHAPE_DUAL = MASK_NOSHAPE | ST_DUAL, |
| 42 | ST_NOSHAPE_NONE = MASK_NOSHAPE |
| 43 | }; |
| 44 | |
| 45 | typedef le_int32 ShapeType; |
| 46 | |
| 47 | static void shape(const LEUnicode *chars, le_int32 offset, le_int32 charCount, le_int32 charMax, |
| 48 | le_bool rightToLeft, LEGlyphStorage &glyphStorage); |
| 49 | |
| 50 | static const LETag *getFeatureOrder(); |
| 51 | |
| 52 | private: |
| 53 | // forbid instantiation |
| 54 | ArabicShaping(); |
| 55 | |
| 56 | static const LETag tagArray[]; |
| 57 | |
| 58 | static ShapeType getShapeType(LEUnicode c); |
| 59 | |
| 60 | static const ShapeType shapeTypes[]; |
| 61 | |
| 62 | static void adjustTags(le_int32 outIndex, le_int32 shapeOffset, LEGlyphStorage &glyphStorage); |
| 63 | }; |
| 64 | |
| 65 | U_NAMESPACE_END |
| 66 | #endif |