00001
00002
00003
00004
00005 #ifndef __LAYOUTENGINE_H
00006 #define __LAYOUTENGINE_H
00007
00008 #include "LETypes.h"
00009
00015 U_NAMESPACE_BEGIN
00016
00017 class LEFontInstance;
00018 class LEGlyphFilter;
00019 class LEGlyphStorage;
00020
00071 class U_LAYOUT_API LayoutEngine : public UObject {
00072 public:
00073 #ifndef U_HIDE_INTERNAL_API
00074
00075 static const le_int32 kTypoFlagKern;
00077 static const le_int32 kTypoFlagLiga;
00078 #endif
00079
00080 protected:
00086 LEGlyphStorage *fGlyphStorage;
00087
00095 const LEFontInstance *fFontInstance;
00096
00104 le_int32 fScriptCode;
00105
00113 le_int32 fLanguageCode;
00114
00120 le_int32 fTypoFlags;
00121
00128 le_bool fFilterZeroWidth;
00129
00130 #ifndef U_HIDE_INTERNAL_API
00131
00147 LayoutEngine(const LEFontInstance *fontInstance,
00148 le_int32 scriptCode,
00149 le_int32 languageCode,
00150 le_int32 typoFlags,
00151 LEErrorCode &success);
00152 #endif
00153
00154
00155
00163 LayoutEngine();
00164
00187 virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
00188 LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
00189
00216 virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
00217
00231 virtual void positionGlyphs(LEGlyphStorage &glyphStorage, float x, float y, LEErrorCode &success);
00232
00253 virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
00254
00268 virtual const void *getFontTable(LETag tableTag, size_t &length) const;
00269
00273 virtual const void *getFontTable(LETag tableTag) const { size_t ignored; return getFontTable(tableTag, ignored); }
00274
00300 virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror, LEGlyphStorage &glyphStorage, LEErrorCode &success);
00301
00302 #ifndef U_HIDE_INTERNAL_API
00303
00315 static void adjustMarkGlyphs(LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success);
00316
00317
00336 static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 charCount, le_bool reverse, LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success);
00337 #endif
00338
00339 public:
00348 virtual ~LayoutEngine();
00349
00375 virtual le_int32 layoutChars(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, float x, float y, LEErrorCode &success);
00376
00386 le_int32 getGlyphCount() const;
00387
00398 void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const;
00399
00412 virtual void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const;
00413
00424 void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const;
00425
00437 void getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const;
00438
00450 void getGlyphPositions(float positions[], LEErrorCode &success) const;
00451
00466 void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const;
00467
00475 virtual void reset();
00476
00493 static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success);
00494
00499 static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typo_flags, LEErrorCode &success);
00500
00506 virtual UClassID getDynamicClassID() const;
00507
00513 static UClassID getStaticClassID();
00514
00515 };
00516
00517 U_NAMESPACE_END
00518 #endif