os/textandloc/fontservices/textshaperplugin/IcuSource/layout/KhmerLayoutEngine.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 
     2 /*
     3  *
     4  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved 
     5  *
     6  * This file is a modification of the ICU file IndicLayoutEngine.h
     7  * by Jens Herden and Javier Sola for Khmer language 
     8  *
     9  */
    10 
    11 #ifndef __KHMERLAYOUTENGINE_H
    12 #define __KHMERLAYOUTENGINE_H
    13 
    14 // #include "LETypes.h"
    15 // #include "LEFontInstance.h"
    16 // #include "LEGlyphFilter.h"
    17 // #include "LayoutEngine.h"
    18 // #include "OpenTypeLayoutEngine.h"
    19 
    20 // #include "GlyphSubstitutionTables.h"
    21 // #include "GlyphDefinitionTables.h"
    22 // #include "GlyphPositioningTables.h"
    23 
    24 U_NAMESPACE_BEGIN
    25 
    26 // class MPreFixups;
    27 // class LEGlyphStorage;
    28 
    29 /**
    30  * This class implements OpenType layout for Khmer OpenType fonts, as
    31  * specified by Microsoft in "Creating and Supporting OpenType Fonts for
    32  * Khmer Scripts" (http://www.microsoft.com/typography/otspec/indicot/default.htm) TODO: change url
    33  *
    34  * This class overrides the characterProcessing method to do Khmer character processing
    35  * and reordering (See the MS spec. for more details)
    36  *
    37  * @internal
    38  */
    39 class KhmerOpenTypeLayoutEngine : public OpenTypeLayoutEngine
    40 {
    41 public:
    42     /**
    43      * This is the main constructor. It constructs an instance of KhmerOpenTypeLayoutEngine for
    44      * a particular font, script and language. It takes the GSUB table as a parameter since
    45      * LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an
    46      * Khmer OpenType font.
    47      *
    48      * @param fontInstance - the font
    49      * @param scriptCode - the script
    50      * @param langaugeCode - the language
    51      * @param gsubTable - the GSUB table
    52      *
    53      * @see LayoutEngine::layoutEngineFactory
    54      * @see OpenTypeLayoutEngine
    55      * @see ScriptAndLangaugeTags.h for script and language codes
    56      *
    57      * @internal
    58      */
    59     KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
    60                             le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable);
    61 
    62     /**
    63      * This constructor is used when the font requires a "canned" GSUB table which can't be known
    64      * until after this constructor has been invoked.
    65      *
    66      * @param fontInstance - the font
    67      * @param scriptCode - the script
    68      * @param langaugeCode - the language
    69      *
    70      * @see OpenTypeLayoutEngine
    71      * @see ScriptAndLangaugeTags.h for script and language codes
    72      *
    73      * @internal
    74      */
    75     KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
    76 			      le_int32 typoFlags);
    77 
    78     /**
    79      * The destructor, virtual for correct polymorphic invocation.
    80      *
    81      * @internal
    82      */
    83    virtual ~KhmerOpenTypeLayoutEngine();
    84 
    85     /**
    86      * ICU "poor man's RTTI", returns a UClassID for the actual class.
    87      *
    88      * @stable ICU 2.8
    89      */
    90     virtual UClassID getDynamicClassID() const;
    91 
    92     /**
    93      * ICU "poor man's RTTI", returns a UClassID for this class.
    94      *
    95      * @stable ICU 2.8
    96      */
    97     static UClassID getStaticClassID();
    98 
    99 protected:
   100 
   101     /**
   102      * This method does Khmer OpenType character processing. It assigns the OpenType feature
   103      * tags to the characters, and may generate output characters which have been reordered. 
   104      * It may also split some vowels, resulting in more output characters than input characters.
   105      *
   106      * Input parameters:
   107      * @param chars - the input character context
   108      * @param offset - the index of the first character to process
   109      * @param count - the number of characters to process
   110      * @param max - the number of characters in the input context
   111      * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
   112      * @param glyphStorage - the glyph storage object. The glyph and character index arrays will be set.
   113      *                       the auxillary data array will be set to the feature tags.
   114      *
   115      * Output parameters:
   116      * @param success - set to an error code if the operation fails
   117      *
   118      * @return the output character count
   119      *
   120      * @internal
   121      */
   122     virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
   123             LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
   124 
   125 };
   126 
   127 U_NAMESPACE_END
   128 #endif
   129