Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

loengine.h

00001 /*
00002  * @(#)loengine.h       1.0 00/12/11
00003  *
00004  * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
00005  *
00006  */
00007 
00008 #ifndef __LOENGINE_H
00009 #define __LOENGINE_H
00010 
00011 #include "unicode/utypes.h"
00012 #include "unicode/uobject.h"
00013 #include "unicode/uscript.h"
00014 #include "unicode/unistr.h"
00015 
00016 #include "layout/LETypes.h"
00017 #include "layout/LayoutEngine.h"
00018 
00019 U_NAMESPACE_BEGIN
00020 
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 inline UClassID getDynamicClassID() const { return getStaticClassID(); }
00251 
00257     static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
00258 
00259 private:
00260 
00265     static const char fgClassID;
00266 };
00267 
00268 inline ICULayoutEngine::ICULayoutEngine()
00269 {
00270     // nothing at all...
00271 }
00272 
00273 inline ICULayoutEngine::ICULayoutEngine(LayoutEngine *layoutEngine)
00274     : fLayoutEngine(layoutEngine)
00275 {
00276     // nothing else to do
00277 }
00278 
00279 inline ICULayoutEngine::~ICULayoutEngine()
00280 {
00281     delete fLayoutEngine;
00282     fLayoutEngine = 0;
00283 }
00284 
00285 inline int32_t ICULayoutEngine::layoutChars(const UChar chars[],
00286                                             int32_t startOffset,
00287                                             int32_t endOffset,
00288                                             int32_t maxOffset,
00289                                             UBool rightToLeft,
00290                                             float x, float y,
00291                                             UErrorCode &success)
00292 {
00293     // NOTE: call reset() so that clients can safely reuse
00294     fLayoutEngine->reset();
00295     return fLayoutEngine->layoutChars(chars,
00296                                       startOffset,
00297                                       endOffset - startOffset,
00298                                       maxOffset,
00299                                       rightToLeft,
00300                                       x, y,
00301                                       (LEErrorCode &) success);
00302 }
00303 
00304 inline int32_t ICULayoutEngine::layoutString(const UnicodeString &str,
00305                                             int32_t startOffset,
00306                                             int32_t endOffset,
00307                                             UBool rightToLeft,
00308                                             float x, float y,
00309                                             UErrorCode &success)
00310 {
00311     // NOTE: call reset() so that clients can safely reuse
00312     fLayoutEngine->reset();
00313     return fLayoutEngine->layoutChars(str.getBuffer(),
00314                                       startOffset,
00315                                       endOffset - startOffset,
00316                                       str.length(),
00317                                       rightToLeft,
00318                                       x, y,
00319                                       (LEErrorCode &) success);
00320 }
00321 
00322 inline int32_t ICULayoutEngine::countGlyphs() const
00323 {
00324     return fLayoutEngine->getGlyphCount();
00325 }
00326 
00327 inline void ICULayoutEngine::getGlyphs(uint32_t glyphs[], UErrorCode &success)
00328 {
00329     fLayoutEngine->getGlyphs(glyphs, (LEErrorCode &) success);
00330 }
00331 
00332 inline void ICULayoutEngine::getCharIndices(int32_t charIndices[], UErrorCode &success)
00333 {
00334     fLayoutEngine->getCharIndices(charIndices, (LEErrorCode &) success);
00335 }
00336 
00337 inline void ICULayoutEngine::getCharIndices(int32_t charIndices[], int32_t indexBase, UErrorCode &success)
00338 {
00339     fLayoutEngine->getCharIndices(charIndices, indexBase, (LEErrorCode &) success);
00340 }
00341 
00342 inline void ICULayoutEngine::getGlyphPositions(float positions[], UErrorCode &success)
00343 {
00344     fLayoutEngine->getGlyphPositions(positions, (LEErrorCode &) success);
00345 }
00346 
00347 inline void ICULayoutEngine::getGlyphPosition(int32_t glyphIndex, float &x, float &y, UErrorCode &success)
00348 {
00349     fLayoutEngine->getGlyphPosition(glyphIndex, x, y, (LEErrorCode &) success);
00350 }
00351 
00352 inline ICULayoutEngine *ICULayoutEngine::createInstance(const LEFontInstance *fontInstance,
00353                                                         UScriptCode scriptCode,
00354                                                         Locale &locale, UErrorCode &success)
00355 {
00356     LayoutEngine *engine = LayoutEngine::layoutEngineFactory(fontInstance,
00357                                                              (le_int32) scriptCode,
00358                                                              0,
00359                                                              (LEErrorCode &) success);
00360 
00361     return new ICULayoutEngine(engine);
00362 }
00363 
00364 U_NAMESPACE_END
00365 #endif

Generated on Tue Oct 26 18:11:09 2004 for ICU 2.8 by  doxygen 1.3.9.1