1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
5 * (C) Copyright IBM Corp. 1998-2011 - All Rights Reserved
12 #include "unicode/utypes.h"
14 #ifndef U_HIDE_INTERNAL_API
16 #include "unicode/ubidi.h"
17 #include "layout/LETypes.h"
19 #include "layout/loengine.h"
22 * Opaque datatype representing an array of font runs
25 typedef void pl_fontRuns
;
27 * Opaque datatype representing an array of value runs
30 typedef void pl_valueRuns
;
32 * Opaque datatype representing an array of locale runs
35 typedef void pl_localeRuns
;
39 * \brief C API for run arrays.
41 * This is a technology preview. The API may
42 * change significantly.
47 * Construct a <code>pl_fontRuns</code> object from pre-existing arrays of fonts
50 * @param fonts is the address of an array of pointers to <code>le_font</code> objects. This
51 * array, and the <code>le_font</code> objects to which it points must remain
52 * valid until the <code>pl_fontRuns</code> object is closed.
54 * @param limits is the address of an array of limit indices. This array must remain valid until
55 * the <code>pl_fontRuns</code> object is closed.
57 * @param count is the number of entries in the two arrays.
61 U_INTERNAL pl_fontRuns
* U_EXPORT2
62 pl_openFontRuns(const le_font
**fonts
,
63 const le_int32
*limits
,
67 * Construct an empty <code>pl_fontRuns</code> object. Clients can add font and limit
68 * indices arrays using the <code>pl_addFontRun</code> routine.
70 * @param initialCapacity is the initial size of the font and limit indices arrays. If
71 * this value is zero, no arrays will be allocated.
77 U_INTERNAL pl_fontRuns
* U_EXPORT2
78 pl_openEmptyFontRuns(le_int32 initialCapacity
);
81 * Close the given <code>pl_fontRuns</code> object. Once this
82 * call returns, the object can no longer be referenced.
84 * @param fontRuns is the <code>pl_fontRuns</code> object.
88 U_INTERNAL
void U_EXPORT2
89 pl_closeFontRuns(pl_fontRuns
*fontRuns
);
92 * Get the number of font runs.
94 * @param fontRuns is the <code>pl_fontRuns</code> object.
96 * @return the number of entries in the limit indices array.
100 U_INTERNAL le_int32 U_EXPORT2
101 pl_getFontRunCount(const pl_fontRuns
*fontRuns
);
104 * Reset the number of font runs to zero.
106 * @param fontRuns is the <code>pl_fontRuns</code> object.
110 U_INTERNAL
void U_EXPORT2
111 pl_resetFontRuns(pl_fontRuns
*fontRuns
);
114 * Get the limit index for the last font run. This is the
115 * number of characters in the text.
117 * @param fontRuns is the <code>pl_fontRuns</code> object.
119 * @return the last limit index.
123 U_INTERNAL le_int32 U_EXPORT2
124 pl_getFontRunLastLimit(const pl_fontRuns
*fontRuns
);
127 * Get the limit index for a particular font run.
129 * @param fontRuns is the <code>pl_fontRuns</code> object.
130 * @param run is the run. This is an index into the limit index array.
132 * @return the limit index for the run, or -1 if <code>run</code> is out of bounds.
136 U_INTERNAL le_int32 U_EXPORT2
137 pl_getFontRunLimit(const pl_fontRuns
*fontRuns
,
141 * Get the <code>le_font</code> object assoicated with the given run
142 * of text. Use <code>pl_getFontRunLimit(run)</code> to get the corresponding
145 * @param fontRuns is the <code>pl_fontRuns</code> object.
146 * @param run is the index into the font and limit indices arrays.
148 * @return the <code>le_font</code> associated with the given text run.
152 U_INTERNAL
const le_font
* U_EXPORT2
153 pl_getFontRunFont(const pl_fontRuns
*fontRuns
,
158 * Add a new font run to the given <code>pl_fontRuns</code> object.
160 * If the <code>pl_fontRuns</code> object was not created by calling
161 * <code>pl_openEmptyFontRuns</code>, this method will return a run index of -1.
163 * @param fontRuns is the <code>pl_fontRuns</code> object.
165 * @param font is the address of the <code>le_font</code> to add. This object must
166 * remain valid until the <code>pl_fontRuns</code> object is closed.
168 * @param limit is the limit index to add
170 * @return the run index where the font and limit index were stored, or -1 if
171 * the run cannot be added.
175 U_INTERNAL le_int32 U_EXPORT2
176 pl_addFontRun(pl_fontRuns
*fontRuns
,
181 * Construct a <code>pl_valueRuns</code> object from pre-existing arrays of values
184 * @param values is the address of an array of values. This array must remain valid until
185 the <code>pl_valueRuns</code> object is closed.
187 * @param limits is the address of an array of limit indices. This array must remain valid until
188 * the <code>pl_valueRuns</code> object is closed.
190 * @param count is the number of entries in the two arrays.
194 U_INTERNAL pl_valueRuns
* U_EXPORT2
195 pl_openValueRuns(const le_int32
*values
,
196 const le_int32
*limits
,
200 * Construct an empty <code>pl_valueRuns</code> object. Clients can add values and limits
201 * using the <code>pl_addValueRun</code> routine.
203 * @param initialCapacity is the initial size of the value and limit indices arrays. If
204 * this value is zero, no arrays will be allocated.
206 * @see pl_addValueRun
210 U_INTERNAL pl_valueRuns
* U_EXPORT2
211 pl_openEmptyValueRuns(le_int32 initialCapacity
);
214 * Close the given <code>pl_valueRuns</code> object. Once this
215 * call returns, the object can no longer be referenced.
217 * @param valueRuns is the <code>pl_valueRuns</code> object.
221 U_INTERNAL
void U_EXPORT2
222 pl_closeValueRuns(pl_valueRuns
*valueRuns
);
225 * Get the number of value runs.
227 * @param valueRuns is the <code>pl_valueRuns</code> object.
229 * @return the number of value runs.
233 U_INTERNAL le_int32 U_EXPORT2
234 pl_getValueRunCount(const pl_valueRuns
*valueRuns
);
237 * Reset the number of value runs to zero.
239 * @param valueRuns is the <code>pl_valueRuns</code> object.
243 U_INTERNAL
void U_EXPORT2
244 pl_resetValueRuns(pl_valueRuns
*valueRuns
);
247 * Get the limit index for the last value run. This is the
248 * number of characters in the text.
250 * @param valueRuns is the <code>pl_valueRuns</code> object.
252 * @return the last limit index.
256 U_INTERNAL le_int32 U_EXPORT2
257 pl_getValueRunLastLimit(const pl_valueRuns
*valueRuns
);
260 * Get the limit index for a particular value run.
262 * @param valueRuns is the <code>pl_valueRuns</code> object.
263 * @param run is the run index.
265 * @return the limit index for the run, or -1 if <code>run</code> is out of bounds.
269 U_INTERNAL le_int32 U_EXPORT2
270 pl_getValueRunLimit(const pl_valueRuns
*valueRuns
,
274 * Get the value assoicated with the given run * of text. Use
275 * <code>pl_getValueRunLimit(run)</code> to get the corresponding
278 * @param valueRuns is the <code>pl_valueRuns</code> object.
279 * @param run is the run index.
281 * @return the value associated with the given text run.
285 U_INTERNAL le_int32 U_EXPORT2
286 pl_getValueRunValue(const pl_valueRuns
*valueRuns
,
291 * Add a new font run to the given <code>pl_valueRuns</code> object.
293 * If the <code>pl_valueRuns</code> object was not created by calling
294 * <code>pl_openEmptyFontRuns</code>, this method will return a run index of -1.
296 * @param valueRuns is the <code>pl_valueRuns</code> object.
298 * @param value is the value to add.
300 * @param limit is the limit index to add
302 * @return the run index where the font and limit index were stored, or -1 if
303 * the run cannot be added.
307 U_INTERNAL le_int32 U_EXPORT2
308 pl_addValueRun(pl_valueRuns
*valueRuns
,
313 * Construct a <code>pl_localeRuns</code> object from pre-existing arrays of fonts
316 * @param locales is the address of an array of pointers to locale name strings. This
317 * array must remain valid until the <code>pl_localeRuns</code> object is destroyed.
319 * @param limits is the address of an array of limit indices. This array must remain valid until
320 * the <code>pl_valueRuns</code> object is destroyed.
322 * @param count is the number of entries in the two arrays.
326 U_INTERNAL pl_localeRuns
* U_EXPORT2
327 pl_openLocaleRuns(const char **locales
,
328 const le_int32
*limits
,
332 * Construct an empty <code>pl_localeRuns</code> object. Clients can add font and limit
333 * indices arrays using the <code>pl_addFontRun</code> routine.
335 * @param initialCapacity is the initial size of the font and limit indices arrays. If
336 * this value is zero, no arrays will be allocated.
338 * @see pl_addLocaleRun
342 U_INTERNAL pl_localeRuns
* U_EXPORT2
343 pl_openEmptyLocaleRuns(le_int32 initialCapacity
);
346 * Close the given <code>pl_localeRuns</code> object. Once this
347 * call returns, the object can no longer be referenced.
349 * @param localeRuns is the <code>pl_localeRuns</code> object.
353 U_INTERNAL
void U_EXPORT2
354 pl_closeLocaleRuns(pl_localeRuns
*localeRuns
);
357 * Get the number of font runs.
359 * @param localeRuns is the <code>pl_localeRuns</code> object.
361 * @return the number of entries in the limit indices array.
365 U_INTERNAL le_int32 U_EXPORT2
366 pl_getLocaleRunCount(const pl_localeRuns
*localeRuns
);
369 * Reset the number of locale runs to zero.
371 * @param localeRuns is the <code>pl_localeRuns</code> object.
375 U_INTERNAL
void U_EXPORT2
376 pl_resetLocaleRuns(pl_localeRuns
*localeRuns
);
379 * Get the limit index for the last font run. This is the
380 * number of characters in the text.
382 * @param localeRuns is the <code>pl_localeRuns</code> object.
384 * @return the last limit index.
388 U_INTERNAL le_int32 U_EXPORT2
389 pl_getLocaleRunLastLimit(const pl_localeRuns
*localeRuns
);
392 * Get the limit index for a particular font run.
394 * @param localeRuns is the <code>pl_localeRuns</code> object.
395 * @param run is the run. This is an index into the limit index array.
397 * @return the limit index for the run, or -1 if <code>run</code> is out of bounds.
401 U_INTERNAL le_int32 U_EXPORT2
402 pl_getLocaleRunLimit(const pl_localeRuns
*localeRuns
,
406 * Get the <code>le_font</code> object assoicated with the given run
407 * of text. Use <code>pl_getLocaleRunLimit(run)</code> to get the corresponding
410 * @param localeRuns is the <code>pl_localeRuns</code> object.
411 * @param run is the index into the font and limit indices arrays.
413 * @return the <code>le_font</code> associated with the given text run.
417 U_INTERNAL
const char * U_EXPORT2
418 pl_getLocaleRunLocale(const pl_localeRuns
*localeRuns
,
423 * Add a new run to the given <code>pl_localeRuns</code> object.
425 * If the <code>pl_localeRuns</code> object was not created by calling
426 * <code>pl_openEmptyLocaleRuns</code>, this method will return a run index of -1.
428 * @param localeRuns is the <code>pl_localeRuns</code> object.
430 * @param locale is the name of the locale to add. This name must
431 * remain valid until the <code>pl_localeRuns</code> object is closed.
433 * @param limit is the limit index to add
435 * @return the run index where the font and limit index were stored, or -1 if
436 * the run cannot be added.
440 U_INTERNAL le_int32 U_EXPORT2
441 pl_addLocaleRun(pl_localeRuns
*localeRuns
,
445 #endif /* U_HIDE_INTERNAL_API */