summaryrefslogtreecommitdiff
path: root/Build/source/libs/icu/icu-xetex/layoutex/layout/plruns.h
blob: e0cb9d684fcc4ecdd2b839902a4bc18d4f79028d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
/*
 *
 * (C) Copyright IBM Corp. 1998-2007 - All Rights Reserved
 *
 */

#ifndef __PLRUNS_H
#define __PLRUNS_H

#include "unicode/utypes.h"
#include "unicode/ubidi.h"
#include "layout/LETypes.h"

#include "layout/loengine.h"

typedef void pl_fontRuns;
typedef void pl_valueRuns;
typedef void pl_localeRuns;

/**
 * \file 
 * \brief C API for run arrays.
 *
 * This is a technology preview. The API may
 * change significantly.
 *
 */

/**
 * Construct a <code>pl_fontRuns</code> object from pre-existing arrays of fonts
 * and limit indices.
 *
 * @param fonts is the address of an array of pointers to <code>le_font</code> objects. This
 *              array, and the <code>le_font</code> objects to which it points must remain
 *              valid until the <code>pl_fontRuns</code> object is closed.
 *
 * @param limits is the address of an array of limit indices. This array must remain valid until
 *               the <code>pl_fontRuns</code> object is closed.
 *
 * @param count is the number of entries in the two arrays.
 *
 * @internal
 */
U_INTERNAL pl_fontRuns * U_EXPORT2
pl_openFontRuns(const le_font **fonts,
                const le_int32 *limits,
                le_int32 count);

/**
 * Construct an empty <code>pl_fontRuns</code> object. Clients can add font and limit
 * indices arrays using the <code>pl_addFontRun</code> routine.
 *
 * @param initialCapacity is the initial size of the font and limit indices arrays. If
 *                        this value is zero, no arrays will be allocated.
 *
 * @see pl_addFontRun
 *
 * @internal
 */
U_INTERNAL pl_fontRuns * U_EXPORT2
pl_openEmptyFontRuns(le_int32 initialCapacity);

/**
 * Close the given <code>pl_fontRuns</code> object. Once this
 * call returns, the object can no longer be referenced.
 *
 * @param fontRuns is the <code>pl_fontRuns</code> object.
 *
 * @internal
 */
U_INTERNAL void U_EXPORT2
pl_closeFontRuns(pl_fontRuns *fontRuns);

/**
 * Get the number of font runs.
 *
 * @param fontRuns is the <code>pl_fontRuns</code> object.
 *
 * @return the number of entries in the limit indices array.
 *
 * @internal
 */
U_INTERNAL le_int32 U_EXPORT2
pl_getFontRunCount(const pl_fontRuns *fontRuns);

/**
 * Reset the number of font runs to zero.
 *
 * @param fontRuns is the <code>pl_fontRuns</code> object.
 *
 * @internal
 */
U_INTERNAL void U_EXPORT2
pl_resetFontRuns(pl_fontRuns *fontRuns);

/**
 * Get the limit index for the last font run. This is the
 * number of characters in the text.
 *
 * @param fontRuns is the <code>pl_fontRuns</code> object.
 *
 * @return the last limit index.
 *
 * @internal
 */
U_INTERNAL le_int32 U_EXPORT2
pl_getFontRunLastLimit(const pl_fontRuns *fontRuns);

/**
 * Get the limit index for a particular font run.
 *
 * @param fontRuns is the <code>pl_fontRuns</code> object.
 * @param run is the run. This is an index into the limit index array.
 *
 * @return the limit index for the run, or -1 if <code>run</code> is out of bounds.
 *
 * @internal
 */
U_INTERNAL le_int32 U_EXPORT2
pl_getFontRunLimit(const pl_fontRuns *fontRuns,
                   le_int32 run);

/**
 * Get the <code>le_font</code> object assoicated with the given run
 * of text. Use <code>pl_getFontRunLimit(run)</code> to get the corresponding
 * limit index.
 *
 * @param fontRuns is the <code>pl_fontRuns</code> object.
 * @param run is the index into the font and limit indices arrays.
 *
 * @return the <code>le_font</code> associated with the given text run.
 *
 * @internal
 */
U_INTERNAL const le_font * U_EXPORT2
pl_getFontRunFont(const pl_fontRuns *fontRuns,
                  le_int32 run);


