sl@0
|
1 |
|
sl@0
|
2 |
/*
|
sl@0
|
3 |
*
|
sl@0
|
4 |
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
|
sl@0
|
5 |
*
|
sl@0
|
6 |
*/
|
sl@0
|
7 |
|
sl@0
|
8 |
#ifndef __LAYOUTENGINE_H
|
sl@0
|
9 |
#define __LAYOUTENGINE_H
|
sl@0
|
10 |
|
sl@0
|
11 |
#include "LETypes.h"
|
sl@0
|
12 |
|
sl@0
|
13 |
/**
|
sl@0
|
14 |
* \file
|
sl@0
|
15 |
* \brief C++ API: Virtual base class for complex text layout.
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
U_NAMESPACE_BEGIN
|
sl@0
|
19 |
|
sl@0
|
20 |
class LEFontInstance;
|
sl@0
|
21 |
class LEGlyphFilter;
|
sl@0
|
22 |
class LEGlyphStorage;
|
sl@0
|
23 |
|
sl@0
|
24 |
/**
|
sl@0
|
25 |
* This is a virtual base class used to do complex text layout. The text must all
|
sl@0
|
26 |
* be in a single font, script, and language. An instance of a LayoutEngine can be
|
sl@0
|
27 |
* created by calling the layoutEngineFactory method. Fonts are identified by
|
sl@0
|
28 |
* instances of the LEFontInstance class. Script and language codes are identified
|
sl@0
|
29 |
* by integer codes, which are defined in ScriptAndLanuageTags.h.
|
sl@0
|
30 |
*
|
sl@0
|
31 |
* Note that this class is not public API. It is declared public so that it can be
|
sl@0
|
32 |
* exported from the library that it is a part of.
|
sl@0
|
33 |
*
|
sl@0
|
34 |
* The input to the layout process is an array of characters in logical order,
|
sl@0
|
35 |
* and a starting X, Y position for the text. The output is an array of glyph indices,
|
sl@0
|
36 |
* an array of character indices for the glyphs, and an array of glyph positions.
|
sl@0
|
37 |
* These arrays are protected members of LayoutEngine which can be retreived by a
|
sl@0
|
38 |
* public method. The reset method can be called to free these arrays so that the
|
sl@0
|
39 |
* LayoutEngine can be reused.
|
sl@0
|
40 |
*
|
sl@0
|
41 |
* The layout process is done in three steps. There is a protected virtual method
|
sl@0
|
42 |
* for each step. These methods have a default implementation which only does
|
sl@0
|
43 |
* character to glyph mapping and default positioning using the glyph's advance
|
sl@0
|
44 |
* widths. Subclasses can override these methods for more advanced layout.
|
sl@0
|
45 |
* There is a public method which invokes the steps in the correct order.
|
sl@0
|
46 |
*
|
sl@0
|
47 |
* The steps are:
|
sl@0
|
48 |
*
|
sl@0
|
49 |
* 1) Glyph processing - character to glyph mapping and any other glyph processing
|
sl@0
|
50 |
* such as ligature substitution and contextual forms.
|
sl@0
|
51 |
*
|
sl@0
|
52 |
* 2) Glyph positioning - position the glyphs based on their advance widths.
|
sl@0
|
53 |
*
|
sl@0
|
54 |
* 3) Glyph position adjustments - adjustment of glyph positions for kerning,
|
sl@0
|
55 |
* accent placement, etc.
|
sl@0
|
56 |
*
|
sl@0
|
57 |
* NOTE: in all methods below, output parameters are references to pointers so
|
sl@0
|
58 |
* the method can allocate and free the storage as needed. All storage allocated
|
sl@0
|
59 |
* in this way is owned by the object which created it, and will be freed when it
|
sl@0
|
60 |
* is no longer needed, or when the object's destructor is invoked.
|
sl@0
|
61 |
*
|
sl@0
|
62 |
* @see LEFontInstance
|
sl@0
|
63 |
* @see ScriptAndLanguageTags.h
|
sl@0
|
64 |
*
|
sl@0
|
65 |
* @stable ICU 2.8
|
sl@0
|
66 |
*/
|
sl@0
|
67 |
class U_LAYOUT_API LayoutEngine : public UObject {
|
sl@0
|
68 |
protected:
|
sl@0
|
69 |
/**
|
sl@0
|
70 |
* The object which holds the glyph storage
|
sl@0
|
71 |
*
|
sl@0
|
72 |
* @internal
|
sl@0
|
73 |
*/
|
sl@0
|
74 |
LEGlyphStorage *fGlyphStorage;
|
sl@0
|
75 |
|
sl@0
|
76 |
/**
|
sl@0
|
77 |
* The font instance for the text font.
|
sl@0
|
78 |
*
|
sl@0
|
79 |
* @see LEFontInstance
|
sl@0
|
80 |
*
|
sl@0
|
81 |
* @internal
|
sl@0
|
82 |
*/
|
sl@0
|
83 |
const LEFontInstance *fFontInstance;
|
sl@0
|
84 |
|
sl@0
|
85 |
/**
|
sl@0
|
86 |
* The script code for the text
|
sl@0
|
87 |
*
|
sl@0
|
88 |
* @see ScriptAndLanguageTags.h for script codes.
|
sl@0
|
89 |
*
|
sl@0
|
90 |
* @internal
|
sl@0
|
91 |
*/
|
sl@0
|
92 |
le_int32 fScriptCode;
|
sl@0
|
93 |
|
sl@0
|
94 |
/**
|
sl@0
|
95 |
* The langauge code for the text
|
sl@0
|
96 |
*
|
sl@0
|
97 |
* @see ScriptAndLanguageTags.h for language codes.
|
sl@0
|
98 |
*
|
sl@0
|
99 |
* @internal
|
sl@0
|
100 |
*/
|
sl@0
|
101 |
le_int32 fLanguageCode;
|
sl@0
|
102 |
|
sl@0
|
103 |
/**
|
sl@0
|
104 |
* The typographic control flags
|
sl@0
|
105 |
*
|
sl@0
|
106 |
* @internal
|
sl@0
|
107 |
*/
|
sl@0
|
108 |
le_int32 fTypoFlags;
|
sl@0
|
109 |
|
sl@0
|
110 |
/**
|
sl@0
|
111 |
* The glyph ID of Malayalam RA for RAKAR
|
sl@0
|
112 |
*
|
sl@0
|
113 |
* @internal
|
sl@0
|
114 |
*/
|
sl@0
|
115 |
LEGlyphID fGidOfRA;
|
sl@0
|
116 |
|
sl@0
|
117 |
/**
|
sl@0
|
118 |
* This constructs an instance for a given font, script and language. Subclass constructors
|
sl@0
|
119 |
* must call this constructor.
|
sl@0
|
120 |
*
|
sl@0
|
121 |
* @param fontInstance - the font for the text
|
sl@0
|
122 |
* @param scriptCode - the script for the text
|
sl@0
|
123 |
* @param languageCode - the language for the text
|
sl@0
|
124 |
* @param typoFlags - the typographic control flags for the text. Set bit 1 if kerning
|
sl@0
|
125 |
* is desired, set bit 2 if ligature formation is desired. Others are reserved.
|
sl@0
|
126 |
*
|
sl@0
|
127 |
* @see LEFontInstance
|
sl@0
|
128 |
* @see ScriptAndLanguageTags.h
|
sl@0
|
129 |
*
|
sl@0
|
130 |
* @internal
|
sl@0
|
131 |
*/
|
sl@0
|
132 |
LayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags);
|
sl@0
|
133 |
|
sl@0
|
134 |
/**
|
sl@0
|
135 |
* Returns true if the constructor failed, leaving the object in an
|
sl@0
|
136 |
* inconsistent state.
|
sl@0
|
137 |
*
|
sl@0
|
138 |
* @internal
|
sl@0
|
139 |
*/
|
sl@0
|
140 |
le_bool isBogus();
|
sl@0
|
141 |
|
sl@0
|
142 |
/**
|
sl@0
|
143 |
* This overrides the default no argument constructor to make it
|
sl@0
|
144 |
* difficult for clients to call it. Clients are expected to call
|
sl@0
|
145 |
* layoutEngineFactory.
|
sl@0
|
146 |
*
|
sl@0
|
147 |
* @internal
|
sl@0
|
148 |
*/
|
sl@0
|
149 |
LayoutEngine();
|
sl@0
|
150 |
|
sl@0
|
151 |
/**
|
sl@0
|
152 |
* This method does any required pre-processing to the input characters. It
|
sl@0
|
153 |
* may generate output characters that differ from the input charcters due to
|
sl@0
|
154 |
* insertions, deletions, or reorderings. In such cases, it will also generate an
|
sl@0
|
155 |
* output character index array reflecting these changes.
|
sl@0
|
156 |
*
|
sl@0
|
157 |
* Subclasses must override this method.
|
sl@0
|
158 |
*
|
sl@0
|
159 |
* Input parameters:
|
sl@0
|
160 |
* @param chars - the input character context
|
sl@0
|
161 |
* @param offset - the index of the first character to process
|
sl@0
|
162 |
* @param count - the number of characters to process
|
sl@0
|
163 |
* @param max - the number of characters in the input context
|
sl@0
|
164 |
* @param rightToLeft - TRUE if the characters are in a right to left directional run
|
sl@0
|
165 |
* @param outChars - the output character array, if different from the input
|
sl@0
|
166 |
* @param glyphStorage - the object that holds the per-glyph storage. The character index array may be set.
|
sl@0
|
167 |
* @param success - set to an error code if the operation fails
|
sl@0
|
168 |
*
|
sl@0
|
169 |
* @return the output character count (input character count if no change)
|
sl@0
|
170 |
*
|
sl@0
|
171 |
* @internal
|
sl@0
|
172 |
*/
|
sl@0
|
173 |
virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
|
sl@0
|
174 |
LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
|
sl@0
|
175 |
|
sl@0
|
176 |
/**
|
sl@0
|
177 |
* This method does the glyph processing. It converts an array of characters
|
sl@0
|
178 |
* into an array of glyph indices and character indices. The characters to be
|
sl@0
|
179 |
* processed are passed in a surrounding context. The context is specified as
|
sl@0
|
180 |
* a starting address and a maximum character count. An offset and a count are
|
sl@0
|
181 |
* used to specify the characters to be processed.
|
sl@0
|
182 |
*
|
sl@0
|
183 |
* The default implementation of this method only does character to glyph mapping.
|
sl@0
|
184 |
* Subclasses needing more elaborate glyph processing must override this method.
|
sl@0
|
185 |
*
|
sl@0
|
186 |
* Input parameters:
|
sl@0
|
187 |
* @param chars - the character context
|
sl@0
|
188 |
* @param offset - the offset of the first character to process
|
sl@0
|
189 |
* @param count - the number of characters to process
|
sl@0
|
190 |
* @param max - the number of characters in the context.
|
sl@0
|
191 |
* @param rightToLeft - TRUE if the text is in a right to left directional run
|
sl@0
|
192 |
* @param glyphStorage - the object which holds the per-glyph storage. The glyph and char indices arrays
|
sl@0
|
193 |
* will be set.
|
sl@0
|
194 |
*
|
sl@0
|
195 |
* Output parameters:
|
sl@0
|
196 |
* @param success - set to an error code if the operation fails
|
sl@0
|
197 |
*
|
sl@0
|
198 |
* @return the number of glyphs in the glyph index array
|
sl@0
|
199 |
*
|
sl@0
|
200 |
* @internal
|
sl@0
|
201 |
*/
|
sl@0
|
202 |
virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
|
sl@0
|
203 |
|
sl@0
|
204 |
/**
|
sl@0
|
205 |
* This method does basic glyph positioning. The default implementation positions
|
sl@0
|
206 |
* the glyphs based on their advance widths. This is sufficient for most uses. It
|
sl@0
|
207 |
* is not expected that many subclasses will override this method.
|
sl@0
|
208 |
*
|
sl@0
|
209 |
* Input parameters:
|
sl@0
|
210 |
* @param glyphStorage - the object which holds the per-glyph storage. The glyph position array will be set.
|
sl@0
|
211 |
* @param x - the starting X position
|
sl@0
|
212 |
* @param y - the starting Y position
|
sl@0
|
213 |
* @param success - set to an error code if the operation fails
|
sl@0
|
214 |
*
|
sl@0
|
215 |
* @internal
|
sl@0
|
216 |
*/
|
sl@0
|
217 |
virtual void positionGlyphs(LEGlyphStorage &glyphStorage, float x, float y, LEErrorCode &success);
|
sl@0
|
218 |
|
sl@0
|
219 |
/**
|
sl@0
|
220 |
* This method does positioning adjustments like accent positioning and
|
sl@0
|
221 |
* kerning. The default implementation does nothing. Subclasses needing
|
sl@0
|
222 |
* position adjustments must override this method.
|
sl@0
|
223 |
*
|
sl@0
|
224 |
* Note that this method has both characters and glyphs as input so that
|
sl@0
|
225 |
* it can use the character codes to determine glyph types if that information
|
sl@0
|
226 |
* isn't directly available. (e.g. Some Arabic OpenType fonts don't have a GDEF
|
sl@0
|
227 |
* table)
|
sl@0
|
228 |
*
|
sl@0
|
229 |
* @param chars - the input character context
|
sl@0
|
230 |
* @param offset - the offset of the first character to process
|
sl@0
|
231 |
* @param count - the number of characters to process
|
sl@0
|
232 |
* @param reverse - <code>TRUE</code> if the glyphs in the glyph array have been reordered
|
sl@0
|
233 |
* @param glyphStorage - the object which holds the per-glyph storage. The glyph positions will be
|
sl@0
|
234 |
* adjusted as needed.
|
sl@0
|
235 |
* @param success - output parameter set to an error code if the operation fails
|
sl@0
|
236 |
*
|
sl@0
|
237 |
* @internal
|
sl@0
|
238 |
*/
|
sl@0
|
239 |
virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
|
sl@0
|
240 |
|
sl@0
|
241 |
/**
|
sl@0
|
242 |
* This method gets a table from the font associated with
|
sl@0
|
243 |
* the text. The default implementation gets the table from
|
sl@0
|
244 |
* the font instance. Subclasses which need to get the tables
|
sl@0
|
245 |
* some other way must override this method.
|
sl@0
|
246 |
*
|
sl@0
|
247 |
* @param tableTag - the four byte table tag.
|
sl@0
|
248 |
*
|
sl@0
|
249 |
* @return the address of the table.
|
sl@0
|
250 |
*
|
sl@0
|
251 |
* @internal
|
sl@0
|
252 |
*/
|
sl@0
|
253 |
virtual const void *getFontTable(LETag tableTag) const;
|
sl@0
|
254 |
|
sl@0
|
255 |
/**
|
sl@0
|
256 |
* This method does character to glyph mapping. The default implementation
|
sl@0
|
257 |
* uses the font instance to do the mapping. It will allocate the glyph and
|
sl@0
|
258 |
* character index arrays if they're not already allocated. If it allocates the
|
sl@0
|
259 |
* character index array, it will fill it it.
|
sl@0
|
260 |
*
|
sl@0
|
261 |
* This method supports right to left
|
sl@0
|
262 |
* text with the ability to store the glyphs in reverse order, and by supporting
|
sl@0
|
263 |
* character mirroring, which will replace a character which has a left and right
|
sl@0
|
264 |
* form, such as parens, with the opposite form before mapping it to a glyph index.
|
sl@0
|
265 |
*
|
sl@0
|
266 |
* Input parameters:
|
sl@0
|
267 |
* @param chars - the input character context
|
sl@0
|
268 |
* @param offset - the offset of the first character to be mapped
|
sl@0
|
269 |
* @param count - the number of characters to be mapped
|
sl@0
|
270 |
* @param reverse - if <code>TRUE</code>, the output will be in reverse order
|
sl@0
|
271 |
* @param mirror - if <code>TRUE</code>, do character mirroring
|
sl@0
|
272 |
* @param glyphStorage - the object which holds the per-glyph storage. The glyph and char
|
sl@0
|
273 |
* indices arrays will be filled in.
|
sl@0
|
274 |
* @param success - set to an error code if the operation fails
|
sl@0
|
275 |
*
|
sl@0
|
276 |
* @see LEFontInstance
|
sl@0
|
277 |
*
|
sl@0
|
278 |
* @internal
|
sl@0
|
279 |
*/
|
sl@0
|
280 |
virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror, LEGlyphStorage &glyphStorage, LEErrorCode &success);
|
sl@0
|
281 |
|
sl@0
|
282 |
/**
|
sl@0
|
283 |
* This is a convenience method that forces the advance width of mark
|
sl@0
|
284 |
* glyphs to be zero, which is required for proper selection and highlighting.
|
sl@0
|
285 |
*
|
sl@0
|
286 |
* @param glyphStorage - the object containing the per-glyph storage. The positions array will be modified.
|
sl@0
|
287 |
* @param markFilter - used to identify mark glyphs
|
sl@0
|
288 |
* @param success - output parameter set to an error code if the operation fails
|
sl@0
|
289 |
*
|
sl@0
|
290 |
* @see LEGlyphFilter
|
sl@0
|
291 |
*
|
sl@0
|
292 |
* @internal
|
sl@0
|
293 |
*/
|
sl@0
|
294 |
static void adjustMarkGlyphs(LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success);
|
sl@0
|
295 |
|
sl@0
|
296 |
|
sl@0
|
297 |
/**
|
sl@0
|
298 |
* This is a convenience method that forces the advance width of mark
|
sl@0
|
299 |
* glyphs to be zero, which is required for proper selection and highlighting.
|
sl@0
|
300 |
* This method uses the input characters to identify marks. This is required in
|
sl@0
|
301 |
* cases where the font does not contain enough information to identify them based
|
sl@0
|
302 |
* on the glyph IDs.
|
sl@0
|
303 |
*
|
sl@0
|
304 |
* @param chars - the array of input characters
|
sl@0
|
305 |
* @param charCount - the number of input characers
|
sl@0
|
306 |
* @param glyphStorage - the object containing the per-glyph storage. The positions array will be modified.
|
sl@0
|
307 |
* @param reverse - <code>TRUE</code> if the glyph array has been reordered
|
sl@0
|
308 |
* @param markFilter - used to identify mark glyphs
|
sl@0
|
309 |
* @param success - output parameter set to an error code if the operation fails
|
sl@0
|
310 |
*
|
sl@0
|
311 |
* @see LEGlyphFilter
|
sl@0
|
312 |
*
|
sl@0
|
313 |
* @internal
|
sl@0
|
314 |
*/
|
sl@0
|
315 |
static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 charCount, le_bool reverse, LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success);
|
sl@0
|
316 |
|
sl@0
|
317 |
|
sl@0
|
318 |
public:
|
sl@0
|
319 |
/**
|
sl@0
|
320 |
* The destructor. It will free any storage allocated for the
|
sl@0
|
321 |
* glyph, character index and position arrays by calling the reset
|
sl@0
|
322 |
* method. It is declared virtual so that it will be invoked by the
|
sl@0
|
323 |
* subclass destructors.
|
sl@0
|
324 |
*
|
sl@0
|
325 |
* @stable ICU 2.8
|
sl@0
|
326 |
*/
|
sl@0
|
327 |
virtual ~LayoutEngine();
|
sl@0
|
328 |
|
sl@0
|
329 |
/**
|
sl@0
|
330 |
* This method will invoke the layout steps in their correct order by calling
|
sl@0
|
331 |
* the computeGlyphs, positionGlyphs and adjustGlyphPosition methods.. It will
|
sl@0
|
332 |
* compute the glyph, character index and position arrays.
|
sl@0
|
333 |
*
|
sl@0
|
334 |
* @param chars - the input character context
|
sl@0
|
335 |
* @param offset - the offset of the first character to process
|
sl@0
|
336 |
* @param count - the number of characters to process
|
sl@0
|
337 |
* @param max - the number of characters in the input context
|
sl@0
|
338 |
* @param rightToLeft - TRUE if the characers are in a right to left directional run
|
sl@0
|
339 |
* @param x - the initial X position
|
sl@0
|
340 |
* @param y - the initial Y position
|
sl@0
|
341 |
* @param success - output parameter set to an error code if the operation fails
|
sl@0
|
342 |
*
|
sl@0
|
343 |
* @return the number of glyphs in the glyph array
|
sl@0
|
344 |
*
|
sl@0
|
345 |
* Note; the glyph, character index and position array can be accessed
|
sl@0
|
346 |
* using the getter method below.
|
sl@0
|
347 |
*
|
sl@0
|
348 |
* @stable ICU 2.8
|
sl@0
|
349 |
*/
|
sl@0
|
350 |
virtual le_int32 layoutChars(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, float x, float y, LEErrorCode &success);
|
sl@0
|
351 |
|
sl@0
|
352 |
/**
|
sl@0
|
353 |
* This method returns the number of glyphs in the glyph array. Note
|
sl@0
|
354 |
* that the number of glyphs will be greater than or equal to the number
|
sl@0
|
355 |
* of characters used to create the LayoutEngine.
|
sl@0
|
356 |
*
|
sl@0
|
357 |
* @return the number of glyphs in the glyph array
|
sl@0
|
358 |
*
|
sl@0
|
359 |
* @stable ICU 2.8
|
sl@0
|
360 |
*/
|
sl@0
|
361 |
le_int32 getGlyphCount() const;
|
sl@0
|
362 |
|
sl@0
|
363 |
/**
|
sl@0
|
364 |
* This method copies the glyph array into a caller supplied array.
|
sl@0
|
365 |
* The caller must ensure that the array is large enough to hold all
|
sl@0
|
366 |
* the glyphs.
|
sl@0
|
367 |
*
|
sl@0
|
368 |
* @param glyphs - the destiniation glyph array
|
sl@0
|
369 |
* @param success - set to an error code if the operation fails
|
sl@0
|
370 |
*
|
sl@0
|
371 |
* @stable ICU 2.8
|
sl@0
|
372 |
*/
|
sl@0
|
373 |
void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const;
|
sl@0
|
374 |
|
sl@0
|
375 |
/**
|
sl@0
|
376 |
* This method copies the glyph array into a caller supplied array,
|
sl@0
|
377 |
* ORing in extra bits. (This functionality is needed by the JDK,
|
sl@0
|
378 |
* which uses 32 bits pre glyph idex, with the high 16 bits encoding
|
sl@0
|
379 |
* the composite font slot number)
|
sl@0
|
380 |
*
|
sl@0
|
381 |
* @param glyphs - the destination (32 bit) glyph array
|
sl@0
|
382 |
* @param extraBits - this value will be ORed with each glyph index
|
sl@0
|
383 |
* @param success - set to an error code if the operation fails
|
sl@0
|
384 |
*
|
sl@0
|
385 |
* @stable ICU 2.8
|
sl@0
|
386 |
*/
|
sl@0
|
387 |
virtual void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const;
|
sl@0
|
388 |
|
sl@0
|
389 |
/**
|
sl@0
|
390 |
* This method copies the character index array into a caller supplied array.
|
sl@0
|
391 |
* The caller must ensure that the array is large enough to hold a
|
sl@0
|
392 |
* character index for each glyph.
|
sl@0
|
393 |
*
|
sl@0
|
394 |
* @param charIndices - the destiniation character index array
|
sl@0
|
395 |
* @param success - set to an error code if the operation fails
|
sl@0
|
396 |
*
|
sl@0
|
397 |
* @stable ICU 2.8
|
sl@0
|
398 |
*/
|
sl@0
|
399 |
void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const;
|
sl@0
|
400 |
|
sl@0
|
401 |
/**
|
sl@0
|
402 |
* This method copies the character index array into a caller supplied array.
|
sl@0
|
403 |
* The caller must ensure that the array is large enough to hold a
|
sl@0
|
404 |
* character index for each glyph.
|
sl@0
|
405 |
*
|
sl@0
|
406 |
* @param charIndices - the destiniation character index array
|
sl@0
|
407 |
* @param indexBase - an offset which will be added to each index
|
sl@0
|
408 |
* @param success - set to an error code if the operation fails
|
sl@0
|
409 |
*
|
sl@0
|
410 |
* @stable ICU 2.8
|
sl@0
|
411 |
*/
|
sl@0
|
412 |
void getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const;
|
sl@0
|
413 |
|
sl@0
|
414 |
/**
|
sl@0
|
415 |
* This method copies the position array into a caller supplied array.
|
sl@0
|
416 |
* The caller must ensure that the array is large enough to hold an
|
sl@0
|
417 |
* X and Y position for each glyph, plus an extra X and Y for the
|
sl@0
|
418 |
* advance of the last glyph.
|
sl@0
|
419 |
*
|
sl@0
|
420 |
* @param positions - the destiniation position array
|
sl@0
|
421 |
* @param success - set to an error code if the operation fails
|
sl@0
|
422 |
*
|
sl@0
|
423 |
* @stable ICU 2.8
|
sl@0
|
424 |
*/
|
sl@0
|
425 |
void getGlyphPositions(float positions[], LEErrorCode &success) const;
|
sl@0
|
426 |
|
sl@0
|
427 |
/**
|
sl@0
|
428 |
* This method returns the X and Y position of the glyph at
|
sl@0
|
429 |
* the given index.
|
sl@0
|
430 |
*
|
sl@0
|
431 |
* Input parameters:
|
sl@0
|
432 |
* @param glyphIndex - the index of the glyph
|
sl@0
|
433 |
*
|
sl@0
|
434 |
* Output parameters:
|
sl@0
|
435 |
* @param x - the glyph's X position
|
sl@0
|
436 |
* @param y - the glyph's Y position
|
sl@0
|
437 |
* @param success - set to an error code if the operation fails
|
sl@0
|
438 |
*
|
sl@0
|
439 |
* @stable ICU 2.8
|
sl@0
|
440 |
*/
|
sl@0
|
441 |
void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const;
|
sl@0
|
442 |
|
sl@0
|
443 |
/**
|
sl@0
|
444 |
* This method frees the glyph, character index and position arrays
|
sl@0
|
445 |
* so that the LayoutEngine can be reused to layout a different
|
sl@0
|
446 |
* characer array. (This method is also called by the destructor)
|
sl@0
|
447 |
*
|
sl@0
|
448 |
* @stable ICU 2.8
|
sl@0
|
449 |
*/
|
sl@0
|
450 |
virtual void reset();
|
sl@0
|
451 |
|
sl@0
|
452 |
/**
|
sl@0
|
453 |
* This method returns a LayoutEngine capable of laying out text
|
sl@0
|
454 |
* in the given font, script and langauge. Note that the LayoutEngine
|
sl@0
|
455 |
* returned may be a subclass of LayoutEngine.
|
sl@0
|
456 |
*
|
sl@0
|
457 |
* @param fontInstance - the font of the text
|
sl@0
|
458 |
* @param scriptCode - the script of the text
|
sl@0
|
459 |
* @param languageCode - the language of the text
|
sl@0
|
460 |
* @param success - output parameter set to an error code if the operation fails
|
sl@0
|
461 |
*
|
sl@0
|
462 |
* @return a LayoutEngine which can layout text in the given font.
|
sl@0
|
463 |
*
|
sl@0
|
464 |
* @see LEFontInstance
|
sl@0
|
465 |
*
|
sl@0
|
466 |
* @stable ICU 2.8
|
sl@0
|
467 |
*/
|
sl@0
|
468 |
static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success);
|
sl@0
|
469 |
|
sl@0
|
470 |
/**
|
sl@0
|
471 |
* Override of existing call that provides flags to control typography.
|
sl@0
|
472 |
* @draft ICU 3.4
|
sl@0
|
473 |
*/
|
sl@0
|
474 |
static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typo_flags, LEErrorCode &success);
|
sl@0
|
475 |
|
sl@0
|
476 |
/**
|
sl@0
|
477 |
* ICU "poor man's RTTI", returns a UClassID for the actual class.
|
sl@0
|
478 |
*
|
sl@0
|
479 |
* @stable ICU 2.8
|
sl@0
|
480 |
*/
|
sl@0
|
481 |
virtual UClassID getDynamicClassID() const;
|
sl@0
|
482 |
|
sl@0
|
483 |
/**
|
sl@0
|
484 |
* ICU "poor man's RTTI", returns a UClassID for this class.
|
sl@0
|
485 |
*
|
sl@0
|
486 |
* @stable ICU 2.8
|
sl@0
|
487 |
*/
|
sl@0
|
488 |
static UClassID getStaticClassID();
|
sl@0
|
489 |
|
sl@0
|
490 |
};
|
sl@0
|
491 |
|
sl@0
|
492 |
U_NAMESPACE_END
|
sl@0
|
493 |
#endif
|
sl@0
|
494 |
|