plruns.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. /*
  2. *
  3. * (C) Copyright IBM Corp. 1998-2011 - All Rights Reserved
  4. *
  5. */
  6. #ifndef __PLRUNS_H
  7. #define __PLRUNS_H
  8. #include "unicode/utypes.h"
  9. #ifndef U_HIDE_INTERNAL_API
  10. #include "unicode/ubidi.h"
  11. #include "layout/LETypes.h"
  12. #include "layout/loengine.h"
  13. /**
  14. * Opaque datatype representing an array of font runs
  15. */
  16. typedef void pl_fontRuns;
  17. /**
  18. * Opaque datatype representing an array of value runs
  19. */
  20. typedef void pl_valueRuns;
  21. /**
  22. * Opaque datatype representing an array of locale runs
  23. */
  24. typedef void pl_localeRuns;
  25. /**
  26. * \file
  27. * \brief C API for run arrays.
  28. *
  29. * This is a technology preview. The API may
  30. * change significantly.
  31. *
  32. */
  33. /**
  34. * Construct a <code>pl_fontRuns</code> object from pre-existing arrays of fonts
  35. * and limit indices.
  36. *
  37. * @param fonts is the address of an array of pointers to <code>le_font</code> objects. This
  38. * array, and the <code>le_font</code> objects to which it points must remain
  39. * valid until the <code>pl_fontRuns</code> object is closed.
  40. *
  41. * @param limits is the address of an array of limit indices. This array must remain valid until
  42. * the <code>pl_fontRuns</code> object is closed.
  43. *
  44. * @param count is the number of entries in the two arrays.
  45. *
  46. * @internal
  47. */
  48. U_INTERNAL pl_fontRuns * U_EXPORT2
  49. pl_openFontRuns(const le_font **fonts,
  50. const le_int32 *limits,
  51. le_int32 count);
  52. /**
  53. * Construct an empty <code>pl_fontRuns</code> object. Clients can add font and limit
  54. * indices arrays using the <code>pl_addFontRun</code> routine.
  55. *
  56. * @param initialCapacity is the initial size of the font and limit indices arrays. If
  57. * this value is zero, no arrays will be allocated.
  58. *
  59. * @see pl_addFontRun
  60. *
  61. * @internal
  62. */
  63. U_INTERNAL pl_fontRuns * U_EXPORT2
  64. pl_openEmptyFontRuns(le_int32 initialCapacity);
  65. /**
  66. * Close the given <code>pl_fontRuns</code> object. Once this
  67. * call returns, the object can no longer be referenced.
  68. *
  69. * @param fontRuns is the <code>pl_fontRuns</code> object.
  70. *
  71. * @internal
  72. */
  73. U_INTERNAL void U_EXPORT2
  74. pl_closeFontRuns(pl_fontRuns *fontRuns);
  75. /**
  76. * Get the number of font runs.
  77. *
  78. * @param fontRuns is the <code>pl_fontRuns</code> object.
  79. *
  80. * @return the number of entries in the limit indices array.
  81. *
  82. * @internal
  83. */
  84. U_INTERNAL le_int32 U_EXPORT2
  85. pl_getFontRunCount(const pl_fontRuns *fontRuns);
  86. /**
  87. * Reset the number of font runs to zero.
  88. *
  89. * @param fontRuns is the <code>pl_fontRuns</code> object.
  90. *
  91. * @internal
  92. */
  93. U_INTERNAL void U_EXPORT2
  94. pl_resetFontRuns(pl_fontRuns *fontRuns);
  95. /**
  96. * Get the limit index for the last font run. This is the
  97. * number of characters in the text.
  98. *
  99. * @param fontRuns is the <code>pl_fontRuns</code> object.
  100. *
  101. * @return the last limit index.
  102. *
  103. * @internal
  104. */
  105. U_INTERNAL le_int32 U_EXPORT2
  106. pl_getFontRunLastLimit(const pl_fontRuns *fontRuns);
  107. /**
  108. * Get the limit index for a particular font run.
  109. *
  110. * @param fontRuns is the <code>pl_fontRuns</code> object.
  111. * @param run is the run. This is an index into the limit index array.
  112. *
  113. * @return the limit index for the run, or -1 if <code>run</code> is out of bounds.
  114. *
  115. * @internal
  116. */
  117. U_INTERNAL le_int32 U_EXPORT2
  118. pl_getFontRunLimit(const pl_fontRuns *fontRuns,
  119. le_int32 run);
  120. /**
  121. * Get the <code>le_font</code> object assoicated with the given run
  122. * of text. Use <code>pl_getFontRunLimit(run)</code> to get the corresponding
  123. * limit index.
  124. *
  125. * @param fontRuns is the <code>pl_fontRuns</code> object.
  126. * @param run is the index into the font and limit indices arrays.
  127. *
  128. * @return the <code>le_font</code> associated with the given text run.
  129. *
  130. * @internal
  131. */
  132. U_INTERNAL const le_font * U_EXPORT2
  133. pl_getFontRunFont(const pl_fontRuns *fontRuns,
  134. le_int32 run);
  135. /**
  136. * Add a new font run to the given <code>pl_fontRuns</code> object.
  137. *
  138. * If the <code>pl_fontRuns</code> object was not created by calling
  139. * <code>pl_openEmptyFontRuns</code>, this method will return a run index of -1.
  140. *
  141. * @param fontRuns is the <code>pl_fontRuns</code> object.
  142. *
  143. * @param font is the address of the <code>le_font</code> to add. This object must
  144. * remain valid until the <code>pl_fontRuns</code> object is closed.
  145. *
  146. * @param limit is the limit index to add
  147. *
  148. * @return the run index where the font and limit index were stored, or -1 if
  149. * the run cannot be added.
  150. *
  151. * @internal
  152. */
  153. U_INTERNAL le_int32 U_EXPORT2
  154. pl_addFontRun(pl_fontRuns *fontRuns,
  155. const le_font *font,
  156. le_int32 limit);
  157. /**
  158. * Construct a <code>pl_valueRuns</code> object from pre-existing arrays of values
  159. * and limit indices.
  160. *
  161. * @param values is the address of an array of values. This array must remain valid until
  162. the <code>pl_valueRuns</code> object is closed.
  163. *
  164. * @param limits is the address of an array of limit indices. This array must remain valid until
  165. * the <code>pl_valueRuns</code> object is closed.
  166. *
  167. * @param count is the number of entries in the two arrays.
  168. *
  169. * @internal
  170. */
  171. U_INTERNAL pl_valueRuns * U_EXPORT2
  172. pl_openValueRuns(const le_int32 *values,
  173. const le_int32 *limits,
  174. le_int32 count);
  175. /**
  176. * Construct an empty <code>pl_valueRuns</code> object. Clients can add values and limits
  177. * using the <code>pl_addValueRun</code> routine.
  178. *
  179. * @param initialCapacity is the initial size of the value and limit indices arrays. If
  180. * this value is zero, no arrays will be allocated.
  181. *
  182. * @see pl_addValueRun
  183. *
  184. * @internal
  185. */
  186. U_INTERNAL pl_valueRuns * U_EXPORT2
  187. pl_openEmptyValueRuns(le_int32 initialCapacity);
  188. /**
  189. * Close the given <code>pl_valueRuns</code> object. Once this
  190. * call returns, the object can no longer be referenced.
  191. *
  192. * @param valueRuns is the <code>pl_valueRuns</code> object.
  193. *
  194. * @internal
  195. */
  196. U_INTERNAL void U_EXPORT2
  197. pl_closeValueRuns(pl_valueRuns *valueRuns);
  198. /**
  199. * Get the number of value runs.
  200. *
  201. * @param valueRuns is the <code>pl_valueRuns</code> object.
  202. *
  203. * @return the number of value runs.
  204. *
  205. * @internal
  206. */
  207. U_INTERNAL le_int32 U_EXPORT2
  208. pl_getValueRunCount(const pl_valueRuns *valueRuns);
  209. /**
  210. * Reset the number of value runs to zero.
  211. *
  212. * @param valueRuns is the <code>pl_valueRuns</code> object.
  213. *
  214. * @internal
  215. */
  216. U_INTERNAL void U_EXPORT2
  217. pl_resetValueRuns(pl_valueRuns *valueRuns);
  218. /**
  219. * Get the limit index for the last value run. This is the
  220. * number of characters in the text.
  221. *
  222. * @param valueRuns is the <code>pl_valueRuns</code> object.
  223. *
  224. * @return the last limit index.
  225. *
  226. * @internal
  227. */
  228. U_INTERNAL le_int32 U_EXPORT2
  229. pl_getValueRunLastLimit(const pl_valueRuns *valueRuns);
  230. /**
  231. * Get the limit index for a particular value run.
  232. *
  233. * @param valueRuns is the <code>pl_valueRuns</code> object.
  234. * @param run is the run index.
  235. *
  236. * @return the limit index for the run, or -1 if <code>run</code> is out of bounds.
  237. *
  238. * @internal
  239. */
  240. U_INTERNAL le_int32 U_EXPORT2
  241. pl_getValueRunLimit(const pl_valueRuns *valueRuns,
  242. le_int32 run);
  243. /**
  244. * Get the value assoicated with the given run * of text. Use
  245. * <code>pl_getValueRunLimit(run)</code> to get the corresponding
  246. * limit index.
  247. *
  248. * @param valueRuns is the <code>pl_valueRuns</code> object.
  249. * @param run is the run index.
  250. *
  251. * @return the value associated with the given text run.
  252. *
  253. * @internal
  254. */
  255. U_INTERNAL le_int32 U_EXPORT2
  256. pl_getValueRunValue(const pl_valueRuns *valueRuns,
  257. le_int32 run);
  258. /**
  259. * Add a new font run to the given <code>pl_valueRuns</code> object.
  260. *
  261. * If the <code>pl_valueRuns</code> object was not created by calling
  262. * <code>pl_openEmptyFontRuns</code>, this method will return a run index of -1.
  263. *
  264. * @param valueRuns is the <code>pl_valueRuns</code> object.
  265. *
  266. * @param value is the value to add.
  267. *
  268. * @param limit is the limit index to add
  269. *
  270. * @return the run index where the font and limit index were stored, or -1 if
  271. * the run cannot be added.
  272. *
  273. * @internal
  274. */
  275. U_INTERNAL le_int32 U_EXPORT2
  276. pl_addValueRun(pl_valueRuns *valueRuns,
  277. le_int32 value,
  278. le_int32 limit);
  279. /**
  280. * Construct a <code>pl_localeRuns</code> object from pre-existing arrays of fonts
  281. * and limit indices.
  282. *
  283. * @param locales is the address of an array of pointers to locale name strings. This
  284. * array must remain valid until the <code>pl_localeRuns</code> object is destroyed.
  285. *
  286. * @param limits is the address of an array of limit indices. This array must remain valid until
  287. * the <code>pl_valueRuns</code> object is destroyed.
  288. *
  289. * @param count is the number of entries in the two arrays.
  290. *
  291. * @internal
  292. */
  293. U_INTERNAL pl_localeRuns * U_EXPORT2
  294. pl_openLocaleRuns(const char **locales,
  295. const le_int32 *limits,
  296. le_int32 count);
  297. /**
  298. * Construct an empty <code>pl_localeRuns</code> object. Clients can add font and limit
  299. * indices arrays using the <code>pl_addFontRun</code> routine.
  300. *
  301. * @param initialCapacity is the initial size of the font and limit indices arrays. If
  302. * this value is zero, no arrays will be allocated.
  303. *
  304. * @see pl_addLocaleRun
  305. *
  306. * @internal
  307. */
  308. U_INTERNAL pl_localeRuns * U_EXPORT2
  309. pl_openEmptyLocaleRuns(le_int32 initialCapacity);
  310. /**
  311. * Close the given <code>pl_localeRuns</code> object. Once this
  312. * call returns, the object can no longer be referenced.
  313. *
  314. * @param localeRuns is the <code>pl_localeRuns</code> object.
  315. *
  316. * @internal
  317. */
  318. U_INTERNAL void U_EXPORT2
  319. pl_closeLocaleRuns(pl_localeRuns *localeRuns);
  320. /**
  321. * Get the number of font runs.
  322. *
  323. * @param localeRuns is the <code>pl_localeRuns</code> object.
  324. *
  325. * @return the number of entries in the limit indices array.
  326. *
  327. * @internal
  328. */
  329. U_INTERNAL le_int32 U_EXPORT2
  330. pl_getLocaleRunCount(const pl_localeRuns *localeRuns);
  331. /**
  332. * Reset the number of locale runs to zero.
  333. *
  334. * @param localeRuns is the <code>pl_localeRuns</code> object.
  335. *
  336. * @internal
  337. */
  338. U_INTERNAL void U_EXPORT2
  339. pl_resetLocaleRuns(pl_localeRuns *localeRuns);
  340. /**
  341. * Get the limit index for the last font run. This is the
  342. * number of characters in the text.
  343. *
  344. * @param localeRuns is the <code>pl_localeRuns</code> object.
  345. *
  346. * @return the last limit index.
  347. *
  348. * @internal
  349. */
  350. U_INTERNAL le_int32 U_EXPORT2
  351. pl_getLocaleRunLastLimit(const pl_localeRuns *localeRuns);
  352. /**
  353. * Get the limit index for a particular font run.
  354. *
  355. * @param localeRuns is the <code>pl_localeRuns</code> object.
  356. * @param run is the run. This is an index into the limit index array.
  357. *
  358. * @return the limit index for the run, or -1 if <code>run</code> is out of bounds.
  359. *
  360. * @internal
  361. */
  362. U_INTERNAL le_int32 U_EXPORT2
  363. pl_getLocaleRunLimit(const pl_localeRuns *localeRuns,
  364. le_int32 run);
  365. /**
  366. * Get the <code>le_font</code> object assoicated with the given run
  367. * of text. Use <code>pl_getLocaleRunLimit(run)</code> to get the corresponding
  368. * limit index.
  369. *
  370. * @param localeRuns is the <code>pl_localeRuns</code> object.
  371. * @param run is the index into the font and limit indices arrays.
  372. *
  373. * @return the <code>le_font</code> associated with the given text run.
  374. *
  375. * @internal
  376. */
  377. U_INTERNAL const char * U_EXPORT2
  378. pl_getLocaleRunLocale(const pl_localeRuns *localeRuns,
  379. le_int32 run);
  380. /**
  381. * Add a new run to the given <code>pl_localeRuns</code> object.
  382. *
  383. * If the <code>pl_localeRuns</code> object was not created by calling
  384. * <code>pl_openEmptyLocaleRuns</code>, this method will return a run index of -1.
  385. *
  386. * @param localeRuns is the <code>pl_localeRuns</code> object.
  387. *
  388. * @param locale is the name of the locale to add. This name must
  389. * remain valid until the <code>pl_localeRuns</code> object is closed.
  390. *
  391. * @param limit is the limit index to add
  392. *
  393. * @return the run index where the font and limit index were stored, or -1 if
  394. * the run cannot be added.
  395. *
  396. * @internal
  397. */
  398. U_INTERNAL le_int32 U_EXPORT2
  399. pl_addLocaleRun(pl_localeRuns *localeRuns,
  400. const char *locale,
  401. le_int32 limit);
  402. #endif /* U_HIDE_INTERNAL_API */
  403. #endif