00001
00002
00003
00004
00005
00006
00007 #ifndef __LOENGINE_H
00008 #define __LOENGINE_H
00009
00010 #include "unicode/utypes.h"
00011 #include "unicode/uobject.h"
00012 #include "unicode/uscript.h"
00013 #include "unicode/unistr.h"
00014
00015 #include "layout/LETypes.h"
00016 #include "layout/LayoutEngine.h"
00017
00018 U_NAMESPACE_BEGIN
00019
00050 #ifndef U_HIDE_OBSOLETE_API
00051 class U_LAYOUT_API ICULayoutEngine : public UObject {
00052 private:
00057 LayoutEngine *fLayoutEngine;
00058
00065 ICULayoutEngine();
00066
00076 ICULayoutEngine(LayoutEngine *layoutEngine);
00077
00078 public:
00079
00090 virtual ~ICULayoutEngine();
00091
00112 int32_t layoutChars(const UChar chars[],
00113 int32_t startOffset,
00114 int32_t endOffset,
00115 int32_t maxOffset,
00116 UBool rightToLeft,
00117 float x, float y,
00118 UErrorCode &success);
00119
00120
00140 int32_t layoutString(const UnicodeString &str,
00141 int32_t startOffset,
00142 int32_t endOffset,
00143 UBool rightToLeft,
00144 float x, float y,
00145 UErrorCode &success);
00146
00156 int32_t countGlyphs() const;
00157
00168 void getGlyphs(uint32_t glyphs[], UErrorCode &success);
00169
00180 void getCharIndices(int32_t charIndices[], UErrorCode &success);
00181
00193 void getCharIndices(int32_t charIndices[], int32_t indexBase, UErrorCode &success);
00194
00206 void getGlyphPositions(float positions[], UErrorCode &success);
00207
00222 void getGlyphPosition(int32_t glyphIndex, float &x, float &y, UErrorCode &success);
00223
00241 static ICULayoutEngine *createInstance(const LEFontInstance *fontInstance,
00242 UScriptCode scriptCode, Locale &locale,
00243 UErrorCode &success);
00244
00250 virtual UClassID getDynamicClassID() const;
00251
00257 static UClassID getStaticClassID();
00258 };
00259
00260 inline ICULayoutEngine::ICULayoutEngine()
00261 {
00262
00263 }
00264
00265 inline ICULayoutEngine::ICULayoutEngine(LayoutEngine *layoutEngine)
00266 : fLayoutEngine(layoutEngine)
00267 {
00268
00269 }
00270
00271 inline ICULayoutEngine::~ICULayoutEngine()
00272 {
00273 delete fLayoutEngine;
00274 fLayoutEngine = 0;
00275 }
00276
00277 inline int32_t ICULayoutEngine::layoutChars(const UChar chars[],
00278 int32_t startOffset,
00279 int32_t endOffset,
00280 int32_t maxOffset,
00281 UBool rightToLeft,
00282 float x, float y,
00283 UErrorCode &success)
00284 {
00285
00286 fLayoutEngine->reset();
00287 return fLayoutEngine->layoutChars(chars,
00288 startOffset,
00289 endOffset - startOffset,
00290 maxOffset,
00291 rightToLeft,
00292 x, y,
00293 (LEErrorCode &) success);
00294 }
00295
00296 inline int32_t ICULayoutEngine::layoutString(const UnicodeString &str,
00297 int32_t startOffset,
00298 int32_t endOffset,
00299 UBool rightToLeft,
00300 float x, float y,
00301 UErrorCode &success)
00302 {
00303
00304 fLayoutEngine->reset();
00305 return fLayoutEngine->layoutChars(str.getBuffer(),
00306 startOffset,
00307 endOffset - startOffset,
00308 str.length(),
00309 rightToLeft,
00310 x, y,
00311 (LEErrorCode &) success);
00312 }
00313
00314 inline int32_t ICULayoutEngine::countGlyphs() const
00315 {
00316 return fLayoutEngine->getGlyphCount();
00317 }
00318
00319 inline void ICULayoutEngine::getGlyphs(uint32_t glyphs[], UErrorCode &success)
00320 {
00321 fLayoutEngine->getGlyphs(glyphs, (LEErrorCode &) success);
00322 }
00323
00324 inline void ICULayoutEngine::getCharIndices(int32_t charIndices[], UErrorCode &success)
00325 {
00326 fLayoutEngine->getCharIndices(charIndices, (LEErrorCode &) success);
00327 }
00328
00329 inline void ICULayoutEngine::getCharIndices(int32_t charIndices[], int32_t indexBase, UErrorCode &success)
00330 {
00331 fLayoutEngine->getCharIndices(charIndices, indexBase, (LEErrorCode &) success);
00332 }
00333
00334 inline void ICULayoutEngine::getGlyphPositions(float positions[], UErrorCode &success)
00335 {
00336 fLayoutEngine->getGlyphPositions(positions, (LEErrorCode &) success);
00337 }
00338
00339 inline void ICULayoutEngine::getGlyphPosition(int32_t glyphIndex, float &x, float &y, UErrorCode &success)
00340 {
00341 fLayoutEngine->getGlyphPosition(glyphIndex, x, y, (LEErrorCode &) success);
00342 }
00343
00344 inline ICULayoutEngine *ICULayoutEngine::createInstance(const LEFontInstance *fontInstance,
00345 UScriptCode scriptCode,
00346 Locale &locale, UErrorCode &success)
00347 {
00348 LayoutEngine *engine = LayoutEngine::layoutEngineFactory(fontInstance,
00349 (le_int32) scriptCode,
00350 0,
00351 (LEErrorCode &) success);
00352
00353 return new ICULayoutEngine(engine);
00354 }
00355 #endif // U_HIDE_OBSOLETE_API
00356
00357 U_NAMESPACE_END
00358 #endif