1/*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation.  Oracle designates this
7 * particular file as subject to the "Classpath" exception as provided
8 * by Oracle in the LICENSE file that accompanied this code.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26/*
27 *
28 * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
29 *
30 * Developed at DIT - Government of Bhutan
31 *
32 * Contact person: Pema Geyleg - <pema_geyleg@druknet.bt>
33 *
34 * This file is a modification of the ICU file KhmerReordering.cpp
35 * by Jens Herden and Javier Sola who have given all their possible rights to IBM and the Governement of Bhutan
36 * A first module for Dzongkha was developed by Karunakar under Panlocalisation funding.
37 * Assistance for this module has been received from Namgay Thinley, Christopher Fynn and Javier Sola
38 *
39 */
40
41#ifndef __TIBETANLAYOUTENGINE_H
42#define __TIBETANLAYOUTENGINE_H
43
44// #include "LETypes.h"
45// #include "LEFontInstance.h"
46// #include "LEGlyphFilter.h"
47// #include "LayoutEngine.h"
48// #include "OpenTypeLayoutEngine.h"
49
50// #include "GlyphSubstitutionTables.h"
51// #include "GlyphDefinitionTables.h"
52// #include "GlyphPositioningTables.h"
53
54U_NAMESPACE_BEGIN
55
56// class MPreFixups;
57// class LEGlyphStorage;
58
59/**
60 * This class implements OpenType layout for Dzongkha and Tibetan OpenType fonts
61 *
62 * @internal
63 */
64class TibetanOpenTypeLayoutEngine : public OpenTypeLayoutEngine
65{
66public:
67    /**
68     * This is the main constructor. It constructs an instance of TibetanOpenTypeLayoutEngine for
69     * a particular font, script and language. It takes the GSUB table as a parameter since
70     * LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an
71     * Tibetan OpenType font.
72     *
73     * @param fontInstance - the font
74     * @param scriptCode - the script
75     * @param langaugeCode - the language
76     * @param gsubTable - the GSUB table
77     * @param success - set to an error code if the operation fails
78     *
79     * @see LayoutEngine::layoutEngineFactory
80     * @see OpenTypeLayoutEngine
81     * @see ScriptAndLangaugeTags.h for script and language codes
82     *
83     * @internal
84     */
85    TibetanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
86                            le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success);
87
88    /**
89     * This constructor is used when the font requires a "canned" GSUB table which can't be known
90     * until after this constructor has been invoked.
91     *
92     * @param fontInstance - the font
93     * @param scriptCode - the script
94     * @param langaugeCode - the language
95     * @param success - set to an error code if the operation fails
96     *
97     * @see OpenTypeLayoutEngine
98     * @see ScriptAndLangaugeTags.h for script and language codes
99     *
100     * @internal
101     */
102    TibetanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
103                                le_int32 typoFlags, LEErrorCode &success);
104
105    /**
106     * The destructor, virtual for correct polymorphic invocation.
107     *
108     * @internal
109     */
110   virtual ~TibetanOpenTypeLayoutEngine();
111
112    /**
113     * ICU "poor man's RTTI", returns a UClassID for the actual class.
114     *
115     * @internal ICU 3.6
116     */
117    virtual UClassID getDynamicClassID() const;
118
119    /**
120     * ICU "poor man's RTTI", returns a UClassID for this class.
121     *
122     * @internal ICU 3.6
123     */
124    static UClassID getStaticClassID();
125
126protected:
127
128    /**
129     * This method does Tibetan OpenType character processing. It assigns the OpenType feature
130     * tags to the characters, and may generate output characters which have been reordered.
131     * It may also split some vowels, resulting in more output characters than input characters.
132     *
133     * Input parameters:
134     * @param chars - the input character context
135     * @param offset - the index of the first character to process
136     * @param count - the number of characters to process
137     * @param max - the number of characters in the input context
138     * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
139     * @param glyphStorage - the glyph storage object. The glyph and character index arrays will be set.
140     *                       the auxillary data array will be set to the feature tags.
141     *
142     * Output parameters:
143     * @param success - set to an error code if the operation fails
144     *
145     * @return the output character count
146     *
147     * @internal
148     */
149    virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
150            LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
151
152};
153
154U_NAMESPACE_END
155#endif
156
157