3 * (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved
10 #include "unicode/utypes.h"
11 #include "unicode/ubidi.h"
12 #include "layout/LETypes.h"
14 #include "layout/loengine.h"
17 * Opaque datatype representing an array of font runs
19 typedef void pl_fontRuns
;
21 * Opaque datatype representing an array of value runs
23 typedef void pl_valueRuns
;
25 * Opaque datatype representing an array of locale runs
27 typedef void pl_localeRuns
;
31 * \brief C API for run arrays.
33 * This is a technology preview. The API may
34 * change significantly.
39 * Construct a <code>pl_fontRuns</code> object from pre-existing arrays of fonts
42 * @param fonts is the address of an array of pointers to <code>le_font</code> objects. This
43 * array, and the <code>le_font</code> objects to which it points must remain
44 * valid until the <code>pl_fontRuns</code> object is closed.
46 * @param limits is the address of an array of limit indices. This array must remain valid until
47 * the <code>pl_fontRuns</code> object is closed.
49 * @param count is the number of entries in the two arrays.
53 U_INTERNAL pl_fontRuns
* U_EXPORT2
54 pl_openFontRuns(const le_font
**fonts
,
55 const le_int32
*limits
,
59 * Construct an empty <code>pl_fontRuns</code> object. Clients can add font and limit
60 * indices arrays using the <code>pl_addFontRun</code> routine.
62 * @param initialCapacity is the initial size of the font and limit indices arrays. If
63 * this value is zero, no arrays will be allocated.
69 U_INTERNAL pl_fontRuns
* U_EXPORT2
70 pl_openEmptyFontRuns(le_int32 initialCapacity
);
73 * Close the given <code>pl_fontRuns</code> object. Once this
74 * call returns, the object can no longer be referenced.
76 * @param fontRuns is the <code>pl_fontRuns</code> object.
80 U_INTERNAL
void U_EXPORT2
81 pl_closeFontRuns(pl_fontRuns
*fontRuns
);
84 * Get the number of font runs.
86 * @param fontRuns is the <code>pl_fontRuns</code> object.
88 * @return the number of entries in the limit indices array.
92 U_INTERNAL le_int32 U_EXPORT2
93 pl_getFontRunCount(const pl_fontRuns
*fontRuns
);
96 * Reset the number of font runs to zero.
98 * @param fontRuns is the <code>pl_fontRuns</code> object.
102 U_INTERNAL
void U_EXPORT2
103 pl_resetFontRuns(pl_fontRuns
*fontRuns
);
106 * Get the limit index for the last font run. This is the
107 * number of characters in the text.
109 * @param fontRuns is the <code>pl_fontRuns</code> object.
111 * @return the last limit index.
115 U_INTERNAL le_int32 U_EXPORT2
116 pl_getFontRunLastLimit(const pl_fontRuns
*fontRuns
);
119 * Get the limit index for a particular font run.
121 * @param fontRuns is the <code>pl_fontRuns</code> object.
122 * @param run is the run. This is an index into the limit index array.
124 * @return the limit index for the run, or -1 if <code>run</code> is out of bounds.
128 U_INTERNAL le_int32 U_EXPORT2
129 pl_getFontRunLimit(const pl_fontRuns
*fontRuns
,
133 * Get the <code>le_font</code> object assoicated with the given run
134 * of text. Use <code>pl_getFontRunLimit(run)</code> to get the corresponding
137 * @param fontRuns is the <code>pl_fontRuns</code> object.
138 * @param run is the index into the font and limit indices arrays.
140 * @return the <code>le_font</code> associated with the given text run.
144 U_INTERNAL
const le_font
* U_EXPORT2
145 pl_getFontRunFont(const pl_fontRuns
*fontRuns
,
150 * Add a new font run to the given <code>pl_fontRuns</code> object.
152 * If the <code>pl_fontRuns</code> object was not created by calling
153 * <code>pl_openEmptyFontRuns</code>, this method will return a run index of -1.
155 * @param fontRuns is the <code>pl_fontRuns</code> object.
157 * @param font is the address of the <code>le_font</code> to add. This object must
158 * remain valid until the <code>pl_fontRuns</code> object is closed.
160 * @param limit is the limit index to add
162 * @return the run index where the font and limit index were stored, or -1 if
163 * the run cannot be added.
167 U_INTERNAL le_int32 U_EXPORT2
168 pl_addFontRun(pl_fontRuns
*fontRuns
,
173 * Construct a <code>pl_valueRuns</code> object from pre-existing arrays of values
176 * @param values is the address of an array of values. This array must remain valid until
177 the <code>pl_valueRuns</code> object is closed.
179 * @param limits is the address of an array of limit indices. This array must remain valid until
180 * the <code>pl_valueRuns</code> object is closed.
182 * @param count is the number of entries in the two arrays.
186 U_INTERNAL pl_valueRuns
* U_EXPORT2
187 pl_openValueRuns(const le_int32
*values
,
188 const le_int32
*limits
,
192 * Construct an empty <code>pl_valueRuns</code> object. Clients can add values and limits
193 * using the <code>pl_addValueRun</code> routine.
195 * @param initialCapacity is the initial size of the value and limit indices arrays. If
196 * this value is zero, no arrays will be allocated.
198 * @see pl_addValueRun
202 U_INTERNAL pl_valueRuns
* U_EXPORT2
203 pl_openEmptyValueRuns(le_int32 initialCapacity
);
206 * Close the given <code>pl_valueRuns</code> object. Once this
207 * call returns, the object can no longer be referenced.
209 * @param valueRuns is the <code>pl_valueRuns</code> object.
213 U_INTERNAL
void U_EXPORT2
214 pl_closeValueRuns(pl_valueRuns
*valueRuns
);
217 * Get the number of value runs.
219 * @param valueRuns is the <code>pl_valueRuns</code> object.
221 * @return the number of value runs.
225 U_INTERNAL le_int32 U_EXPORT2
226 pl_getValueRunCount(const pl_valueRuns
*valueRuns
);
229 * Reset the number of value runs to zero.
231 * @param valueRuns is the <code>pl_valueRuns</code> object.
235 U_INTERNAL
void U_EXPORT2
236 pl_resetValueRuns(pl_valueRuns
*valueRuns
);
239 * Get the limit index for the last value run. This is the
240 * number of characters in the text.
242 * @param valueRuns is the <code>pl_valueRuns</code> object.
244 * @return the last limit index.
248 U_INTERNAL le_int32 U_EXPORT2
249 pl_getValueRunLastLimit(const pl_valueRuns
*valueRuns
);
252 * Get the limit index for a particular value run.
254 * @param valueRuns is the <code>pl_valueRuns</code> object.
255 * @param run is the run index.
257 * @return the limit index for the run, or -1 if <code>run</code> is out of bounds.
261 U_INTERNAL le_int32 U_EXPORT2
262 pl_getValueRunLimit(const pl_valueRuns
*valueRuns
,
266 * Get the value assoicated with the given run * of text. Use
267 * <code>pl_getValueRunLimit(run)</code> to get the corresponding
270 * @param valueRuns is the <code>pl_valueRuns</code> object.
271 * @param run is the run index.
273 * @return the value associated with the given text run.
277 U_INTERNAL le_int32 U_EXPORT2
278 pl_getValueRunValue(const pl_valueRuns
*valueRuns
,
283 * Add a new font run to the given <code>pl_valueRuns</code> object.
285 * If the <code>pl_valueRuns</code> object was not created by calling
286 * <code>pl_openEmptyFontRuns</code>, this method will return a run index of -1.
288 * @param valueRuns is the <code>pl_valueRuns</code> object.
290 * @param value is the value to add.
292 * @param limit is the limit index to add
294 * @return the run index where the font and limit index were stored, or -1 if
295 * the run cannot be added.
299 U_INTERNAL le_int32 U_EXPORT2
300 pl_addValueRun(pl_valueRuns
*valueRuns
,
305 * Construct a <code>pl_localeRuns</code> object from pre-existing arrays of fonts
308 * @param locales is the address of an array of pointers to locale name strings. This
309 * array must remain valid until the <code>pl_localeRuns</code> object is destroyed.
311 * @param limits is the address of an array of limit indices. This array must remain valid until
312 * the <code>pl_valueRuns</code> object is destroyed.
314 * @param count is the number of entries in the two arrays.
318 U_INTERNAL pl_localeRuns
* U_EXPORT2
319 pl_openLocaleRuns(const char **locales
,
320 const le_int32
*limits
,
324 * Construct an empty <code>pl_localeRuns</code> object. Clients can add font and limit
325 * indices arrays using the <code>pl_addFontRun</code> routine.
327 * @param initialCapacity is the initial size of the font and limit indices arrays. If
328 * this value is zero, no arrays will be allocated.
330 * @see pl_addLocaleRun
334 U_INTERNAL pl_localeRuns
* U_EXPORT2
335 pl_openEmptyLocaleRuns(le_int32 initialCapacity
);
338 * Close the given <code>pl_localeRuns</code> object. Once this
339 * call returns, the object can no longer be referenced.
341 * @param localeRuns is the <code>pl_localeRuns</code> object.
345 U_INTERNAL
void U_EXPORT2
346 pl_closeLocaleRuns(pl_localeRuns
*localeRuns
);
349 * Get the number of font runs.
351 * @param localeRuns is the <code>pl_localeRuns</code> object.
353 * @return the number of entries in the limit indices array.
357 U_INTERNAL le_int32 U_EXPORT2
358 pl_getLocaleRunCount(const pl_localeRuns
*localeRuns
);
361 * Reset the number of locale runs to zero.
363 * @param localeRuns is the <code>pl_localeRuns</code> object.
367 U_INTERNAL
void U_EXPORT2
368 pl_resetLocaleRuns(pl_localeRuns
*localeRuns
);
371 * Get the limit index for the last font run. This is the
372 * number of characters in the text.
374 * @param localeRuns is the <code>pl_localeRuns</code> object.
376 * @return the last limit index.
380 U_INTERNAL le_int32 U_EXPORT2
381 pl_getLocaleRunLastLimit(const pl_localeRuns
*localeRuns
);
384 * Get the limit index for a particular font run.
386 * @param localeRuns is the <code>pl_localeRuns</code> object.
387 * @param run is the run. This is an index into the limit index array.
389 * @return the limit index for the run, or -1 if <code>run</code> is out of bounds.
393 U_INTERNAL le_int32 U_EXPORT2
394 pl_getLocaleRunLimit(const pl_localeRuns
*localeRuns
,
398 * Get the <code>le_font</code> object assoicated with the given run
399 * of text. Use <code>pl_getLocaleRunLimit(run)</code> to get the corresponding
402 * @param localeRuns is the <code>pl_localeRuns</code> object.
403 * @param run is the index into the font and limit indices arrays.
405 * @return the <code>le_font</code> associated with the given text run.
409 U_INTERNAL
const char * U_EXPORT2
410 pl_getLocaleRunLocale(const pl_localeRuns
*localeRuns
,
415 * Add a new run to the given <code>pl_localeRuns</code> object.
417 * If the <code>pl_localeRuns</code> object was not created by calling
418 * <code>pl_openEmptyLocaleRuns</code>, this method will return a run index of -1.
420 * @param localeRuns is the <code>pl_localeRuns</code> object.
422 * @param locale is the name of the locale to add. This name must
423 * remain valid until the <code>pl_localeRuns</code> object is closed.
425 * @param limit is the limit index to add
427 * @return the run index where the font and limit index were stored, or -1 if
428 * the run cannot be added.
432 U_INTERNAL le_int32 U_EXPORT2
433 pl_addLocaleRun(pl_localeRuns
*localeRuns
,