2
|
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
|
5506
|
6 |
* published by the Free Software Foundation. Oracle designates this
|
2
|
7 |
* particular file as subject to the "Classpath" exception as provided
|
5506
|
8 |
* by Oracle in the LICENSE file that accompanied this code.
|
2
|
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 |
*
|
5506
|
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.
|
2
|
23 |
*
|
|
24 |
*/
|
|
25 |
|
|
26 |
|
|
27 |
/*
|
|
28 |
*
|
7486
|
29 |
* (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
|
2
|
30 |
*
|
|
31 |
*/
|
|
32 |
|
|
33 |
#ifndef __THAILAYOUTENGINE_H
|
|
34 |
#define __THAILAYOUTENGINE_H
|
|
35 |
|
|
36 |
#include "LETypes.h"
|
|
37 |
#include "LEFontInstance.h"
|
|
38 |
#include "LayoutEngine.h"
|
|
39 |
|
|
40 |
#include "ThaiShaping.h"
|
|
41 |
|
3935
|
42 |
U_NAMESPACE_BEGIN
|
|
43 |
|
2
|
44 |
class LEGlyphStorage;
|
|
45 |
|
|
46 |
/**
|
|
47 |
* This class implements layout for the Thai script, using the ThaiShapingClass.
|
|
48 |
* All existing Thai fonts use an encoding which assigns character codes to all
|
|
49 |
* the variant forms needed to display accents and tone marks correctly in context.
|
|
50 |
* This class can deal with fonts using the Microsoft, Macintosh, and WorldType encodings.
|
|
51 |
*
|
|
52 |
* @internal
|
|
53 |
*/
|
|
54 |
class ThaiLayoutEngine : public LayoutEngine
|
|
55 |
{
|
|
56 |
public:
|
|
57 |
/**
|
|
58 |
* This constructs an instance of ThaiLayoutEngine for the given font, script and
|
|
59 |
* language. It examines the font, using LEFontInstance::canDisplay, to set fGlyphSet
|
|
60 |
* and fErrorChar. (see below)
|
|
61 |
*
|
|
62 |
* @param fontInstance - the font
|
|
63 |
* @param scriptCode - the script
|
|
64 |
* @param languageCode - the language
|
7486
|
65 |
* @param success - set to an error code if the operation fails
|
2
|
66 |
*
|
|
67 |
* @see LEFontInstance
|
|
68 |
* @see ScriptAndLanguageTags.h for script and language codes
|
|
69 |
*
|
|
70 |
* @internal
|
|
71 |
*/
|
7486
|
72 |
ThaiLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, LEErrorCode &success);
|
2
|
73 |
|
|
74 |
/**
|
|
75 |
* The destructor, virtual for correct polymorphic invocation.
|
|
76 |
*
|
|
77 |
* @internal
|
|
78 |
*/
|
|
79 |
virtual ~ThaiLayoutEngine();
|
|
80 |
|
3935
|
81 |
/**
|
|
82 |
* ICU "poor man's RTTI", returns a UClassID for the actual class.
|
|
83 |
*
|
|
84 |
* @stable ICU 2.8
|
|
85 |
*/
|
|
86 |
virtual UClassID getDynamicClassID() const;
|
|
87 |
|
|
88 |
/**
|
|
89 |
* ICU "poor man's RTTI", returns a UClassID for this class.
|
|
90 |
*
|
|
91 |
* @stable ICU 2.8
|
|
92 |
*/
|
|
93 |
static UClassID getStaticClassID();
|
|
94 |
|
2
|
95 |
protected:
|
|
96 |
/**
|
|
97 |
* A small integer indicating which Thai encoding
|
|
98 |
* the font uses.
|
|
99 |
*
|
|
100 |
* @see ThaiShaping
|
|
101 |
*
|
|
102 |
* @internal
|
|
103 |
*/
|
|
104 |
le_uint8 fGlyphSet;
|
|
105 |
|
|
106 |
/**
|
|
107 |
* The character used as a base for vowels and
|
|
108 |
* tone marks that are out of sequence. Usually
|
|
109 |
* this will be Unicode 0x25CC, if the font can
|
|
110 |
* display it.
|
|
111 |
*
|
|
112 |
* @see ThaiShaping
|
|
113 |
*
|
|
114 |
* @internal
|
|
115 |
*/
|
|
116 |
LEUnicode fErrorChar;
|
|
117 |
|
|
118 |
/**
|
|
119 |
* This method performs Thai layout. It calls ThaiShaping::compose to
|
|
120 |
* generate the correct contextual character codes, and then calls
|
|
121 |
* mapCharsToGlyphs to generate the glyph indices.
|
|
122 |
*
|
|
123 |
* Input parameters:
|
|
124 |
* @param chars - the input character context
|
|
125 |
* @param offset - the index of the first character to process
|
|
126 |
* @param count - the number of characters to process
|
|
127 |
* @param max - the number of characters in the input context
|
3935
|
128 |
* @param rightToLeft - <code>TRUE</code> if the text is in a right to left directional run
|
|
129 |
* @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set.
|
2
|
130 |
*
|
|
131 |
* Output parameters:
|
|
132 |
* @param success - set to an error code if the operation fails
|
|
133 |
*
|
|
134 |
* @return the number of glyphs in the glyph index array
|
|
135 |
*
|
|
136 |
* @see ThaiShaping
|
|
137 |
*
|
|
138 |
* @internal
|
|
139 |
*/
|
3935
|
140 |
virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
|
2
|
141 |
LEGlyphStorage &glyphStorage, LEErrorCode &success);
|
|
142 |
|
7486
|
143 |
/**
|
|
144 |
* This method does positioning adjustments like accent positioning and
|
|
145 |
* kerning. The default implementation does nothing. Subclasses needing
|
|
146 |
* position adjustments must override this method.
|
|
147 |
*
|
|
148 |
* Note that this method has both characters and glyphs as input so that
|
|
149 |
* it can use the character codes to determine glyph types if that information
|
|
150 |
* isn't directly available. (e.g. Some Arabic OpenType fonts don't have a GDEF
|
|
151 |
* table)
|
|
152 |
*
|
|
153 |
* @param chars - the input character context
|
|
154 |
* @param offset - the offset of the first character to process
|
|
155 |
* @param count - the number of characters to process
|
|
156 |
* @param reverse - <code>TRUE</code> if the glyphs in the glyph array have been reordered
|
|
157 |
* @param glyphStorage - the object which holds the per-glyph storage. The glyph positions will be
|
|
158 |
* adjusted as needed.
|
|
159 |
* @param success - output parameter set to an error code if the operation fails
|
|
160 |
*
|
|
161 |
* @internal
|
|
162 |
*/
|
|
163 |
virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
|
|
164 |
|
2
|
165 |
};
|
|
166 |
|
3935
|
167 |
U_NAMESPACE_END
|
2
|
168 |
#endif
|
3935
|
169 |
|