00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __LAYOUTENGINE_H
00010 #define __LAYOUTENGINE_H
00011
00012 #ifndef __LETYPES_H
00013 #include "LETypes.h"
00014 #endif
00015
00016 #include <string.h>
00017
00018 U_NAMESPACE_BEGIN
00019
00020 class LEFontInstance;
00021 class LEGlyphFilter;
00022
00066 class U_LAYOUT_API LayoutEngine : public UObject {
00067 protected:
00073 le_int32 fGlyphCount;
00074
00080 LEGlyphID *fGlyphs;
00081
00088 le_int32 *fCharIndices;
00089
00098 float *fPositions;
00099
00107 const LEFontInstance *fFontInstance;
00108
00116 le_int32 fScriptCode;
00117
00125 le_int32 fLanguageCode;
00126
00140 LayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode);
00141
00149 LayoutEngine();
00150
00177 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);
00178
00195 virtual void positionGlyphs(const LEGlyphID glyphs[], le_int32 glyphCount, float x, float y, float *&positions, LEErrorCode &success);
00196
00221 virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool , LEGlyphID glyphs[], le_int32 glyphCount, float positions[], LEErrorCode &success)
00222 {
00223 if (LE_FAILURE(success)) {
00224 return;
00225 }
00226
00227 if (chars == NULL || glyphs == NULL || positions == NULL || offset < 0 || count < 0 || glyphCount < 0) {
00228 success = LE_ILLEGAL_ARGUMENT_ERROR;
00229 return;
00230 }
00231
00232
00233 return;
00234 };
00235
00248 virtual const void *getFontTable(LETag tableTag) const;
00249
00277 virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror, LEGlyphID *&glyphs, le_int32 *&charIndices, LEErrorCode &success);
00278
00294 static void adjustMarkGlyphs(const LEGlyphID glyphs[], le_int32 glyphCount, le_bool reverse, LEGlyphFilter *markFilter, float positions[], LEErrorCode &success);
00295
00296 public:
00305 virtual ~LayoutEngine();
00306
00328 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);
00329
00339 le_int32 getGlyphCount() const
00340 {
00341 return fGlyphCount;
00342 };
00343
00354 void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const;
00355
00368 virtual void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const;
00369
00380 void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const;
00381
00393 void getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const;
00394
00406 void getGlyphPositions(float positions[], LEErrorCode &success) const;
00407
00422 void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const;
00423
00431 virtual void reset();
00432
00449 static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success);
00450
00456 virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
00457
00463 static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
00464
00465 private:
00466
00471 static const char fgClassID;
00472 };
00473
00474 U_NAMESPACE_END
00475 #endif
00476