3 * (C) Copyright IBM Corp. 1998-2011 - All Rights Reserved
10 #include "unicode/utypes.h"
12 #ifndef U_HIDE_INTERNAL_API
14 #include "unicode/ubidi.h"
15 #include "layout/LETypes.h"
17 #include "layout/loengine.h"
20 * Opaque datatype representing an array of font runs
22 typedef void pl_fontRuns
;
24 * Opaque datatype representing an array of value runs
26 typedef void pl_valueRuns
;
28 * Opaque datatype representing an array of locale runs
30 typedef void pl_localeRuns
;
34 * \brief C API for run arrays.
36 * This is a technology preview. The API may
37 * change significantly.
42 * Construct a <code>pl_fontRuns</code> object from pre-existing arrays of fonts
45 * @param fonts is the address of an array of pointers to <code>le_font</code> objects. This
46 * array, and the <code>le_font</code> objects to which it points must remain
47 * valid until the <code>pl_fontRuns</code> object is closed.
49 * @param limits is the address of an array of limit indices. This array must remain valid until
50 * the <code>pl_fontRuns</code> object is closed.
52 * @param count is the number of entries in the two arrays.
56 U_INTERNAL pl_fontRuns
* U_EXPORT2
57 pl_openFontRuns(const le_font
**fonts
,
58 const le_int32
*limits
,
62 * Construct an empty <code>pl_fontRuns</code> object. Clients can add font and limit
63 * indices arrays using the <code>pl_addFontRun</code> routine.
65 * @param initialCapacity is the initial size of the font and limit indices arrays. If
66 * this value is zero, no arrays will be allocated.
72 U_INTERNAL pl_fontRuns
* U_EXPORT2
73 pl_openEmptyFontRuns(le_int32 initialCapacity
);
76 * Close the given <code>pl_fontRuns</code> object. Once this
77 * call returns, the object can no longer be referenced.
79 * @param fontRuns is the <code>pl_fontRuns</code> object.
83 U_INTERNAL
void U_EXPORT2
84 pl_closeFontRuns(pl_fontRuns
*fontRuns
);
87 * Get the number of font runs.
89 * @param fontRuns is the <code>pl_fontRuns</code> object.
91 * @return the number of entries in the limit indices array.
95 U_INTERNAL le_int32 U_EXPORT2
96 pl_getFontRunCount(const pl_fontRuns
*fontRuns
);
99 * Reset the number of font runs to zero.
101 * @param fontRuns is the <code>pl_fontRuns</code> object.
105 U_INTERNAL
void U_EXPORT2
106 pl_resetFontRuns(pl_fontRuns
*fontRuns
);
109 * Get the limit index for the last font run. This is the
110 * number of characters in the text.
112 * @param fontRuns is the <code>pl_fontRuns</code> object.
114 * @return the last limit index.
118 U_INTERNAL le_int32 U_EXPORT2
119 pl_getFontRunLastLimit(const pl_fontRuns
*fontRuns
);
122 * Get the limit index for a particular font run.
124 * @param fontRuns is the <code>pl_fontRuns</code> object.
125 * @param run is the run. This is an index into the limit index array.
127 * @return the limit index for the run, or -1 if <code>run</code> is out of bounds.
131 U_INTERNAL le_int32 U_EXPORT2
132 pl_getFontRunLimit(const pl_fontRuns
*fontRuns
,
136 * Get the <code>le_font</code> object assoicated with the given run
137 * of text. Use <code>pl_getFontRunLimit(run)</code> to get the corresponding
140 * @param fontRuns is the <code>pl_fontRuns</code> object.
141 * @param run is the index into the font and limit indices arrays.
143 * @return the <code>le_font</code> associated with the given text run.
147 U_INTERNAL
const le_font
* U_EXPORT2
148 pl_getFontRunFont(const pl_fontRuns
*fontRuns
,
153 * Add a new font run to the given <code>pl_fontRuns</code> object.
155 * If the <code>pl_fontRuns</code> object was not created by calling
156 * <code>pl_openEmptyFontRuns</code>, this method will return a run index of -1.
158 * @param fontRuns is the <code>pl_fontRuns</code> object.
160 * @param font is the address of the <code>le_font</code> to add. This object must
161 * remain valid until the <code>pl_fontRuns</code> object is closed.
163 * @param limit is the limit index to add
165 * @return the run index where the font and limit index were stored, or -1 if
166 * the run cannot be added.
170 U_INTERNAL le_int32 U_EXPORT2
171 pl_addFontRun(pl_fontRuns
*fontRuns
,
176 * Construct a <code>pl_valueRuns</code> object from pre-existing arrays of values
179 * @param values is the address of an array of values. This array must remain valid until
180 the <code>pl_valueRuns</code> object is closed.
182 * @param limits is the address of an array of limit indices. This array must remain valid until
183 * the <code>pl_valueRuns</code> object is closed.
185 * @param count is the number of entries in the two arrays.
189 U_INTERNAL pl_valueRuns
* U_EXPORT2
190 pl_openValueRuns(const le_int32
*values
,
191 const le_int32
*limits
,
195 * Construct an empty <code>pl_valueRuns</code> object. Clients can add values and limits
196 * using the <code>pl_addValueRun</code> routine.
198 * @param initialCapacity is the initial size of the value and limit indices arrays. If
199 * this value is zero, no arrays will be allocated.
201 * @see pl_addValueRun
205 U_INTERNAL pl_valueRuns
* U_EXPORT2
206 pl_openEmptyValueRuns(le_int32 initialCapacity
);
209 * Close the given <code>pl_valueRuns</code> object. Once this
210 * call returns, the object can no longer be referenced.
212 * @param valueRuns is the <code>pl_valueRuns</code> object.
216 U_INTERNAL
void U_EXPORT2
217 pl_closeValueRuns(pl_valueRuns
*valueRuns
);
220 * Get the number of value runs.
222 * @param valueRuns is the <code>pl_valueRuns</code> object.
224 * @return the number of value runs.
228 U_INTERNAL le_int32 U_EXPORT2
229 pl_getValueRunCount(const pl_valueRuns
*valueRuns
);
232 * Reset the number of value runs to zero.
234 * @param valueRuns is the <code>pl_valueRuns</code> object.
238 U_INTERNAL
void U_EXPORT2
239 pl_resetValueRuns(pl_valueRuns
*valueRuns
);
242 * Get the limit index for the last value run. This is the
243 * number of characters in the text.
245 * @param valueRuns is the <code>pl_valueRuns</code> object.
247 * @return the last limit index.
251 U_INTERNAL le_int32 U_EXPORT2
252 pl_getValueRunLastLimit(const pl_valueRuns
*valueRuns
);
255 * Get the limit index for a particular value run.
257 * @param valueRuns is the <code>pl_valueRuns</code> object.
258 * @param run is the run index.
260 * @return the limit index for the run, or -1 if <code>run</code> is out of bounds.
264 U_INTERNAL le_int32 U_EXPORT2
265 pl_getValueRunLimit(const pl_valueRuns
*valueRuns
,
269 * Get the value assoicated with the given run * of text. Use
270 * <code>pl_getValueRunLimit(run)</code> to get the corresponding
273 * @param valueRuns is the <code>pl_valueRuns</code> object.
274 * @param run is the run index.
276 * @return the value associated with the given text run.
280 U_INTERNAL le_int32 U_EXPORT2
281 pl_getValueRunValue(const pl_valueRuns
*valueRuns
,
286 * Add a new font run to the given <code>pl_valueRuns</code> object.
288 * If the <code>pl_valueRuns</code> object was not created by calling
289 * <code>pl_openEmptyFontRuns</code>, this method will return a run index of -1.
291 * @param valueRuns is the <code>pl_valueRuns</code> object.
293 * @param value is the value to add.
295 * @param limit is the limit index to add
297 * @return the run index where the font and limit index were stored, or -1 if
298 * the run cannot be added.
302 U_INTERNAL le_int32 U_EXPORT2
303 pl_addValueRun(pl_valueRuns
*valueRuns
,
308 * Construct a <code>pl_localeRuns</code> object from pre-existing arrays of fonts
311 * @param locales is the address of an array of pointers to locale name strings. This
312 * array must remain valid until the <code>pl_localeRuns</code> object is destroyed.
314 * @param limits is the address of an array of limit indices. This array must remain valid until
315 * the <code>pl_valueRuns</code> object is destroyed.
317 * @param count is the number of entries in the two arrays.
321 U_INTERNAL pl_localeRuns
* U_EXPORT2
322 pl_openLocaleRuns(const char **locales
,
323 const le_int32
*limits
,
327 * Construct an empty <code>pl_localeRuns</code> object. Clients can add font and limit
328 * indices arrays using the <code>pl_addFontRun</code> routine.
330 * @param initialCapacity is the initial size of the font and limit indices arrays. If
331 * this value is zero, no arrays will be allocated.
333 * @see pl_addLocaleRun
337 U_INTERNAL pl_localeRuns
* U_EXPORT2
338 pl_openEmptyLocaleRuns(le_int32 initialCapacity
);
341 * Close the given <code>pl_localeRuns</code> object. Once this
342 * call returns, the object can no longer be referenced.
344 * @param localeRuns is the <code>pl_localeRuns</code> object.
348 U_INTERNAL
void U_EXPORT2
349 pl_closeLocaleRuns(pl_localeRuns
*localeRuns
);
352 * Get the number of font runs.
354 * @param localeRuns is the <code>pl_localeRuns</code> object.
356 * @return the number of entries in the limit indices array.
360 U_INTERNAL le_int32 U_EXPORT2
361 pl_getLocaleRunCount(const pl_localeRuns
*localeRuns
);
364 * Reset the number of locale runs to zero.
366 * @param localeRuns is the <code>pl_localeRuns</code> object.
370 U_INTERNAL
void U_EXPORT2
371 pl_resetLocaleRuns(pl_localeRuns
*localeRuns
);
374 * Get the limit index for the last font run. This is the
375 * number of characters in the text.
377 * @param localeRuns is the <code>pl_localeRuns</code> object.
379 * @return the last limit index.
383 U_INTERNAL le_int32 U_EXPORT2
384 pl_getLocaleRunLastLimit(const pl_localeRuns
*localeRuns
);
387 * Get the limit index for a particular font run.
389 * @param localeRuns is the <code>pl_localeRuns</code> object.
390 * @param run is the run. This is an index into the limit index array.
392 * @return the limit index for the run, or -1 if <code>run</code> is out of bounds.
396 U_INTERNAL le_int32 U_EXPORT2
397 pl_getLocaleRunLimit(const pl_localeRuns
*localeRuns
,
401 * Get the <code>le_font</code> object assoicated with the given run
402 * of text. Use <code>pl_getLocaleRunLimit(run)</code> to get the corresponding
405 * @param localeRuns is the <code>pl_localeRuns</code> object.
406 * @param run is the index into the font and limit indices arrays.
408 * @return the <code>le_font</code> associated with the given text run.
412 U_INTERNAL
const char * U_EXPORT2
413 pl_getLocaleRunLocale(const pl_localeRuns
*localeRuns
,
418 * Add a new run to the given <code>pl_localeRuns</code> object.
420 * If the <code>pl_localeRuns</code> object was not created by calling
421 * <code>pl_openEmptyLocaleRuns</code>, this method will return a run index of -1.
423 * @param localeRuns is the <code>pl_localeRuns</code> object.
425 * @param locale is the name of the locale to add. This name must
426 * remain valid until the <code>pl_localeRuns</code> object is closed.
428 * @param limit is the limit index to add
430 * @return the run index where the font and limit index were stored, or -1 if
431 * the run cannot be added.
435 U_INTERNAL le_int32 U_EXPORT2
436 pl_addLocaleRun(pl_localeRuns
*localeRuns
,
440 #endif /* U_HIDE_INTERNAL_API */