Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

423 lines
17 KiB

  1. /*
  2. File: ATSUnicodeDirectAccess.h
  3. Contains: Public Interfaces/Types for Low Level ATSUI
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 2002 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __ATSUNICODEDIRECTACCESS__
  11. #define __ATSUNICODEDIRECTACCESS__
  12. #ifndef __ATSUNICODE__
  13. #include <ATSUnicode.h>
  14. #endif
  15. #if PRAGMA_ONCE
  16. #pragma once
  17. #endif
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #if PRAGMA_IMPORT
  22. #pragma import on
  23. #endif
  24. /* ---------------------------------------------------------------------------- */
  25. /* Constants */
  26. /* ---------------------------------------------------------------------------- */
  27. /*
  28. * ATSUDirectDataSelector
  29. *
  30. * Summary:
  31. * These are the data selectors used in the
  32. * ATSUDirectGetLayoutDataArrayPtr function to get the needed layout
  33. * data array pointer.
  34. */
  35. typedef UInt32 ATSUDirectDataSelector;
  36. enum {
  37. /*
  38. * Returns the parallel advance delta (delta X) array. (Array Type):
  39. * Fixed (Return Time): Constant, unless creation is necessary, or
  40. * unless requested by ATSUDirectGetLayoutDataArrayPtrFromTextLayout.
  41. * (Creation): This array is created only on demand. Thus, if any
  42. * changes are to be made iCreate should be set to true. If the array
  43. * had not been previously allocated it will be allocated and
  44. * zero-filled when iCreate is set to true.
  45. */
  46. kATSUDirectDataAdvanceDeltaFixedArray = 0L,
  47. /*
  48. * Returns the parallel baseline delta (delta Y) array. (Array Type):
  49. * Fixed (Return Time): Constant, unless creation is necessary, or
  50. * unless requested by ATSUDirectGetLayoutDataArrayPtrFromTextLayout.
  51. * (Creation): This array is created only on demand. Thus, if any
  52. * changes are to be made iCreate should be set to true. If the array
  53. * had not been previously allocated it will be allocated and
  54. * zero-filled when iCreate is set to true.
  55. */
  56. kATSUDirectDataBaselineDeltaFixedArray = 1L,
  57. /*
  58. * Returns the parallel device delta array for device- specific
  59. * tweaking. This is an array of values which are used to adjust
  60. * truncated fractional values for devices that do not accept
  61. * fractional positioning. It is also used to provide precise
  62. * positioning for connected scripts. (Array Type): SInt16 (Return
  63. * Time): Constant, unless creation is necessary, or unless requested
  64. * by ATSUDirectGetLayoutDataArrayPtrFromTextLayout. (Creation): This
  65. * array is created only on demand. Thus, if any changes are to be
  66. * made iCreate should be set to true. If the array had not been
  67. * previously allocated it will be allocated and zero-filled when
  68. * iCreate is set to true.
  69. */
  70. kATSUDirectDataDeviceDeltaSInt16Array = 2L,
  71. /*
  72. * Returns the parallel style index array. The indexes setting in the
  73. * array are indexes into the the StyleSetting array, which can be
  74. * obtained using the
  75. * kATSUDirectDataStyleSettingATSUStyleSettingRefArray below. (Array
  76. * Type): UInt16 (Return Time): Constant, unless creation is
  77. * necessary, or unless requested by
  78. * ATSUDirectGetLayoutDataArrayPtrFromTextLayout. (Creation): This
  79. * array is created only on demand. Thus, if any changes are to be
  80. * made iCreate should be set to true. If the array had not been
  81. * previously allocated it will be allocated and zero-filled when
  82. * iCreate is set to true.
  83. */
  84. kATSUDirectDataStyleIndexUInt16Array = 3L,
  85. /*
  86. * Returns the style setting ref array. (Array Type):
  87. * ATSUStyleSettingRef (Return Time): Linear, based on the number of
  88. * styles applied to the given line. (Creation): This array is always
  89. * present if the layout has any text assigned to it at all. Setting
  90. * iCreate has no effect.
  91. */
  92. kATSUDirectDataStyleSettingATSUStyleSettingRefArray = 4L,
  93. /*
  94. * Returns the ATSLayoutRecord, version 1 array. This should not be
  95. * used directly at all. Rather, use the
  96. * kATSUDirectDataLayoutRecordATSLayoutRecordCurrent selector below.
  97. * This will ensure that the code will always be using the most
  98. * current version of the ATSLayoutRecord, should there ever be a
  99. * change. ATSUI will only ensure the most efficient processing will
  100. * occur for the latest version of ATSLayoutRecord. (Array Type):
  101. * ATSLayoutRecord, version 1 (Return Time): Constant, unless
  102. * creation is necessary, or unless requested by
  103. * ATSUDirectGetLayoutDataArrayPtrFromTextLayout. (Creation): This
  104. * array is always present if the layout has any text assigned to it
  105. * at all. Setting iCreate has no effect
  106. */
  107. kATSUDirectDataLayoutRecordATSLayoutRecordVersion1 = 100L,
  108. /*
  109. * Returns the ATSLayoutRecord. This will return the most current
  110. * version of the ATSLayoutRecord, and the one that's defined in this
  111. * file. Always use kATSUDirectDataLayoutRecordATSLayoutRecordCurrent
  112. * to get the array of ATSLayoutRecords. (Array Type):
  113. * ATSLayoutRecord (Return Time): Constant, unless creation is
  114. * necessary, or unless requested by
  115. * ATSUDirectGetLayoutDataArrayPtrFromTextLayout. (Creation): This
  116. * array is always present if the layout has any text assigned to it
  117. * at all. Setting iCreate has no effect.
  118. */
  119. kATSUDirectDataLayoutRecordATSLayoutRecordCurrent = kATSUDirectDataLayoutRecordATSLayoutRecordVersion1
  120. };
  121. /* ---------------------------------------------------------------------------- */
  122. /* Data Types */
  123. /* ---------------------------------------------------------------------------- */
  124. /*
  125. * ATSUStyleSettingRef
  126. *
  127. * Summary:
  128. * A reference to a style setting object that represents an
  129. * ATSUStyle plus any cached/set information about that style.
  130. */
  131. typedef struct ATSStyleSetting* ATSUStyleSettingRef;
  132. /* ---------------------------------------------------------------------------- */
  133. /* Direct Accessors */
  134. /* ---------------------------------------------------------------------------- */
  135. /*
  136. * ATSUDirectGetLayoutDataArrayPtrFromLineRef()
  137. *
  138. * Summary:
  139. * Returns the data pointer specified by iDataSelector and
  140. * referenced by iLineRef.
  141. *
  142. * Discussion:
  143. * This function simply returns the data pointer specified by
  144. * iDataSelector and referenced by iLineRef. This data pointer
  145. * should not be freed directly after it's been used. Rather, it
  146. * should be released using ATSUDirectReleaseLayoutDataArrayPtr.
  147. * Doing so serves as a signal to ATSUI that the caller is done with
  148. * the data and that it can merge it in smoothly and adjust its
  149. * internal processes. Furthermore, it may be the case that the
  150. * pointer returned may be dynamically allocated one or contain
  151. * dynamically allocated data. If it's not properly freed, a memory
  152. * leak may result. This function may only be called within the
  153. * context of an ATSUDirectLayoutOperationOverrideUPP callback. The
  154. * pointer returned points to the exact data referenced by the
  155. * ATSUTextLayout object that triggered the callback call. This is
  156. * by far the most efficient way to use the direct access calls
  157. * because for most requested data, no allocation and copy is done.
  158. * Furthermore, because this a direct pointer to the data that ATSUI
  159. * will use for it's layout, the data arrays returned by this can be
  160. * tweaked and edited. Many of the requested arrays are created by
  161. * ATSUI only when necessary. If these arrays are to be altered,
  162. * then be sure to set iCreate to true. This will ensure that this
  163. * array is created. If the arrays are not created, ATSUI
  164. * automatically assumes that all entries in the array are zero. The
  165. * pointer returned by this function is only valid within the
  166. * context of the callback. Do not attempt to retain it for later
  167. * use.
  168. *
  169. * Parameters:
  170. *
  171. * iLineRef:
  172. * The ATSULineRef which was passed into a
  173. * ATSUDirectLayoutOperationOverrideUPP callback function as a
  174. * parameter.
  175. *
  176. * iDataSelector:
  177. * The selector for the data that is being requested.
  178. *
  179. * iCreate:
  180. * If the ATSULineRef passed in iLineRef does not reference the
  181. * requested array, then a zero-filled one will be created and
  182. * returned in oLayoutDataArray if this is set to true. For some
  183. * ATSUDirectDataSelectors, these cannot be simply created. Thus,
  184. * this flag will have no affect on these few
  185. * ATSUDirectDataSelectors.
  186. *
  187. * oLayoutDataArrayPtr:
  188. * Upon sucessful return, this parameter will contain a pointer to
  189. * an array of the requested values if the ATSULineRef passed in
  190. * iLineRef references those values. If this is not the case, then
  191. * NULL will be returned, unless iCreate is set to true and the
  192. * array can be created. This parameter itself may be set to NULL
  193. * if only a count of the entries is needed.
  194. *
  195. * oLayoutDataCount:
  196. * Upon sucessful return, this parameter will contain a count of
  197. * the entries in the array returned in oLayoutDataArray.
  198. *
  199. * Availability:
  200. * Non-Carbon CFM: not available
  201. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  202. * Mac OS X: in version 10.2 and later
  203. */
  204. EXTERN_API_C( OSStatus )
  205. ATSUDirectGetLayoutDataArrayPtrFromLineRef(
  206. ATSULineRef iLineRef,
  207. ATSUDirectDataSelector iDataSelector,
  208. Boolean iCreate,
  209. void * oLayoutDataArrayPtr[], /* can be NULL */
  210. ItemCount * oLayoutDataCount);
  211. /* ---------------------------------------------------------------------------- */
  212. /*
  213. * ATSUDirectGetLayoutDataArrayPtrFromTextLayout()
  214. *
  215. * Summary:
  216. * Returns the data pointer specified by iDataSelector and
  217. * referenced by iTextLayout for the line starting at iLineOffset.
  218. *
  219. * Discussion:
  220. * This function simply returns the data pointer specified by
  221. * iDataSelector and referenced by iTextLayout for the line starting
  222. * at iLineOffset. This data pointer should not be freed directly
  223. * after it's been used. Rather, it should be released using
  224. * ATSUDirectReleaseLayoutDataArrayPtr. Doing so serves as a signal
  225. * to ATSUI that the caller is done with the data. Furthermore, it
  226. * may be the case that the pointer returned may be dynamically
  227. * allocated one or contain dynamically allocated data. If it's not
  228. * properly freed, a memory leak may result. This function may not
  229. * be called inside the context of an
  230. * ATSUDirectLayoutOperationOverrideUPP callback for the
  231. * ATSUTextLayout data that triggered the callback. All data
  232. * returned will be a copy of the data in the object requested. This
  233. * means two things: first of all, this means that it's a very
  234. * inefficient way of using the data. All of the selectors that
  235. * would have returned in constant time now would be forced to
  236. * return in order-n time. Second of all, this means that the
  237. * developer cannot change any of the data. Any changes the
  238. * developer makes to the arrays returned by this API will have no
  239. * effect on the layout. Using the
  240. * kATSULayoutOperationPostLayoutAdjustment operation selector
  241. * override and the ATSUDirectGetLayoutDataArrayPtrFromLineRef is a
  242. * great alternative to using this API. Many of the requested arrays
  243. * are created by ATSUI only when necessary. This means that it's
  244. * possible that this API will return NULL pointer and a count of 0.
  245. * In this case, if there's no error returned, the array simply
  246. * doesn't exist and the caller should treat all of the entries in
  247. * the array that they would have recieved as being 0.
  248. *
  249. * Parameters:
  250. *
  251. * iTextLayout:
  252. * The ATSUTextLayout object from which the requested data will
  253. * come from.
  254. *
  255. * iLineOffset:
  256. * The edge offset that corresponds to the beginning of the range
  257. * of text of the line of the requested data. If the text has
  258. * multiple lines, then ATSUDirectGetLayoutDataArrayPtrFromLineRef
  259. * will need to be called for each of the lines in which the
  260. * requested data is needed.
  261. *
  262. * iDataSelector:
  263. * The selector for the data that is being requested.
  264. *
  265. * oLayoutDataArrayPtr:
  266. * Upon sucessful return, this parameter will contain a pointer to
  267. * an array of the requested values if the ATSUTextLayout passed
  268. * in iTextLayout references those values for the line offset
  269. * iLineOffset. If this is not the case, then NULL will be
  270. * returned. This parameter itself may be set to NULL if only a
  271. * count of the entries is needed.
  272. *
  273. * oLayoutDataCount:
  274. * Upon sucessful return, this parameter will contain a count of
  275. * the entries in the array returned in oLayoutDataArray.
  276. *
  277. * Availability:
  278. * Non-Carbon CFM: not available
  279. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  280. * Mac OS X: in version 10.2 and later
  281. */
  282. EXTERN_API_C( OSStatus )
  283. ATSUDirectGetLayoutDataArrayPtrFromTextLayout(
  284. ATSUTextLayout iTextLayout,
  285. UniCharArrayOffset iLineOffset,
  286. ATSUDirectDataSelector iDataSelector,
  287. void * oLayoutDataArrayPtr[], /* can be NULL */
  288. ItemCount * oLayoutDataCount);
  289. /* ---------------------------------------------------------------------------- */
  290. /*
  291. * ATSUDirectReleaseLayoutDataArrayPtr()
  292. *
  293. * Summary:
  294. * Properly releases of an array pointer returned by
  295. * ATSUDirectGetLayoutDataArrayPtrFromLineRef() or
  296. * ATSUDirectGetLayoutDataArrayPtrFromTextLayout.
  297. *
  298. * Discussion:
  299. * This function is needed to let ATSUI know that the caller is
  300. * finished with the pointer that was previously requested by
  301. * ATSUDirectGetLayoutDataArrayPtrFromLineRef() or
  302. * ATSUDirectGetLayoutDataArrayPtrFromTextLayout(). This is needed
  303. * in case ATSUI needs to make any internal adjustments to it's
  304. * internal structures.
  305. *
  306. * Parameters:
  307. *
  308. * iLineRef:
  309. * The lineRef from which the layout data array pointer came from.
  310. * If the layout data array pointer did not come from a lineRef,
  311. * then set this to NULL.
  312. *
  313. * iDataSelector:
  314. * The selector for which iLayoutDataArrayPtr was obtained.
  315. *
  316. * iLayoutDataArrayPtr:
  317. * A pointer to the layout data array which is to be disposed of.
  318. *
  319. * Availability:
  320. * Non-Carbon CFM: not available
  321. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  322. * Mac OS X: in version 10.2 and later
  323. */
  324. EXTERN_API_C( OSStatus )
  325. ATSUDirectReleaseLayoutDataArrayPtr(
  326. ATSULineRef iLineRef, /* can be NULL */
  327. ATSUDirectDataSelector iDataSelector,
  328. void * iLayoutDataArrayPtr[]);
  329. /* ---------------------------------------------------------------------------- */
  330. /*
  331. * ATSUDirectAddStyleSettingRef()
  332. *
  333. * Summary:
  334. * This function will fetch a style index for the
  335. * ATSUStyleSettingRef passed in.
  336. *
  337. * Discussion:
  338. * This function allows for glyph replacement or substitution from
  339. * one layout or line to another layout or line. Not only will it
  340. * look up the style index for iStyleSettingRef, but if the
  341. * ATSUStyleSettingRef passed in iStyleSettingRef is not yet part of
  342. * the line referenced by iLineRef, it will add it. If there is an
  343. * outstanding ATSUStyleSettingRef array obtained by using the
  344. * kATSUDirectDataStyleSettingATSUStyleSettingRefArray selector, the
  345. * pointer obtained for this may no longer be valid after this
  346. * function has been called. These pointers should be freed before
  347. * calling this function and re-obtained afterwards.
  348. *
  349. * Parameters:
  350. *
  351. * iLineRef:
  352. * An ATSULineRef which was passed into a
  353. * ATSUDirectLayoutOperationOverrideUPP callback function as a
  354. * parameter.
  355. *
  356. * iStyleSettingRef:
  357. * The ATSUStyleSettingRef to be looked up or added to the
  358. * ATSUTextLayout referenced by iTextLayout for the line starting
  359. * at the offset iLineOffset.
  360. *
  361. * oStyleIndex:
  362. * Upon sucessful return, this will parameter will be set to the
  363. * index of the ATSUStyleSettingRef passed in iStyleSettingRef for
  364. * the line referenced by iLineRef. If the ATSUStyleSettingRef
  365. * does not exist, in that context, then it will be added and the
  366. * new index will be returned here.
  367. *
  368. * Availability:
  369. * Non-Carbon CFM: not available
  370. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  371. * Mac OS X: in version 10.2 and later
  372. */
  373. EXTERN_API_C( OSStatus )
  374. ATSUDirectAddStyleSettingRef(
  375. ATSULineRef iLineRef,
  376. ATSUStyleSettingRef iStyleSettingRef,
  377. UInt16 * oStyleIndex);
  378. #ifdef PRAGMA_IMPORT_OFF
  379. #pragma import off
  380. #elif PRAGMA_IMPORT
  381. #pragma import reset
  382. #endif
  383. #ifdef __cplusplus
  384. }
  385. #endif
  386. #endif /* __ATSUNICODEDIRECTACCESS__ */