3 * (C) Copyright IBM Corp. 1998-2011 - All Rights Reserved
12 #ifndef U_HIDE_INTERNAL_API
15 * \brief C API for complex text layout.
18 * This is a technology preview. The API may
19 * change significantly.
24 * The opaque type for a LayoutEngine.
28 typedef void le_engine
;
31 * The opaque type for a font instance.
38 * This function returns an le_engine capable of laying out text
39 * in the given font, script and langauge. Note that the LayoutEngine
40 * returned may be a subclass of LayoutEngine.
42 * @param font - the font of the text
43 * @param scriptCode - the script of the text
44 * @param languageCode - the language of the text
45 * @param typo_flags - flags that control layout features like kerning and ligatures.
46 * @param success - output parameter set to an error code if the operation fails
48 * @return an le_engine which can layout text in the given font.
52 U_INTERNAL le_engine
* U_EXPORT2
53 le_create(const le_font
*font
,
55 le_int32 languageCode
,
57 LEErrorCode
*success
);
60 * This function closes the given LayoutEngine. After
61 * it returns, the le_engine is no longer valid.
63 * @param engine - the LayoutEngine to close.
67 U_INTERNAL
void U_EXPORT2
68 le_close(le_engine
*engine
);
71 * This routine will compute the glyph, character index and position arrays.
73 * @param engine - the LayoutEngine
74 * @param chars - the input character context
75 * @param offset - the offset of the first character to process
76 * @param count - the number of characters to process
77 * @param max - the number of characters in the input context
78 * @param rightToLeft - TRUE if the characers are in a right to left directional run
79 * @param x - the initial X position
80 * @param y - the initial Y position
81 * @param success - output parameter set to an error code if the operation fails
83 * @return the number of glyphs in the glyph array
85 * Note: The glyph, character index and position array can be accessed
86 * using the getter routines below.
88 * Note: If you call this function more than once, you must call the reset()
89 * function first to free the glyph, character index and position arrays
90 * allocated by the previous call.
94 U_INTERNAL le_int32 U_EXPORT2
95 le_layoutChars(le_engine
*engine
,
96 const LEUnicode chars
[],
103 LEErrorCode
*success
);
106 * This function returns the number of glyphs in the glyph array. Note
107 * that the number of glyphs will be greater than or equal to the number
108 * of characters used to create the LayoutEngine.
110 * @param engine - the LayoutEngine
111 * @param success - output parameter set to an error code if the operation fails.
113 * @return the number of glyphs in the glyph array
117 U_INTERNAL le_int32 U_EXPORT2
118 le_getGlyphCount(le_engine
*engine
,
119 LEErrorCode
*success
);
122 * This function copies the glyph array into a caller supplied array.
123 * The caller must ensure that the array is large enough to hold all
126 * @param engine - the LayoutEngine
127 * @param glyphs - the destiniation glyph array
128 * @param success - set to an error code if the operation fails
132 U_INTERNAL
void U_EXPORT2
133 le_getGlyphs(le_engine
*engine
,
135 LEErrorCode
*success
);
138 * This function copies the character index array into a caller supplied array.
139 * The caller must ensure that the array is large enough to hold a
140 * character index for each glyph.
142 * @param engine - the LayoutEngine
143 * @param charIndices - the destiniation character index array
144 * @param success - set to an error code if the operation fails
148 U_INTERNAL
void U_EXPORT2
149 le_getCharIndices(le_engine
*engine
,
150 le_int32 charIndices
[],
151 LEErrorCode
*success
);
154 * This function copies the character index array into a caller supplied array.
155 * The caller must ensure that the array is large enough to hold a
156 * character index for each glyph.
158 * @param engine - the LayoutEngine
159 * @param charIndices - the destiniation character index array
160 * @param indexBase - an offset that will be added to each index.
161 * @param success - set to an error code if the operation fails
165 U_INTERNAL
void U_EXPORT2
166 le_getCharIndicesWithBase(le_engine
*engine
,
167 le_int32 charIndices
[],
169 LEErrorCode
*success
);
172 * This function copies the position array into a caller supplied array.
173 * The caller must ensure that the array is large enough to hold an
174 * X and Y position for each glyph, plus an extra X and Y for the
175 * advance of the last glyph.
177 * @param engine - the LayoutEngine
178 * @param positions - the destiniation position array
179 * @param success - set to an error code if the operation fails
183 U_INTERNAL
void U_EXPORT2
184 le_getGlyphPositions(le_engine
*engine
,
186 LEErrorCode
*success
);
189 * This function returns the X and Y position of the glyph at
193 * @param engine - the LayoutEngine
194 * @param glyphIndex - the index of the glyph
197 * @param x - the glyph's X position
198 * @param y - the glyph's Y position
199 * @param success - set to an error code if the operation fails
203 U_INTERNAL
void U_EXPORT2
204 le_getGlyphPosition(le_engine
*engine
,
208 LEErrorCode
*success
);
211 * This function frees the glyph, character index and position arrays
212 * so that the LayoutEngine can be reused to layout a different
213 * characer array. (This function is also called by le_close)
215 * @param engine - the LayoutEngine
216 * @param success - set to an error code if the operation fails
220 U_INTERNAL
void U_EXPORT2
221 le_reset(le_engine
*engine
,
222 LEErrorCode
*success
);
223 #endif /* U_HIDE_INTERNAL_API */