00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __ARABICSHAPING_H
00009 #define __ARABICSHAPING_H
00010
00011 #include "LETypes.h"
00012 #include "OpenTypeTables.h"
00013
00014 class Shaper
00015 {
00016 public:
00017 virtual void init(LEUnicode ch, le_int32 outIndex, le_bool isloate) = 0;
00018 virtual void shape(le_int32 outIndex, le_int32 shapeOffset) = 0;
00019 };
00020
00021 class ArabicShaping
00022 {
00023 public:
00024
00025 enum ShapingBitMasks
00026 {
00027 MASK_SHAPE_RIGHT = 1,
00028 MASK_SHAPE_LEFT = 2,
00029 MASK_TRANSPARENT = 4,
00030 MASK_NOSHAPE = 8
00031 };
00032
00033
00034 enum ShapeTypeValues
00035 {
00036 ST_NONE = 0,
00037 ST_RIGHT = MASK_SHAPE_RIGHT,
00038 ST_LEFT = MASK_SHAPE_LEFT,
00039 ST_DUAL = MASK_SHAPE_RIGHT | MASK_SHAPE_LEFT,
00040 ST_TRANSPARENT = MASK_TRANSPARENT,
00041 ST_NOSHAPE_DUAL = MASK_NOSHAPE | ST_DUAL,
00042 ST_NOSHAPE_NONE = MASK_NOSHAPE
00043 };
00044
00045 typedef le_int32 ShapeType;
00046
00047 static void shape(const LEUnicode *chars, le_int32 offset, le_int32 charCount, le_int32 charMax,
00048 le_bool rightToLeft, Shaper &shaper);
00049
00050 static le_uint8 glyphSubstitutionTable[];
00051
00052 static le_uint8 glyphDefinitionTable[];
00053
00054 private:
00055 static ShapeType getShapeType(LEUnicode c);
00056
00057 static const ShapeType shapeTypes[];
00058 };
00059
00060 class GlyphShaper : public Shaper
00061 {
00062 public:
00063 virtual void init(LEUnicode ch, le_int32 outIndex, le_bool isolate);
00064 virtual void shape(le_int32 outIndex, le_int32 shapeOffset);
00065
00066 GlyphShaper(const LETag **outputTags);
00067 ~GlyphShaper();
00068
00069 private:
00070 const LETag **charTags;
00071
00072 static const LETag isolFeatureTag;
00073 static const LETag initFeatureTag;
00074 static const LETag mediFeatureTag;
00075 static const LETag finaFeatureTag;
00076 static const LETag ligaFeatureTag;
00077 static const LETag msetFeatureTag;
00078 static const LETag markFeatureTag;
00079
00080 static const LETag emptyTag;
00081
00082 static const LETag tagArray[];
00083
00084 };
00085
00086 class CharShaper : public Shaper
00087 {
00088 public:
00089 virtual void init(LEUnicode ch, le_int32 outIndex, le_bool isolate);
00090 virtual void shape(le_int32 outIndex, le_int32 shapeOffset);
00091
00092 CharShaper(LEUnicode *outputChars);
00093 ~CharShaper();
00094
00095 private:
00096 LEUnicode *chars;
00097
00098 static LEUnicode isolateShapes[];
00099
00100 static LEUnicode getToIsolateShape(LEUnicode ch);
00101 };
00102
00103
00104 #endif