3 * (C) Copyright IBM Corp. 1998-2007 - All Rights Reserved
14 * \brief C API for complex text layout.
17 * This is a technology preview. The API may
18 * change significantly.
23 * The opaque type for a LayoutEngine.
27 typedef void le_engine
;
30 * The opaque type for a font instance.
37 * This function returns an le_engine capable of laying out text
38 * in the given font, script and langauge. Note that the LayoutEngine
39 * returned may be a subclass of LayoutEngine.
41 * @param font - the font of the text
42 * @param scriptCode - the script of the text
43 * @param languageCode - the language of the text
44 * @param typo_flags - flags that control layout features like kerning and ligatures.
45 * @param success - output parameter set to an error code if the operation fails
47 * @return an le_engine which can layout text in the given font.
51 U_INTERNAL le_engine
* U_EXPORT2
52 le_create(const le_font
*font
,
54 le_int32 languageCode
,
56 LEErrorCode
*success
);
59 * This function closes the given LayoutEngine. After
60 * it returns, the le_engine is no longer valid.
62 * @param engine - the LayoutEngine to close.
66 U_INTERNAL
void U_EXPORT2
67 le_close(le_engine
*engine
);
70 * This routine will compute the glyph, character index and position arrays.
72 * @param engine - the LayoutEngine
73 * @param chars - the input character context
74 * @param offset - the offset of the first character to process
75 * @param count - the number of characters to process
76 * @param max - the number of characters in the input context
77 * @param rightToLeft - TRUE if the characers are in a right to left directional run
78 * @param x - the initial X position
79 * @param y - the initial Y position
80 * @param success - output parameter set to an error code if the operation fails
82 * @return the number of glyphs in the glyph array
84 * Note: The glyph, character index and position array can be accessed
85 * using the getter routines below.
87 * Note: If you call this function more than once, you must call the reset()
88 * function first to free the glyph, character index and position arrays
89 * allocated by the previous call.
93 U_INTERNAL le_int32 U_EXPORT2
94 le_layoutChars(le_engine
*engine
,
95 const LEUnicode chars
[],
102 LEErrorCode
*success
);
105 * This function returns the number of glyphs in the glyph array. Note
106 * that the number of glyphs will be greater than or equal to the number
107 * of characters used to create the LayoutEngine.
109 * @param engine - the LayoutEngine
110 * @param success - output parameter set to an error code if the operation fails.
112 * @return the number of glyphs in the glyph array
116 U_INTERNAL le_int32 U_EXPORT2
117 le_getGlyphCount(le_engine
*engine
,
118 LEErrorCode
*success
);
121 * This function copies the glyph array into a caller supplied array.
122 * The caller must ensure that the array is large enough to hold all
125 * @param engine - the LayoutEngine
126 * @param glyphs - the destiniation glyph array
127 * @param success - set to an error code if the operation fails
131 U_INTERNAL
void U_EXPORT2
132 le_getGlyphs(le_engine
*engine
,
134 LEErrorCode
*success
);
137 * This function copies the character index array into a caller supplied array.
138 * The caller must ensure that the array is large enough to hold a
139 * character index for each glyph.
141 * @param engine - the LayoutEngine
142 * @param charIndices - the destiniation character index array
143 * @param success - set to an error code if the operation fails
147 U_INTERNAL
void U_EXPORT2
148 le_getCharIndices(le_engine
*engine
,
149 le_int32 charIndices
[],
150 LEErrorCode
*success
);
153 * This function copies the character index array into a caller supplied array.
154 * The caller must ensure that the array is large enough to hold a
155 * character index for each glyph.
157 * @param engine - the LayoutEngine
158 * @param charIndices - the destiniation character index array
159 * @param indexBase - an offset that will be added to each index.
160 * @param success - set to an error code if the operation fails
164 U_INTERNAL
void U_EXPORT2
165 le_getCharIndicesWithBase(le_engine
*engine
,
166 le_int32 charIndices
[],
168 LEErrorCode
*success
);
171 * This function copies the position array into a caller supplied array.
172 * The caller must ensure that the array is large enough to hold an
173 * X and Y position for each glyph, plus an extra X and Y for the
174 * advance of the last glyph.
176 * @param engine - the LayoutEngine
177 * @param positions - the destiniation position array
178 * @param success - set to an error code if the operation fails
182 U_INTERNAL
void U_EXPORT2
183 le_getGlyphPositions(le_engine
*engine
,
185 LEErrorCode
*success
);
188 * This function returns the X and Y position of the glyph at
192 * @param engine - the LayoutEngine
193 * @param glyphIndex - the index of the glyph
196 * @param x - the glyph's X position
197 * @param y - the glyph's Y position
198 * @param success - set to an error code if the operation fails
202 U_INTERNAL
void U_EXPORT2
203 le_getGlyphPosition(le_engine
*engine
,
207 LEErrorCode
*success
);
210 * This function frees the glyph, character index and position arrays
211 * so that the LayoutEngine can be reused to layout a different
212 * characer array. (This function is also called by le_close)
214 * @param engine - the LayoutEngine
215 * @param success - set to an error code if the operation fails
219 U_INTERNAL
void U_EXPORT2
220 le_reset(le_engine
*engine
,
221 LEErrorCode
*success
);