os/textandloc/fontservices/textshaperplugin/IcuSource/layout/GXLayoutEngine.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/textandloc/fontservices/textshaperplugin/IcuSource/layout/GXLayoutEngine.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,125 @@
     1.4 +
     1.5 +/*
     1.6 + *
     1.7 + * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
     1.8 + *
     1.9 + */
    1.10 +
    1.11 +#ifndef __GXLAYOUTENGINE_H
    1.12 +#define __GXLAYOUTENGINE_H
    1.13 +
    1.14 +#include "LETypes.h"
    1.15 +#include "LayoutEngine.h"
    1.16 +
    1.17 +#include "MorphTables.h"
    1.18 +
    1.19 +U_NAMESPACE_BEGIN
    1.20 +
    1.21 +class LEFontInstance;
    1.22 +class LEGlyphStorage;
    1.23 +
    1.24 +/**
    1.25 + * This class implements layout for QuickDraw GX or Apple Advanced Typograyph (AAT)
    1.26 + * fonts. A font is a GX or AAT font if it contains a 'mort' table. See Apple's
    1.27 + * TrueType Reference Manual (http://fonts.apple.com/TTRefMan/index.html) for details.
    1.28 + * Information about 'mort' tables is in the chapter titled "Font Files."
    1.29 + *
    1.30 + * @internal
    1.31 + */
    1.32 +class GXLayoutEngine : public LayoutEngine
    1.33 +{
    1.34 +public:
    1.35 +    /**
    1.36 +     * This is the main constructor. It constructs an instance of GXLayoutEngine for
    1.37 +     * a particular font, script and language. It takes the 'mort' table as a parameter since
    1.38 +     * LayoutEngine::layoutEngineFactory has to read the 'mort' table to know that it has a
    1.39 +     * GX font.
    1.40 +     *
    1.41 +     * Note: GX and AAT fonts don't contain any script and language specific tables, so
    1.42 +     * the script and language are ignored.
    1.43 +     *
    1.44 +     * @param fontInstance - the font
    1.45 +     * @param scriptCode - the script
    1.46 +     * @param langaugeCode - the language
    1.47 +     * @param morphTable - the 'mort' table
    1.48 +     *
    1.49 +     * @see LayoutEngine::layoutEngineFactory
    1.50 +     * @see ScriptAndLangaugeTags.h for script and language codes
    1.51 +     *
    1.52 +     * @internal
    1.53 +     */
    1.54 +    GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable);
    1.55 +
    1.56 +    /**
    1.57 +     * The destructor, virtual for correct polymorphic invocation.
    1.58 +     *
    1.59 +     * @internal
    1.60 +     */
    1.61 +    virtual ~GXLayoutEngine();
    1.62 +
    1.63 +    /**
    1.64 +     * ICU "poor man's RTTI", returns a UClassID for the actual class.
    1.65 +     *
    1.66 +     * @stable ICU 2.8
    1.67 +     */
    1.68 +    virtual UClassID getDynamicClassID() const;
    1.69 +
    1.70 +    /**
    1.71 +     * ICU "poor man's RTTI", returns a UClassID for this class.
    1.72 +     *
    1.73 +     * @stable ICU 2.8
    1.74 +     */
    1.75 +    static UClassID getStaticClassID();
    1.76 +
    1.77 +protected:
    1.78 +
    1.79 +    /**
    1.80 +     * The address of the 'mort' table
    1.81 +     *
    1.82 +     * @internal
    1.83 +     */
    1.84 +    const MorphTableHeader *fMorphTable;
    1.85 +
    1.86 +    /**
    1.87 +     * This method does GX layout using the font's 'mort' table. It converts the
    1.88 +     * input character codes to glyph indices using mapCharsToGlyphs, and then
    1.89 +     * applies the 'mort' table.
    1.90 +     *
    1.91 +     * Input parameters:
    1.92 +     * @param chars - the input character context
    1.93 +     * @param offset - the index of the first character to process
    1.94 +     * @param count - the number of characters to process
    1.95 +     * @param max - the number of characters in the input context
    1.96 +     * @param rightToLeft - <code>TRUE</code> if the text is in a right to left directional run
    1.97 +     * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set.
    1.98 +     *
    1.99 +     * Output parameters:
   1.100 +     * @param success - set to an error code if the operation fails
   1.101 +     *
   1.102 +     * @return the number of glyphs in the glyph index array
   1.103 +     *
   1.104 +     * @internal
   1.105 +     */
   1.106 +    virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
   1.107 +        LEGlyphStorage &glyphStorage, LEErrorCode &success);
   1.108 +
   1.109 +    /**
   1.110 +     * This method adjusts the glyph positions using the font's
   1.111 +     * 'kern', 'trak', 'bsln', 'opbd' and 'just' tables.
   1.112 +     *
   1.113 +     * Input parameters:
   1.114 +     * @param glyphStorage - the object holding the glyph storage. The positions will be updated as needed.
   1.115 +     *
   1.116 +     * Output parameters:
   1.117 +     * @param success - set to an error code if the operation fails
   1.118 +     *
   1.119 +     * @internal
   1.120 +     */
   1.121 +    virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse,
   1.122 +                                      LEGlyphStorage &glyphStorage, LEErrorCode &success);
   1.123 +
   1.124 +};
   1.125 +
   1.126 +U_NAMESPACE_END
   1.127 +#endif
   1.128 +