fontservices/textshaperplugin/IcuSource/layout/GXLayoutEngine.h
changeset 0 1fb32624e06b
equal deleted inserted replaced
-1:000000000000 0:1fb32624e06b
       
     1 
       
     2 /*
       
     3  *
       
     4  * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
       
     5  *
       
     6  */
       
     7 
       
     8 #ifndef __GXLAYOUTENGINE_H
       
     9 #define __GXLAYOUTENGINE_H
       
    10 
       
    11 #include "LETypes.h"
       
    12 #include "LayoutEngine.h"
       
    13 
       
    14 #include "MorphTables.h"
       
    15 
       
    16 U_NAMESPACE_BEGIN
       
    17 
       
    18 class LEFontInstance;
       
    19 class LEGlyphStorage;
       
    20 
       
    21 /**
       
    22  * This class implements layout for QuickDraw GX or Apple Advanced Typograyph (AAT)
       
    23  * fonts. A font is a GX or AAT font if it contains a 'mort' table. See Apple's
       
    24  * TrueType Reference Manual (http://fonts.apple.com/TTRefMan/index.html) for details.
       
    25  * Information about 'mort' tables is in the chapter titled "Font Files."
       
    26  *
       
    27  * @internal
       
    28  */
       
    29 class GXLayoutEngine : public LayoutEngine
       
    30 {
       
    31 public:
       
    32     /**
       
    33      * This is the main constructor. It constructs an instance of GXLayoutEngine for
       
    34      * a particular font, script and language. It takes the 'mort' table as a parameter since
       
    35      * LayoutEngine::layoutEngineFactory has to read the 'mort' table to know that it has a
       
    36      * GX font.
       
    37      *
       
    38      * Note: GX and AAT fonts don't contain any script and language specific tables, so
       
    39      * the script and language are ignored.
       
    40      *
       
    41      * @param fontInstance - the font
       
    42      * @param scriptCode - the script
       
    43      * @param langaugeCode - the language
       
    44      * @param morphTable - the 'mort' table
       
    45      *
       
    46      * @see LayoutEngine::layoutEngineFactory
       
    47      * @see ScriptAndLangaugeTags.h for script and language codes
       
    48      *
       
    49      * @internal
       
    50      */
       
    51     GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable);
       
    52 
       
    53     /**
       
    54      * The destructor, virtual for correct polymorphic invocation.
       
    55      *
       
    56      * @internal
       
    57      */
       
    58     virtual ~GXLayoutEngine();
       
    59 
       
    60     /**
       
    61      * ICU "poor man's RTTI", returns a UClassID for the actual class.
       
    62      *
       
    63      * @stable ICU 2.8
       
    64      */
       
    65     virtual UClassID getDynamicClassID() const;
       
    66 
       
    67     /**
       
    68      * ICU "poor man's RTTI", returns a UClassID for this class.
       
    69      *
       
    70      * @stable ICU 2.8
       
    71      */
       
    72     static UClassID getStaticClassID();
       
    73 
       
    74 protected:
       
    75 
       
    76     /**
       
    77      * The address of the 'mort' table
       
    78      *
       
    79      * @internal
       
    80      */
       
    81     const MorphTableHeader *fMorphTable;
       
    82 
       
    83     /**
       
    84      * This method does GX layout using the font's 'mort' table. It converts the
       
    85      * input character codes to glyph indices using mapCharsToGlyphs, and then
       
    86      * applies the 'mort' table.
       
    87      *
       
    88      * Input parameters:
       
    89      * @param chars - the input character context
       
    90      * @param offset - the index of the first character to process
       
    91      * @param count - the number of characters to process
       
    92      * @param max - the number of characters in the input context
       
    93      * @param rightToLeft - <code>TRUE</code> if the text is in a right to left directional run
       
    94      * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set.
       
    95      *
       
    96      * Output parameters:
       
    97      * @param success - set to an error code if the operation fails
       
    98      *
       
    99      * @return the number of glyphs in the glyph index array
       
   100      *
       
   101      * @internal
       
   102      */
       
   103     virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
       
   104         LEGlyphStorage &glyphStorage, LEErrorCode &success);
       
   105 
       
   106     /**
       
   107      * This method adjusts the glyph positions using the font's
       
   108      * 'kern', 'trak', 'bsln', 'opbd' and 'just' tables.
       
   109      *
       
   110      * Input parameters:
       
   111      * @param glyphStorage - the object holding the glyph storage. The positions will be updated as needed.
       
   112      *
       
   113      * Output parameters:
       
   114      * @param success - set to an error code if the operation fails
       
   115      *
       
   116      * @internal
       
   117      */
       
   118     virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse,
       
   119                                       LEGlyphStorage &glyphStorage, LEErrorCode &success);
       
   120 
       
   121 };
       
   122 
       
   123 U_NAMESPACE_END
       
   124 #endif
       
   125