/**
 * Add a new font run to the given <code>pl_fontRuns</code> object.
 *
 * If the <code>pl_fontRuns</code> object was not created by calling
 * <code>pl_openEmptyFontRuns</code>, this method will return a run index of -1.
 *
 * @param fontRuns is the <code>pl_fontRuns</code> object.
 *
 * @param font is the address of the <code>le_font</code> to add. This object must
 *             remain valid until the <code>pl_fontRuns</code> object is closed.
 *
 * @param limit is the limit index to add
 *
 * @return the run index where the font and limit index were stored, or -1 if 
 *         the run cannot be added.
 *
 * @internal
 */
U_INTERNAL le_int32 U_EXPORT2
pl_addFontRun(pl_fontRuns *fontRuns,
              const le_font *font,
              le_int32 limit);

/**
 * Construct a <code>pl_valueRuns</code> object from pre-existing arrays of values
 * and limit indices.
 *
 * @param values is the address of an array of values. This array must remain valid until
                 the <code>pl_valueRuns</code> object is closed.
 *
 * @param limits is the address of an array of limit indices. This array must remain valid until
 *               the <code>pl_valueRuns</code> object is closed.
 *
 * @param count is the number of entries in the two arrays.
 *
 * @internal
 */
U_INTERNAL pl_valueRuns * U_EXPORT2
pl_openValueRuns(const le_int32 *values,
                 const le_int32 *limits,
                 le_int32 count);

/**
 * Construct an empty <code>pl_valueRuns</code> object. Clients can add values and limits
 * using the <code>pl_addValueRun</code> routine.
 *
 * @param initialCapacity is the initial size of the value and limit indices arrays. If
 *                        this value is zero, no arrays will be allocated.
 *
 * @see pl_addValueRun
 *
 * @internal
 */
U_INTERNAL pl_valueRuns * U_EXPORT2
pl_openEmptyValueRuns(le_int32 initialCapacity);

/**
 * Close the given <code>pl_valueRuns</code> object. Once this
 * call returns, the object can no longer be referenced.
 *
 * @param valueRuns is the <code>pl_valueRuns</code> object.
 *
 * @internal
 */
U_INTERNAL void U_EXPORT2
pl_closeValueRuns(pl_valueRuns *valueRuns);

/**
 * Get the number of value runs.
 *
 * @param valueRuns is the <code>pl_valueRuns</code> object.
 *
 * @return the number of value runs.
 *
 * @internal
 */
U_INTERNAL le_int32 U_EXPORT2
pl_getValueRunCount(const pl_valueRuns *valueRuns);

/**
 * Reset the number of value runs to zero.
 *
 * @param valueRuns is the <code>pl_valueRuns</code> object.
 *
 * @internal
 */
U_INTERNAL void U_EXPORT2
pl_resetValueRuns(pl_valueRuns *valueRuns);

/**
 * Get the limit index for the last value run. This is the
 * number of characters in the text.
 *
 * @param valueRuns is the <code>pl_valueRuns</code> object.
 *
 * @return the last limit index.
 *
 * @internal
 */
U_INTERNAL le_int32 U_EXPORT2
pl_getValueRunLastLimit(const pl_valueRuns *valueRuns);

/**
 * Get the limit index for a particular value run.
 *
 * @param valueRuns is the <code>pl_valueRuns</code> object.
 * @param run is the run index.
 *
 * @return the limit index for the run, or -1 if <code>run</code> is out of bounds.
 *
 * @internal
 */
U_INTERNAL le_int32 U_EXPORT2
pl_getValueRunLimit(const pl_valueRuns *valueRuns,
                     le_int32 run);

/**
 * Get the value assoicated with the given run * of text. Use
 * <code>pl_getValueRunLimit(run)</code> to get the corresponding
 * limit index.
 *
 * @param valueRuns is the <code>pl_valueRuns</code> object.
 * @param run is the run index.
 *
 * @return the value associated with the given text run.
 *
 * @internal
 */
U_INTERNAL le_int32 U_EXPORT2
pl_getValueRunValue(const pl_valueRuns *valueRuns,
                    le_int32 run);


/**
 * Add a new font run to the given <code>pl_valueRuns</code> object.
 *
 * If the <code>pl_valueRuns</code> object was not created by calling
 * <code>pl_openEmptyFontRuns</code>, this method will return a run index of -1.
 *
 * @param valueRuns is the <code>pl_valueRuns</code> object.
 *
 * @param value is the value to add.
 *
 * @param limit is the limit index to add
 *
 * @return the run index where the font and limit index were stored, or -1 if 
 *         the run cannot be added.
 *
 * @internal
 */
