fontservices/textshaperplugin/IcuSource/layout/ThaiLayoutEngine.h
changeset 0 1fb32624e06b
equal deleted inserted replaced
-1:000000000000 0:1fb32624e06b
       
     1 
       
     2 /*
       
     3  *
       
     4  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
       
     5  *
       
     6  */
       
     7 
       
     8 #ifndef __THAILAYOUTENGINE_H
       
     9 #define __THAILAYOUTENGINE_H
       
    10 
       
    11 #include "LETypes.h"
       
    12 #include "LEFontInstance.h"
       
    13 #include "LayoutEngine.h"
       
    14 
       
    15 #include "ThaiShaping.h"
       
    16 
       
    17 U_NAMESPACE_BEGIN
       
    18 
       
    19 class LEGlyphStorage;
       
    20 
       
    21 /**
       
    22  * This class implements layout for the Thai script, using the ThaiShapingClass.
       
    23  * All existing Thai fonts use an encoding which assigns character codes to all
       
    24  * the variant forms needed to display accents and tone marks correctly in context.
       
    25  * This class can deal with fonts using the Microsoft, Macintosh, and WorldType encodings.
       
    26  *
       
    27  * @internal
       
    28  */
       
    29 class ThaiLayoutEngine : public LayoutEngine
       
    30 {
       
    31 public:
       
    32     /**
       
    33      * This constructs an instance of ThaiLayoutEngine for the given font, script and
       
    34      * language. It examines the font, using LEFontInstance::canDisplay, to set fGlyphSet
       
    35      * and fErrorChar. (see below)
       
    36      *
       
    37      * @param fontInstance - the font
       
    38      * @param scriptCode - the script
       
    39      * @param languageCode - the language
       
    40      *
       
    41      * @see LEFontInstance
       
    42      * @see ScriptAndLanguageTags.h for script and language codes
       
    43      *
       
    44      * @internal
       
    45      */
       
    46     ThaiLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags);
       
    47 
       
    48     /**
       
    49      * The destructor, virtual for correct polymorphic invocation.
       
    50      *
       
    51      * @internal
       
    52      */
       
    53     virtual ~ThaiLayoutEngine();
       
    54 
       
    55     /**
       
    56      * ICU "poor man's RTTI", returns a UClassID for the actual class.
       
    57      *
       
    58      * @stable ICU 2.8
       
    59      */
       
    60     virtual UClassID getDynamicClassID() const;
       
    61 
       
    62     /**
       
    63      * ICU "poor man's RTTI", returns a UClassID for this class.
       
    64      *
       
    65      * @stable ICU 2.8
       
    66      */
       
    67     static UClassID getStaticClassID();
       
    68 
       
    69 protected:
       
    70     /**
       
    71      * A small integer indicating which Thai encoding
       
    72      * the font uses.
       
    73      *
       
    74      * @see ThaiShaping
       
    75      *
       
    76      * @internal
       
    77      */
       
    78     le_uint8 fGlyphSet;
       
    79 
       
    80     /**
       
    81      * The character used as a base for vowels and
       
    82      * tone marks that are out of sequence. Usually
       
    83      * this will be Unicode 0x25CC, if the font can
       
    84      * display it.
       
    85      *
       
    86      * @see ThaiShaping
       
    87      *
       
    88      * @internal
       
    89      */
       
    90     LEUnicode fErrorChar;
       
    91 
       
    92     /**
       
    93      * This method performs Thai layout. It calls ThaiShaping::compose to
       
    94      * generate the correct contextual character codes, and then calls
       
    95      * mapCharsToGlyphs to generate the glyph indices.
       
    96      *
       
    97      * Input parameters:
       
    98      * @param chars - the input character context
       
    99      * @param offset - the index of the first character to process
       
   100      * @param count - the number of characters to process
       
   101      * @param max - the number of characters in the input context
       
   102      * @param rightToLeft - <code>TRUE</code> if the text is in a right to left directional run
       
   103      * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set.
       
   104      *
       
   105      * Output parameters:
       
   106      * @param success - set to an error code if the operation fails
       
   107      *
       
   108      * @return the number of glyphs in the glyph index array
       
   109      *
       
   110      * @see ThaiShaping
       
   111      *
       
   112      * @internal
       
   113      */
       
   114     virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
       
   115         LEGlyphStorage &glyphStorage, LEErrorCode &success);
       
   116 
       
   117 };
       
   118 
       
   119 U_NAMESPACE_END
       
   120 #endif
       
   121