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