U_INTERNAL le_int32 U_EXPORT2
pl_addValueRun(pl_valueRuns *valueRuns,
               le_int32 value,
               le_int32 limit);

/**
 * Construct a <code>pl_localeRuns</code> object from pre-existing arrays of fonts
 * and limit indices.
 *
 * @param locales is the address of an array of pointers to locale name strings. This
 *                array must remain valid until the <code>pl_localeRuns</code> object is destroyed.
 *
 * @param limits is the address of an array of limit indices. This array must remain valid until
 *               the <code>pl_valueRuns</code> object is destroyed.
 *
 * @param count is the number of entries in the two arrays.
 *
 * @internal
 */
U_INTERNAL pl_localeRuns * U_EXPORT2
pl_openLocaleRuns(const char **locales,
                  const le_int32 *limits,
                  le_int32 count);

/**
 * Construct an empty <code>pl_localeRuns</code> object. Clients can add font and limit
 * indices arrays using the <code>pl_addFontRun</code> routine.
 *
 * @param initialCapacity is the initial size of the font and limit indices arrays. If
 *                        this value is zero, no arrays will be allocated.
 *
 * @see pl_addLocaleRun
 *
 * @internal
 */
U_INTERNAL pl_localeRuns * U_EXPORT2
pl_openEmptyLocaleRuns(le_int32 initialCapacity);

/**
 * Close the given <code>pl_localeRuns</code> object. Once this
 * call returns, the object can no longer be referenced.
 *
 * @param localeRuns is the <code>pl_localeRuns</code> object.
 *
 * @internal
 */
U_INTERNAL void U_EXPORT2
pl_closeLocaleRuns(pl_localeRuns *localeRuns);

/**
 * Get the number of font runs.
 *
 * @param localeRuns is the <code>pl_localeRuns</code> object.
 *
 * @return the number of entries in the limit indices array.
 *
 * @internal
 */
U_INTERNAL le_int32 U_EXPORT2
pl_getLocaleRunCount(const pl_localeRuns *localeRuns);

/**
 * Reset the number of locale runs to zero.
 *
 * @param localeRuns is the <code>pl_localeRuns</code> object.
 *
 * @internal
 */
U_INTERNAL void U_EXPORT2
pl_resetLocaleRuns(pl_localeRuns *localeRuns);

/**
 * Get the limit index for the last font run. This is the
 * number of characters in the text.
 *
 * @param localeRuns is the <code>pl_localeRuns</code> object.
 *
 * @return the last limit index.
 *
 * @internal
 */
U_INTERNAL le_int32 U_EXPORT2
pl_getLocaleRunLastLimit(const pl_localeRuns *localeRuns);

/**
 * Get the limit index for a particular font run.
 *
 * @param localeRuns is the <code>pl_localeRuns</code> object.
 * @param run is the run. This is an index into the limit index array.
 *
 * @return the limit index for the run, or -1 if <code>run</code> is out of bounds.
 *
 * @internal
 */
U_INTERNAL le_int32 U_EXPORT2
pl_getLocaleRunLimit(const pl_localeRuns *localeRuns,
                     le_int32 run);

/**
 * Get the <code>le_font</code> object assoicated with the given run
 * of text. Use <code>pl_getLocaleRunLimit(run)</code> to get the corresponding
 * limit index.
 *
 * @param localeRuns is the <code>pl_localeRuns</code> object.
 * @param run is the index into the font and limit indices arrays.
 *
 * @return the <code>le_font</code> associated with the given text run.
 *
 * @internal
 */
U_INTERNAL const char * U_EXPORT2
pl_getLocaleRunLocale(const pl_localeRuns *localeRuns,
                      le_int32 run);


/**
 * Add a new run to the given <code>pl_localeRuns</code> object.
 *
 * If the <code>pl_localeRuns</code> object was not created by calling
 * <code>pl_openEmptyLocaleRuns</code>, this method will return a run index of -1.
 *
 * @param localeRuns is the <code>pl_localeRuns</code> object.
 *
 * @param locale is the name of the locale to add. This name must
 *               remain valid until the <code>pl_localeRuns</code> object is closed.
 *
 * @param limit is the limit index to add
 *
 * @return the run index where the font and limit index were stored, or -1 if 
 *         the run cannot be added.
 *
 * @internal
 */
U_INTERNAL le_int32 U_EXPORT2
pl_addLocaleRun(pl_localeRuns *localeRuns,
                const char *locale,
                le_int32 limit);

#endif