00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __OPENTYPELAYOUTENGINE_H
00010 #define __OPENTYPELAYOUTENGINE_H
00011
00012 #include "LETypes.h"
00013 #include "LEGlyphFilter.h"
00014 #include "LEFontInstance.h"
00015 #include "LayoutEngine.h"
00016
00017 #include "GlyphSubstitutionTables.h"
00018 #include "GlyphDefinitionTables.h"
00019 #include "GlyphPositioningTables.h"
00020
00021 #include "cmemory.h"
00022
00023 U_NAMESPACE_BEGIN
00024
00050 class OpenTypeLayoutEngine : public LayoutEngine
00051 {
00052 public:
00069 OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
00070 const GlyphSubstitutionTableHeader *gsubTable);
00071
00082 OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode);
00083
00089 virtual ~OpenTypeLayoutEngine();
00090
00101 static LETag getScriptTag(le_int32 scriptCode);
00102
00113 static LETag getLangSysTag(le_int32 languageCode);
00114
00120 virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
00121
00127 static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
00128
00129 private:
00130
00135 void setScriptAndLanguageTags();
00136
00140 static const LETag scriptTags[];
00141
00146 static const char fgClassID;
00147
00148 protected:
00156 const LETag **fFeatureTags;
00157
00165 const LETag *fFeatureOrder;
00166
00172 const GlyphSubstitutionTableHeader *fGSUBTable;
00173
00179 const GlyphDefinitionTableHeader *fGDEFTable;
00180
00186 const GlyphPositioningTableHeader *fGPOSTable;
00187
00196 LEGlyphFilter *fSubstitutionFilter;
00197
00203 LETag fScriptTag;
00204
00210 LETag fLangSysTag;
00211
00237 virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
00238 LEUnicode *&outChars, le_int32 *&charIndices, const LETag **&featureTags, LEErrorCode &success)
00239 {
00240 if (LE_FAILURE(success)) {
00241 return 0;
00242 }
00243
00244 if (offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
00245 success = LE_ILLEGAL_ARGUMENT_ERROR;
00246 return 0;
00247 }
00248
00249 return count;
00250 };
00251
00281 virtual le_int32 glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
00282 const LETag **featureTags, LEGlyphID *&glyphs, le_int32 *&charIndices, LEErrorCode &success);
00283
00309 virtual le_int32 glyphPostProcessing(LEGlyphID tempGlyphs[], le_int32 tempCharIndices[], le_int32 tempGlyphCount,
00310 LEGlyphID *&glyphs, le_int32 *&charIndices, LEErrorCode &success)
00311 {
00312 if (LE_FAILURE(success)) {
00313 return 0;
00314 }
00315
00316 glyphs = tempGlyphs;
00317 charIndices = tempCharIndices;
00318
00319 return tempGlyphCount;
00320 };
00321
00344 virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphID *&glyphs, le_int32 *&charIndices, LEErrorCode &success);
00345
00361 virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphID glyphs[], le_int32 glyphCount, float positions[], LEErrorCode &success);
00362
00370 virtual void reset();
00371 };
00372
00373 U_NAMESPACE_END
00374 #endif
00375