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
00044 class OpenTypeLayoutEngine : public LayoutEngine
00045 {
00046 public:
00061 OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
00062 const GlyphSubstitutionTableHeader *gsubTable);
00063
00072 OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode);
00073
00077 virtual ~OpenTypeLayoutEngine();
00078
00087 static LETag getScriptTag(le_int32 scriptCode);
00088
00097 static LETag getLangSysTag(le_int32 languageCode);
00098
00099 private:
00100
00105 void setScriptAndLanguageTags();
00106
00107 protected:
00113 const LETag **fFeatureTags;
00114
00118 const GlyphSubstitutionTableHeader *fGSUBTable;
00119
00123 const GlyphDefinitionTableHeader *fGDEFTable;
00124
00128 const GlyphPositioningTableHeader *fGPOSTable;
00129
00136 LEGlyphFilter *fSubstitutionFilter;
00137
00141 LETag fScriptTag;
00142
00146 LETag fLangSysTag;
00147
00171 virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
00172 LEUnicode *&outChars, le_int32 *&charIndices, const LETag **&featureTags, LEErrorCode &success)
00173 {
00174 if (LE_FAILURE(success)) {
00175 return 0;
00176 }
00177
00178 if (offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
00179 success = LE_ILLEGAL_ARGUMENT_ERROR;
00180 return 0;
00181 }
00182
00183 return count;
00184 };
00185
00213 virtual le_int32 glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
00214 const LETag **featureTags, LEGlyphID *&glyphs, le_int32 *&charIndices, LEErrorCode &success);
00215
00239 virtual le_int32 glyphPostProcessing(LEGlyphID tempGlyphs[], le_int32 tempCharIndices[], le_int32 tempGlyphCount,
00240 LEGlyphID *&glyphs, le_int32 *&charIndices, LEErrorCode &success)
00241 {
00242 if (LE_FAILURE(success)) {
00243 return 0;
00244 }
00245
00246 glyphs = tempGlyphs;
00247 charIndices = tempCharIndices;
00248
00249 return tempGlyphCount;
00250 };
00251
00272 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);
00273
00287 virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphID glyphs[], le_int32 glyphCount, float positions[], LEErrorCode &success);
00288
00294 virtual void reset();
00295 };
00296
00297 #endif
00298