Home | History | Annotate | Download | only in layout
      1 /*
      2  *
      3  * (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved
      4  *
      5  * Developed at DIT - Government of Bhutan
      6  *
      7  * Contact person: Pema Geyleg - <pema_geyleg (at) druknet.bt>
      8  *
      9  * This file is a modification of the ICU file KhmerReordering.cpp
     10  * by Jens Herden and Javier Sola who have given all their possible rights to IBM and the Governement of Bhutan
     11  * A first module for Dzongkha was developed by Karunakar under Panlocalisation funding.
     12  * Assistance for this module has been received from Namgay Thinley, Christopher Fynn and Javier Sola
     13  *
     14  */
     15 
     16 #ifndef __TIBETANLAYOUTENGINE_H
     17 #define __TIBETANLAYOUTENGINE_H
     18 
     19 // #include "LETypes.h"
     20 // #include "LEFontInstance.h"
     21 // #include "LEGlyphFilter.h"
     22 // #include "LayoutEngine.h"
     23 // #include "OpenTypeLayoutEngine.h"
     24 
     25 // #include "GlyphSubstitutionTables.h"
     26 // #include "GlyphDefinitionTables.h"
     27 // #include "GlyphPositioningTables.h"
     28 
     29 U_NAMESPACE_BEGIN
     30 
     31 // class MPreFixups;
     32 // class LEGlyphStorage;
     33 
     34 /**
     35  * This class implements OpenType layout for Dzongkha and Tibetan OpenType fonts
     36  *
     37  * @internal
     38  */
     39 class TibetanOpenTypeLayoutEngine : public OpenTypeLayoutEngine
     40 {
     41 public:
     42     /**
     43      * This is the main constructor. It constructs an instance of TibetanOpenTypeLayoutEngine 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      * Tibetan 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      * @param success - set to an error code if the operation fails
     53      *
     54      * @see LayoutEngine::layoutEngineFactory
     55      * @see OpenTypeLayoutEngine
     56      * @see ScriptAndLangaugeTags.h for script and language codes
     57      *
     58      * @internal
     59      */
     60     TibetanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
     61                             le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success);
     62 
     63     /**
     64      * This constructor is used when the font requires a "canned" GSUB table which can't be known
     65      * until after this constructor has been invoked.
     66      *
     67      * @param fontInstance - the font
     68      * @param scriptCode - the script
     69      * @param langaugeCode - the language
     70      * @param success - set to an error code if the operation fails
     71      *
     72      * @see OpenTypeLayoutEngine
     73      * @see ScriptAndLangaugeTags.h for script and language codes
     74      *
     75      * @internal
     76      */
     77     TibetanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
     78                                 le_int32 typoFlags, LEErrorCode &success);
     79 
     80     /**
     81      * The destructor, virtual for correct polymorphic invocation.
     82      *
     83      * @internal
     84      */
     85    virtual ~TibetanOpenTypeLayoutEngine();
     86 
     87     /**
     88      * ICU "poor man's RTTI", returns a UClassID for the actual class.
     89      *
     90      * @internal ICU 3.6
     91      */
     92     virtual UClassID getDynamicClassID() const;
     93 
     94     /**
     95      * ICU "poor man's RTTI", returns a UClassID for this class.
     96      *
     97      * @internal ICU 3.6
     98      */
     99     static UClassID getStaticClassID();
    100 
    101 protected:
    102 
    103     /**
    104      * This method does Tibetan OpenType character processing. It assigns the OpenType feature
    105      * tags to the characters, and may generate output characters which have been reordered.
    106      * It may also split some vowels, resulting in more output characters than input characters.
    107      *
    108      * Input parameters:
    109      * @param chars - the input character context
    110      * @param offset - the index of the first character to process
    111      * @param count - the number of characters to process
    112      * @param max - the number of characters in the input context
    113      * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
    114      * @param glyphStorage - the glyph storage object. The glyph and character index arrays will be set.
    115      *                       the auxillary data array will be set to the feature tags.
    116      *
    117      * Output parameters:
    118      * @param success - set to an error code if the operation fails
    119      *
    120      * @return the output character count
    121      *
    122      * @internal
    123      */
    124     virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
    125             LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
    126 
    127 };
    128 
    129 U_NAMESPACE_END
    130 #endif
    131 
    132