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 U_NAMESPACE_BEGIN
00022
00046 class OpenTypeLayoutEngine : public LayoutEngine
00047 {
00048 public:
00063 OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
00064 const GlyphSubstitutionTableHeader *gsubTable);
00065
00074 OpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode);
00075
00079 virtual ~OpenTypeLayoutEngine();
00080
00089 static LETag getScriptTag(le_int32 scriptCode);
00090
00099 static LETag getLangSysTag(le_int32 languageCode);
00100
00101 private:
00102
00107 void setScriptAndLanguageTags();
00108
00112 static const LETag scriptTags[];
00113
00114 protected:
00120 const LETag **fFeatureTags;
00121
00125 const GlyphSubstitutionTableHeader *fGSUBTable;
00126
00130 const GlyphDefinitionTableHeader *fGDEFTable;
00131
00135 const GlyphPositioningTableHeader *fGPOSTable;
00136
00143 LEGlyphFilter *fSubstitutionFilter;
00144
00148 LETag fScriptTag;
00149
00153 LETag fLangSysTag;
00154
00178 virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
00179 LEUnicode *&outChars, le_int32 *&charIndices, const LETag **&featureTags, LEErrorCode &success)
00180 {
00181 if (LE_FAILURE(success)) {
00182 return 0;
00183 }
00184
00185 if (offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
00186 success = LE_ILLEGAL_ARGUMENT_ERROR;
00187 return 0;
00188 }
00189
00190 return count;
00191 };
00192
00220 virtual le_int32 glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
00221 const LETag **featureTags, LEGlyphID *&glyphs, le_int32 *&charIndices, LEErrorCode &success);
00222
00246 virtual le_int32 glyphPostProcessing(LEGlyphID tempGlyphs[], le_int32 tempCharIndices[], le_int32 tempGlyphCount,
00247 LEGlyphID *&glyphs, le_int32 *&charIndices, LEErrorCode &success)
00248 {
00249 if (LE_FAILURE(success)) {
00250 return 0;
00251 }
00252
00253 glyphs = tempGlyphs;
00254 charIndices = tempCharIndices;
00255
00256 return tempGlyphCount;
00257 };
00258
00279 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);
00280
00294 virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphID glyphs[], le_int32 glyphCount, float positions[], LEErrorCode &success);
00295
00301 virtual void reset();
00302 };
00303
00304 U_NAMESPACE_END
00305 #endif
00306