123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518 |
- #ifndef __LAYOUTENGINE_H
- #define __LAYOUTENGINE_H
- #include "LETypes.h"
- U_NAMESPACE_BEGIN
- class LEFontInstance;
- class LEGlyphFilter;
- class LEGlyphStorage;
- /**
- * NOTE: This class is deprecated, please instead use HarfBuzz.
- * See: http://www.freedesktop.org/wiki/Software/HarfBuzz/
- * and http://userguide.icu-project.org/layoutengine
- *
- * This is a virtual base class used to do complex text layout. The text must all
- * be in a single font, script, and language. An instance of a LayoutEngine can be
- * created by calling the layoutEngineFactory method. Fonts are identified by
- * instances of the LEFontInstance class. Script and language codes are identified
- * by integer codes, which are defined in ScriptAndLanuageTags.h.
- *
- * Note that this class is not public API. It is declared public so that it can be
- * exported from the library that it is a part of.
- *
- * The input to the layout process is an array of characters in logical order,
- * and a starting X, Y position for the text. The output is an array of glyph indices,
- * an array of character indices for the glyphs, and an array of glyph positions.
- * These arrays are protected members of LayoutEngine which can be retreived by a
- * public method. The reset method can be called to free these arrays so that the
- * LayoutEngine can be reused.
- *
- * The layout process is done in three steps. There is a protected virtual method
- * for each step. These methods have a default implementation which only does
- * character to glyph mapping and default positioning using the glyph's advance
- * widths. Subclasses can override these methods for more advanced layout.
- * There is a public method which invokes the steps in the correct order.
- *
- * The steps are:
- *
- * 1) Glyph processing - character to glyph mapping and any other glyph processing
- * such as ligature substitution and contextual forms.
- *
- * 2) Glyph positioning - position the glyphs based on their advance widths.
- *
- * 3) Glyph position adjustments - adjustment of glyph positions for kerning,
- * accent placement, etc.
- *
- * NOTE: in all methods below, output parameters are references to pointers so
- * the method can allocate and free the storage as needed. All storage allocated
- * in this way is owned by the object which created it, and will be freed when it
- * is no longer needed, or when the object's destructor is invoked.
- *
- * @see LEFontInstance
- * @see ScriptAndLanguageTags.h
- *
- * @deprecated ICU 54. See {@link icu::LayoutEngine}
- * Instead, please use HarfBuzz.
- * see http:
- * and http:
- */
- class U_LAYOUT_API LayoutEngine : public UObject {
- public:
- #ifndef U_HIDE_INTERNAL_API
-
- static const le_int32 kTypoFlagKern;
-
- static const le_int32 kTypoFlagLiga;
- #endif
- protected:
-
- LEGlyphStorage *fGlyphStorage;
-
- const LEFontInstance *fFontInstance;
-
- le_int32 fScriptCode;
-
- le_int32 fLanguageCode;
-
- le_int32 fTypoFlags;
-
- le_bool fFilterZeroWidth;
- #ifndef U_HIDE_INTERNAL_API
-
- LayoutEngine(const LEFontInstance *fontInstance,
- le_int32 scriptCode,
- le_int32 languageCode,
- le_int32 typoFlags,
- LEErrorCode &success);
- #endif
-
-
-
- LayoutEngine();
-
- virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
- LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
-
- virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
-
- virtual void positionGlyphs(LEGlyphStorage &glyphStorage, float x, float y, LEErrorCode &success);
-
- virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
-
- virtual const void *getFontTable(LETag tableTag, size_t &length) const;
-
- virtual const void *getFontTable(LETag tableTag) const { size_t ignored; return getFontTable(tableTag, ignored); }
-
- virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror, LEGlyphStorage &glyphStorage, LEErrorCode &success);
- #ifndef U_HIDE_INTERNAL_API
-
- static void adjustMarkGlyphs(LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success);
-
- static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 charCount, le_bool reverse, LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success);
- #endif
- public:
-
- virtual ~LayoutEngine();
-
- 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);
-
- le_int32 getGlyphCount() const;
-
- void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const;
-
- virtual void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const;
-
- void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const;
-
- void getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const;
-
- void getGlyphPositions(float positions[], LEErrorCode &success) const;
-
- void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const;
-
- virtual void reset();
-
- static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success);
-
- static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typo_flags, LEErrorCode &success);
-
- virtual UClassID getDynamicClassID() const;
-
- static UClassID getStaticClassID();
- };
- U_NAMESPACE_END
- #endif
|