sl@0: sl@0: /* sl@0: * sl@0: * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved sl@0: * sl@0: */ sl@0: sl@0: #ifndef __GXLAYOUTENGINE_H sl@0: #define __GXLAYOUTENGINE_H sl@0: sl@0: #include "LETypes.h" sl@0: #include "LayoutEngine.h" sl@0: sl@0: #include "MorphTables.h" sl@0: sl@0: U_NAMESPACE_BEGIN sl@0: sl@0: class LEFontInstance; sl@0: class LEGlyphStorage; sl@0: sl@0: /** sl@0: * This class implements layout for QuickDraw GX or Apple Advanced Typograyph (AAT) sl@0: * fonts. A font is a GX or AAT font if it contains a 'mort' table. See Apple's sl@0: * TrueType Reference Manual (http://fonts.apple.com/TTRefMan/index.html) for details. sl@0: * Information about 'mort' tables is in the chapter titled "Font Files." sl@0: * sl@0: * @internal sl@0: */ sl@0: class GXLayoutEngine : public LayoutEngine sl@0: { sl@0: public: sl@0: /** sl@0: * This is the main constructor. It constructs an instance of GXLayoutEngine for sl@0: * a particular font, script and language. It takes the 'mort' table as a parameter since sl@0: * LayoutEngine::layoutEngineFactory has to read the 'mort' table to know that it has a sl@0: * GX font. sl@0: * sl@0: * Note: GX and AAT fonts don't contain any script and language specific tables, so sl@0: * the script and language are ignored. sl@0: * sl@0: * @param fontInstance - the font sl@0: * @param scriptCode - the script sl@0: * @param langaugeCode - the language sl@0: * @param morphTable - the 'mort' table sl@0: * sl@0: * @see LayoutEngine::layoutEngineFactory sl@0: * @see ScriptAndLangaugeTags.h for script and language codes sl@0: * sl@0: * @internal sl@0: */ sl@0: GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable); sl@0: sl@0: /** sl@0: * The destructor, virtual for correct polymorphic invocation. sl@0: * sl@0: * @internal sl@0: */ sl@0: virtual ~GXLayoutEngine(); sl@0: sl@0: /** sl@0: * ICU "poor man's RTTI", returns a UClassID for the actual class. sl@0: * sl@0: * @stable ICU 2.8 sl@0: */ sl@0: virtual UClassID getDynamicClassID() const; sl@0: sl@0: /** sl@0: * ICU "poor man's RTTI", returns a UClassID for this class. sl@0: * sl@0: * @stable ICU 2.8 sl@0: */ sl@0: static UClassID getStaticClassID(); sl@0: sl@0: protected: sl@0: sl@0: /** sl@0: * The address of the 'mort' table sl@0: * sl@0: * @internal sl@0: */ sl@0: const MorphTableHeader *fMorphTable; sl@0: sl@0: /** sl@0: * This method does GX layout using the font's 'mort' table. It converts the sl@0: * input character codes to glyph indices using mapCharsToGlyphs, and then sl@0: * applies the 'mort' table. sl@0: * sl@0: * Input parameters: sl@0: * @param chars - the input character context sl@0: * @param offset - the index of the first character to process sl@0: * @param count - the number of characters to process sl@0: * @param max - the number of characters in the input context sl@0: * @param rightToLeft - TRUE if the text is in a right to left directional run sl@0: * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set. sl@0: * sl@0: * Output parameters: sl@0: * @param success - set to an error code if the operation fails sl@0: * sl@0: * @return the number of glyphs in the glyph index array sl@0: * sl@0: * @internal sl@0: */ sl@0: virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, sl@0: LEGlyphStorage &glyphStorage, LEErrorCode &success); sl@0: sl@0: /** sl@0: * This method adjusts the glyph positions using the font's sl@0: * 'kern', 'trak', 'bsln', 'opbd' and 'just' tables. sl@0: * sl@0: * Input parameters: sl@0: * @param glyphStorage - the object holding the glyph storage. The positions will be updated as needed. sl@0: * sl@0: * Output parameters: sl@0: * @param success - set to an error code if the operation fails sl@0: * sl@0: * @internal sl@0: */ sl@0: virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, sl@0: LEGlyphStorage &glyphStorage, LEErrorCode &success); sl@0: sl@0: }; sl@0: sl@0: U_NAMESPACE_END sl@0: #endif sl@0: