loengine.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. /*
  2. *
  3. * (C) Copyright IBM Corp. 1998-2011 - All Rights Reserved
  4. *
  5. */
  6. #ifndef __LOENGINE_H
  7. #define __LOENGINE_H
  8. #include "LETypes.h"
  9. #ifndef U_HIDE_INTERNAL_API
  10. /**
  11. * \file
  12. * \brief C API for complex text layout.
  13. * \internal
  14. *
  15. * This is a technology preview. The API may
  16. * change significantly.
  17. *
  18. */
  19. /**
  20. * The opaque type for a LayoutEngine.
  21. *
  22. * @internal
  23. */
  24. typedef void le_engine;
  25. /**
  26. * The opaque type for a font instance.
  27. *
  28. * @internal
  29. */
  30. typedef void le_font;
  31. /**
  32. * This function returns an le_engine capable of laying out text
  33. * in the given font, script and langauge. Note that the LayoutEngine
  34. * returned may be a subclass of LayoutEngine.
  35. *
  36. * @param font - the font of the text
  37. * @param scriptCode - the script of the text
  38. * @param languageCode - the language of the text
  39. * @param typo_flags - flags that control layout features like kerning and ligatures.
  40. * @param success - output parameter set to an error code if the operation fails
  41. *
  42. * @return an le_engine which can layout text in the given font.
  43. *
  44. * @internal
  45. */
  46. U_INTERNAL le_engine * U_EXPORT2
  47. le_create(const le_font *font,
  48. le_int32 scriptCode,
  49. le_int32 languageCode,
  50. le_int32 typo_flags,
  51. LEErrorCode *success);
  52. /**
  53. * This function closes the given LayoutEngine. After
  54. * it returns, the le_engine is no longer valid.
  55. *
  56. * @param engine - the LayoutEngine to close.
  57. *
  58. * @internal
  59. */
  60. U_INTERNAL void U_EXPORT2
  61. le_close(le_engine *engine);
  62. /**
  63. * This routine will compute the glyph, character index and position arrays.
  64. *
  65. * @param engine - the LayoutEngine
  66. * @param chars - the input character context
  67. * @param offset - the offset of the first character to process
  68. * @param count - the number of characters to process
  69. * @param max - the number of characters in the input context
  70. * @param rightToLeft - TRUE if the characers are in a right to left directional run
  71. * @param x - the initial X position
  72. * @param y - the initial Y position
  73. * @param success - output parameter set to an error code if the operation fails
  74. *
  75. * @return the number of glyphs in the glyph array
  76. *
  77. * Note: The glyph, character index and position array can be accessed
  78. * using the getter routines below.
  79. *
  80. * Note: If you call this function more than once, you must call the reset()
  81. * function first to free the glyph, character index and position arrays
  82. * allocated by the previous call.
  83. *
  84. * @internal
  85. */
  86. U_INTERNAL le_int32 U_EXPORT2
  87. le_layoutChars(le_engine *engine,
  88. const LEUnicode chars[],
  89. le_int32 offset,
  90. le_int32 count,
  91. le_int32 max,
  92. le_bool rightToLeft,
  93. float x,
  94. float y,
  95. LEErrorCode *success);
  96. /**
  97. * This function returns the number of glyphs in the glyph array. Note
  98. * that the number of glyphs will be greater than or equal to the number
  99. * of characters used to create the LayoutEngine.
  100. *
  101. * @param engine - the LayoutEngine
  102. * @param success - output parameter set to an error code if the operation fails.
  103. *
  104. * @return the number of glyphs in the glyph array
  105. *
  106. * @internal
  107. */
  108. U_INTERNAL le_int32 U_EXPORT2
  109. le_getGlyphCount(le_engine *engine,
  110. LEErrorCode *success);
  111. /**
  112. * This function copies the glyph array into a caller supplied array.
  113. * The caller must ensure that the array is large enough to hold all
  114. * the glyphs.
  115. *
  116. * @param engine - the LayoutEngine
  117. * @param glyphs - the destiniation glyph array
  118. * @param success - set to an error code if the operation fails
  119. *
  120. * @internal
  121. */
  122. U_INTERNAL void U_EXPORT2
  123. le_getGlyphs(le_engine *engine,
  124. LEGlyphID glyphs[],
  125. LEErrorCode *success);
  126. /**
  127. * This function copies the character index array into a caller supplied array.
  128. * The caller must ensure that the array is large enough to hold a
  129. * character index for each glyph.
  130. *
  131. * @param engine - the LayoutEngine
  132. * @param charIndices - the destiniation character index array
  133. * @param success - set to an error code if the operation fails
  134. *
  135. * @internal
  136. */
  137. U_INTERNAL void U_EXPORT2
  138. le_getCharIndices(le_engine *engine,
  139. le_int32 charIndices[],
  140. LEErrorCode *success);
  141. /**
  142. * This function copies the character index array into a caller supplied array.
  143. * The caller must ensure that the array is large enough to hold a
  144. * character index for each glyph.
  145. *
  146. * @param engine - the LayoutEngine
  147. * @param charIndices - the destiniation character index array
  148. * @param indexBase - an offset that will be added to each index.
  149. * @param success - set to an error code if the operation fails
  150. *
  151. * @internal
  152. */
  153. U_INTERNAL void U_EXPORT2
  154. le_getCharIndicesWithBase(le_engine *engine,
  155. le_int32 charIndices[],
  156. le_int32 indexBase,
  157. LEErrorCode *success);
  158. /**
  159. * This function copies the position array into a caller supplied array.
  160. * The caller must ensure that the array is large enough to hold an
  161. * X and Y position for each glyph, plus an extra X and Y for the
  162. * advance of the last glyph.
  163. *
  164. * @param engine - the LayoutEngine
  165. * @param positions - the destiniation position array
  166. * @param success - set to an error code if the operation fails
  167. *
  168. * @internal
  169. */
  170. U_INTERNAL void U_EXPORT2
  171. le_getGlyphPositions(le_engine *engine,
  172. float positions[],
  173. LEErrorCode *success);
  174. /**
  175. * This function returns the X and Y position of the glyph at
  176. * the given index.
  177. *
  178. * Input parameters:
  179. * @param engine - the LayoutEngine
  180. * @param glyphIndex - the index of the glyph
  181. *
  182. * Output parameters:
  183. * @param x - the glyph's X position
  184. * @param y - the glyph's Y position
  185. * @param success - set to an error code if the operation fails
  186. *
  187. * @internal
  188. */
  189. U_INTERNAL void U_EXPORT2
  190. le_getGlyphPosition(le_engine *engine,
  191. le_int32 glyphIndex,
  192. float *x,
  193. float *y,
  194. LEErrorCode *success);
  195. /**
  196. * This function frees the glyph, character index and position arrays
  197. * so that the LayoutEngine can be reused to layout a different
  198. * characer array. (This function is also called by le_close)
  199. *
  200. * @param engine - the LayoutEngine
  201. * @param success - set to an error code if the operation fails
  202. *
  203. * @internal
  204. */
  205. U_INTERNAL void U_EXPORT2
  206. le_reset(le_engine *engine,
  207. LEErrorCode *success);
  208. #endif /* U_HIDE_INTERNAL_API */
  209. #endif