Home | History | Annotate | Download | only in layout
      1 /*
      2  *
      3  * (C) Copyright IBM Corp. 1998-2005 - 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     // Joining types
     25     enum JoiningTypes
     26     {
     27         JT_NON_JOINING   = 0,
     28         JT_JOIN_CAUSING  = 1,
     29         JT_DUAL_JOINING  = 2,
     30         JT_LEFT_JOINING  = 3,
     31         JT_RIGHT_JOINING = 4,
     32         JT_TRANSPARENT   = 5,
     33         JT_COUNT         = 6
     34     };
     35 
     36     // shaping bit masks
     37     enum ShapingBitMasks
     38     {
     39         MASK_SHAPE_RIGHT    = 1, // if this bit set, shapes to right
     40         MASK_SHAPE_LEFT     = 2, // if this bit set, shapes to left
     41         MASK_TRANSPARENT    = 4, // if this bit set, is transparent (ignore other bits)
     42         MASK_NOSHAPE        = 8  // if this bit set, don't shape this char, i.e. tatweel
     43     };
     44 
     45     // shaping values
     46     enum ShapeTypeValues
     47     {
     48         ST_NONE         = 0,
     49         ST_RIGHT        = MASK_SHAPE_RIGHT,
     50         ST_LEFT         = MASK_SHAPE_LEFT,
     51         ST_DUAL         = MASK_SHAPE_RIGHT | MASK_SHAPE_LEFT,
     52         ST_TRANSPARENT  = MASK_TRANSPARENT,
     53         ST_NOSHAPE_DUAL = MASK_NOSHAPE | ST_DUAL,
     54         ST_NOSHAPE_NONE = MASK_NOSHAPE
     55     };
     56 
     57     typedef le_int32 ShapeType;
     58 
     59     static void shape(const LEUnicode *chars, le_int32 offset, le_int32 charCount, le_int32 charMax,
     60                       le_bool rightToLeft, LEGlyphStorage &glyphStorage);
     61 
     62     static const FeatureMap *getFeatureMap(le_int32 &count);
     63 
     64 private:
     65     // forbid instantiation
     66     ArabicShaping();
     67 
     68     static ShapeType getShapeType(LEUnicode c);
     69 
     70     static const le_uint8 shapingTypeTable[];
     71     static const ShapeType shapeTypes[];
     72 
     73     static void adjustTags(le_int32 outIndex, le_int32 shapeOffset, LEGlyphStorage &glyphStorage);
     74 };
     75 
     76 U_NAMESPACE_END
     77 #endif
     78