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