os/textandloc/fontservices/textshaperplugin/IcuSource/layout/HanLayoutEngine.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 
     2 /*
     3  * HanLayoutEngine.h: OpenType processing for Han fonts.
     4  *
     5  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved.
     6  */
     7 
     8 #ifndef __HANLAYOUTENGINE_H
     9 #define __HANLAYOUTENGINE_H
    10 
    11 #include "LETypes.h"
    12 #include "LEFontInstance.h"
    13 #include "LayoutEngine.h"
    14 #include "OpenTypeLayoutEngine.h"
    15 
    16 #include "GlyphSubstitutionTables.h"
    17 
    18 U_NAMESPACE_BEGIN
    19 
    20 class LEGlyphStorage;
    21 
    22 /**
    23  * This class implements OpenType layout for Han fonts. It overrides
    24  * the characerProcessing method to assign the correct OpenType feature
    25  * tags for the CJK language-specific forms.
    26  *
    27  * @internal
    28  */
    29 class HanOpenTypeLayoutEngine : public OpenTypeLayoutEngine
    30 {
    31 public:
    32     /**
    33      * This is the main constructor. It constructs an instance of HanOpenTypeLayoutEngine for
    34      * a particular font, script and language. It takes the GSUB table as a parameter since
    35      * LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has a
    36      * Han OpenType font.
    37      *
    38      * @param fontInstance - the font
    39      * @param scriptCode - the script
    40      * @param langaugeCode - the language
    41      * @param gsubTable - the GSUB table
    42      *
    43      * @see LayoutEngine::layoutEngineFactory
    44      * @see OpenTypeLayoutEngine
    45      * @see ScriptAndLangaugeTags.h for script and language codes
    46      *
    47      * @internal
    48      */
    49     HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
    50                             le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
    51 
    52 
    53     /**
    54      * The destructor, virtual for correct polymorphic invocation.
    55      *
    56      * @internal
    57      */
    58     virtual ~HanOpenTypeLayoutEngine();
    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      * This method does Han OpenType character processing. It assigns the OpenType feature
    78      * tags to the characters to generate the correct language-specific variants.
    79      *
    80      * Input parameters:
    81      * @param chars - the input character context
    82      * @param offset - the index of the first character to process
    83      * @param count - the number of characters to process
    84      * @param max - the number of characters in the input context
    85      * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
    86      * @param glyphStorage - the object holding the glyph storage. The char index and auxillary data arrays will be set.
    87      *
    88      * Output parameters:
    89      * @param outChars - the output character arrayt
    90      * @param charIndices - the output character index array
    91      * @param featureTags - the output feature tag array
    92      * @param success - set to an error code if the operation fails
    93      *
    94      * @return the output character count
    95      *
    96      * @internal
    97      */
    98     virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
    99             LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
   100 
   101 };
   102 
   103 U_NAMESPACE_END
   104 #endif