1 {
2  *	CTRun.h
3  *	CoreText
4  *
5  *	Copyright (c) 2004-2012 Apple Inc. All rights reserved.
6  *
7  }
8 {  Initial Pascal Translation:  Jonas Maebe, <jonas@freepascal.org>, October 2009 }
9 {  Pascal Translation Updated:  Jonas Maebe, <jonas@freepascal.org>, October 2012 }
10 {  Pascal Translation Updated:  Jonas Maebe, <jonas@freepascal.org>, August 2015 }
11 {
12     Modified for use with Free Pascal
13     Version 308
14     Please report any bugs to <gpc@microbizz.nl>
15 }
16 
17 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
18 {$mode macpas}
19 {$modeswitch cblocks}
20 {$packenum 1}
21 {$macro on}
22 {$inline on}
23 {$calling mwpascal}
24 
25 unit CTRun;
26 interface
27 {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
28 {$setc GAP_INTERFACES_VERSION := $0308}
29 
30 {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
31     {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
32 {$endc}
33 
34 {$ifc defined CPUPOWERPC and defined CPUI386}
35 	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
36 {$endc}
37 {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
38 	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
39 {$endc}
40 
41 {$ifc not defined __ppc__ and defined CPUPOWERPC32}
42 	{$setc __ppc__ := 1}
43 {$elsec}
44 	{$setc __ppc__ := 0}
45 {$endc}
46 {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
47 	{$setc __ppc64__ := 1}
48 {$elsec}
49 	{$setc __ppc64__ := 0}
50 {$endc}
51 {$ifc not defined __i386__ and defined CPUI386}
52 	{$setc __i386__ := 1}
53 {$elsec}
54 	{$setc __i386__ := 0}
55 {$endc}
56 {$ifc not defined __x86_64__ and defined CPUX86_64}
57 	{$setc __x86_64__ := 1}
58 {$elsec}
59 	{$setc __x86_64__ := 0}
60 {$endc}
61 {$ifc not defined __arm__ and defined CPUARM}
62 	{$setc __arm__ := 1}
63 {$elsec}
64 	{$setc __arm__ := 0}
65 {$endc}
66 {$ifc not defined __arm64__ and defined CPUAARCH64}
67   {$setc __arm64__ := 1}
68 {$elsec}
69   {$setc __arm64__ := 0}
70 {$endc}
71 
72 {$ifc defined cpu64}
73   {$setc __LP64__ := 1}
74 {$elsec}
75   {$setc __LP64__ := 0}
76 {$endc}
77 
78 
79 {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
80 	{$error Conflicting definitions for __ppc__ and __i386__}
81 {$endc}
82 
83 {$ifc defined __ppc__ and __ppc__}
84 	{$setc TARGET_CPU_PPC := TRUE}
85 	{$setc TARGET_CPU_PPC64 := FALSE}
86 	{$setc TARGET_CPU_X86 := FALSE}
87 	{$setc TARGET_CPU_X86_64 := FALSE}
88 	{$setc TARGET_CPU_ARM := FALSE}
89 	{$setc TARGET_CPU_ARM64 := FALSE}
90 	{$setc TARGET_OS_MAC := TRUE}
91 	{$setc TARGET_OS_IPHONE := FALSE}
92 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
93 	{$setc TARGET_OS_EMBEDDED := FALSE}
94 {$elifc defined __ppc64__ and __ppc64__}
95 	{$setc TARGET_CPU_PPC := FALSE}
96 	{$setc TARGET_CPU_PPC64 := TRUE}
97 	{$setc TARGET_CPU_X86 := FALSE}
98 	{$setc TARGET_CPU_X86_64 := FALSE}
99 	{$setc TARGET_CPU_ARM := FALSE}
100 	{$setc TARGET_CPU_ARM64 := FALSE}
101 	{$setc TARGET_OS_MAC := TRUE}
102 	{$setc TARGET_OS_IPHONE := FALSE}
103 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
104 	{$setc TARGET_OS_EMBEDDED := FALSE}
105 {$elifc defined __i386__ and __i386__}
106 	{$setc TARGET_CPU_PPC := FALSE}
107 	{$setc TARGET_CPU_PPC64 := FALSE}
108 	{$setc TARGET_CPU_X86 := TRUE}
109 	{$setc TARGET_CPU_X86_64 := FALSE}
110 	{$setc TARGET_CPU_ARM := FALSE}
111 	{$setc TARGET_CPU_ARM64 := FALSE}
112 {$ifc defined iphonesim}
113  	{$setc TARGET_OS_MAC := FALSE}
114 	{$setc TARGET_OS_IPHONE := TRUE}
115 	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
116 {$elsec}
117 	{$setc TARGET_OS_MAC := TRUE}
118 	{$setc TARGET_OS_IPHONE := FALSE}
119 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
120 {$endc}
121 	{$setc TARGET_OS_EMBEDDED := FALSE}
122 {$elifc defined __x86_64__ and __x86_64__}
123 	{$setc TARGET_CPU_PPC := FALSE}
124 	{$setc TARGET_CPU_PPC64 := FALSE}
125 	{$setc TARGET_CPU_X86 := FALSE}
126 	{$setc TARGET_CPU_X86_64 := TRUE}
127 	{$setc TARGET_CPU_ARM := FALSE}
128 	{$setc TARGET_CPU_ARM64 := FALSE}
129 {$ifc defined iphonesim}
130  	{$setc TARGET_OS_MAC := FALSE}
131 	{$setc TARGET_OS_IPHONE := TRUE}
132 	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
133 {$elsec}
134 	{$setc TARGET_OS_MAC := TRUE}
135 	{$setc TARGET_OS_IPHONE := FALSE}
136 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
137 {$endc}
138 	{$setc TARGET_OS_EMBEDDED := FALSE}
139 {$elifc defined __arm__ and __arm__}
140 	{$setc TARGET_CPU_PPC := FALSE}
141 	{$setc TARGET_CPU_PPC64 := FALSE}
142 	{$setc TARGET_CPU_X86 := FALSE}
143 	{$setc TARGET_CPU_X86_64 := FALSE}
144 	{$setc TARGET_CPU_ARM := TRUE}
145 	{$setc TARGET_CPU_ARM64 := FALSE}
146 	{$setc TARGET_OS_MAC := FALSE}
147 	{$setc TARGET_OS_IPHONE := TRUE}
148 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
149 	{$setc TARGET_OS_EMBEDDED := TRUE}
150 {$elifc defined __arm64__ and __arm64__}
151 	{$setc TARGET_CPU_PPC := FALSE}
152 	{$setc TARGET_CPU_PPC64 := FALSE}
153 	{$setc TARGET_CPU_X86 := FALSE}
154 	{$setc TARGET_CPU_X86_64 := FALSE}
155 	{$setc TARGET_CPU_ARM := FALSE}
156 	{$setc TARGET_CPU_ARM64 := TRUE}
157 {$ifc defined ios}
158 	{$setc TARGET_OS_MAC := FALSE}
159 	{$setc TARGET_OS_IPHONE := TRUE}
160 	{$setc TARGET_OS_EMBEDDED := TRUE}
161 {$elsec}
162 	{$setc TARGET_OS_MAC := TRUE}
163 	{$setc TARGET_OS_IPHONE := FALSE}
164 	{$setc TARGET_OS_EMBEDDED := FALSE}
165 {$endc}
166 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
167 {$elsec}
168 	{$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
169 {$endc}
170 
171 {$ifc defined __LP64__ and __LP64__ }
172   {$setc TARGET_CPU_64 := TRUE}
173 {$elsec}
174   {$setc TARGET_CPU_64 := FALSE}
175 {$endc}
176 
177 {$ifc defined FPC_BIG_ENDIAN}
178 	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
179 	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
180 {$elifc defined FPC_LITTLE_ENDIAN}
181 	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
182 	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
183 {$elsec}
184 	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
185 {$endc}
186 {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
187 {$setc CALL_NOT_IN_CARBON := FALSE}
188 {$setc OLDROUTINENAMES := FALSE}
189 {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
190 {$setc OPAQUE_UPP_TYPES := TRUE}
191 {$setc OTCARBONAPPLICATION := TRUE}
192 {$setc OTKERNEL := FALSE}
193 {$setc PM_USE_SESSION_APIS := TRUE}
194 {$setc TARGET_API_MAC_CARBON := TRUE}
195 {$setc TARGET_API_MAC_OS8 := FALSE}
196 {$setc TARGET_API_MAC_OSX := TRUE}
197 {$setc TARGET_CARBON := TRUE}
198 {$setc TARGET_CPU_68K := FALSE}
199 {$setc TARGET_CPU_MIPS := FALSE}
200 {$setc TARGET_CPU_SPARC := FALSE}
201 {$setc TARGET_OS_UNIX := FALSE}
202 {$setc TARGET_OS_WIN32 := FALSE}
203 {$setc TARGET_RT_MAC_68881 := FALSE}
204 {$setc TARGET_RT_MAC_CFM := FALSE}
205 {$setc TARGET_RT_MAC_MACHO := TRUE}
206 {$setc TYPED_FUNCTION_POINTERS := TRUE}
207 {$setc TYPE_BOOL := FALSE}
208 {$setc TYPE_EXTENDED := FALSE}
209 {$setc TYPE_LONGLONG := TRUE}
210 uses MacTypes,CFBase,CFDictionary,CGBase,CGAffineTransforms,CGContext,CGFont,CGGeometry;
211 {$endc} {not MACOSALLINCLUDE}
212 
213 
214 {$ALIGN POWER}
215 
216 
217 {!
218     @header
219 
220     Thread Safety Information
221 
222     All functions in this header are thread safe unless otherwise specified.
223 }
224 
225 
226 { --------------------------------------------------------------------------- }
227 { Glyph Run Types }
228 { --------------------------------------------------------------------------- }
229 
230 type
231 	CTRunRef = ^__CTRun; { an opaque type }
232 	__CTRun = record end;
233 
234 
235 {!
236 	@enum		CTRunStatus
237 	@abstract	A bitfield passed back by CTRunGetStatus that is used to
238 				indicate the disposition of the run.
239 
240 	@constant	kCTRunStatusNoStatus
241 				The run has no special attributes.
242 
243 	@constant	kCTRunStatusRightToLeft
244 				When set, the run is right to left.
245 
246 	@constant	kCTRunStatusNonMonotonic
247 				When set, the run has been reordered in some way such that
248 				the string indices associated with the glyphs are no longer
249 				strictly increasing (for left to right runs) or decreasing
250 				(for right to left runs).
251 
252 	@constant	kCTRunStatusHasNonIdentityMatrix
253 				When set, the run requires a specific text matrix to be set
254 				in the current CG context for proper drawing.
255 }
256 
257 const
258 	kCTRunStatusNoStatus = 0;
259 	kCTRunStatusRightToLeft = 1 shl 0;
260 	kCTRunStatusNonMonotonic = 1 shl 1;
261 	kCTRunStatusHasNonIdentityMatrix = 1 shl 2;
262 type
263 	CTRunStatus = UInt32;
264 
265 
266 {!
267 	@function	CTRunGetTypeID
268 	@abstract	Returns the CFType of the run object
269 }
270 
CTRunGetTypeIDnull271 function CTRunGetTypeID: CFTypeID; external name '_CTRunGetTypeID';
272 (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
273 
274 
275 { --------------------------------------------------------------------------- }
276 { Glyph Run Access }
277 { --------------------------------------------------------------------------- }
278 
279 {!
280 	@function	CTRunGetGlyphCount
281 	@abstract	Gets the glyph count for the run.
282 
283 	@param		run
284 				The run whose glyph count you wish to access.
285 
286 	@result		The number of glyphs that the run contains. It is totally
287 				possible that this function could return a value of zero,
288 				indicating that there are no glyphs in this run.
289 }
290 
CTRunGetGlyphCountnull291 function CTRunGetGlyphCount( run: CTRunRef ): CFIndex; external name '_CTRunGetGlyphCount';
292 (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
293 
294 
295 {!
296 	@function	CTRunGetAttributes
297 	@abstract	Returns the attribute dictionary that was used to create the
298 				glyph run.
299 
300 	@discussion This dictionary returned is either the same exact one that was
301 				set as an attribute dictionary on the original attributed string
302 				or a dictionary that has been manufactured by the layout engine.
303 				Attribute dictionaries can be manufactured in the case of font
304 				substitution or if they are missing critical attributes.
305 
306 	@param		run
307 				The run whose attributes you wish to access.
308 
309 	@result		A valid CFDictionaryRef or NULL.
310 }
311 
CTRunGetAttributesnull312 function CTRunGetAttributes( run: CTRunRef ): CFDictionaryRef; external name '_CTRunGetAttributes';
313 (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
314 
315 
316 {!
317 	@function	CTRunGetStatus
318 	@abstract	Returns the run's status.
319 
320 	@discussion In addition to attributes, runs also have status that can be
321 				used to expedite certain operations. Knowing the direction and
322 				ordering of a run's glyphs can aid in string index analysis,
323 				whereas knowing whether the positions reference the identity
324 				text matrix can avoid expensive comparisons. Note that this
325 				status is provided as a convenience, since this information is
326 				not strictly necessary but can certainly be helpful.
327 
328 	@param		run
329 				The run whose status you wish to access.
330 
331 	@result		The run's status.
332 }
333 
CTRunGetStatusnull334 function CTRunGetStatus( run: CTRunRef ): CTRunStatus; external name '_CTRunGetStatus';
335 (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
336 
337 
338 {!
339 	@function	CTRunGetGlyphsPtr
340 	@abstract	Returns a direct pointer for the glyph array stored in the run.
341 
342 	@discussion The glyph array will have a length equal to the value returned by
343 				CTRunGetGlyphCount. The caller should be prepared for this
344 				function to return NULL even if there are glyphs in the stream.
345 				Should this function return NULL, the caller will need to
346 				allocate their own buffer and call CTRunGetGlyphs to fetch the
347 				glyphs.
348 
349 	@param		run
350 				The run whose glyphs you wish to access.
351 
352 	@result		A valid pointer to an array of CGGlyph structures or NULL.
353 }
354 
CTRunGetGlyphsPtrnull355 function CTRunGetGlyphsPtr( run: CTRunRef ): CGGlyphPtr; external name '_CTRunGetGlyphsPtr';
356 (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
357 
358 
359 {!
360 	@function	CTRunGetGlyphs
361 	@abstract	Copies a range of glyphs into user-provided buffer.
362 
363 	@param		run
364 				The run whose glyphs you wish to copy.
365 
366 	@param		range
367 				The range of glyphs you wish to copy. If the length of the range
368 				is set to 0, then the copy operation will continue from the
369 				range's start index to the end of the run.
370 
371 	@param		buffer
372 				The buffer where the glyphs will be copied to. The buffer must be
373 				allocated to at least the value specified by the range's length.
374 }
375 
376 procedure CTRunGetGlyphs( run: CTRunRef; range: CFRange; buffer: {variable-size-array} CGGlyphPtr ); external name '_CTRunGetGlyphs';
377 (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
378 
379 
380 {!
381 	@function	CTRunGetPositionsPtr
382 	@abstract	Returns a direct pointer for the glyph position array stored in
383 				the run.
384 
385 	@discussion The glyph positions in a run are relative to the origin of the
386 				line containing the run. The position array will have a length
387 				equal to the value returned by CTRunGetGlyphCount. The caller
388 				should be prepared for this function to return NULL even if there
389 				are glyphs in the stream. Should this function return NULL, the
390 				caller will need to allocate their own buffer and call
391 				CTRunGetPositions to fetch the positions.
392 
393 	@param		run
394 				The run whose positions you wish to access.
395 
396 	@result		A valid pointer to an array of CGPoint structures or NULL.
397 }
398 
CTRunGetPositionsPtrnull399 function CTRunGetPositionsPtr( run: CTRunRef ): CGPointPtr; external name '_CTRunGetPositionsPtr';
400 (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
401 
402 
403 {!
404 	@function	CTRunGetPositions
405 	@abstract	Copies a range of glyph positions into a user-provided buffer.
406 
407 	@discussion The glyph positions in a run are relative to the origin of the
408 				line containing the run.
409 
410 	@param		run
411 				The run whose positions you wish to copy.
412 
413 	@param		range
414 				The range of glyph positions you wish to copy. If the length of
415 				the range is set to 0, then the copy operation will continue from
416 				the range's start index to the end of the run.
417 
418 	@param		buffer
419 				The buffer where the glyph positions will be copied to. The buffer
420 				must be allocated to at least the value specified by the range's
421 				length.
422 }
423 
424 procedure CTRunGetPositions( run: CTRunRef; range: CFRange; buffer: {variable-size-array} CGPointPtr ); external name '_CTRunGetPositions';
425 (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
426 
427 
428 {!
429 	@function	CTRunGetAdvancesPtr
430 	@abstract	Returns a direct pointer for the glyph advance array stored in
431 				the run.
432 
433 	@discussion The advance array will have a length equal to the value returned
434 				by CTRunGetGlyphCount. The caller should be prepared for this
435 				function to return NULL even if there are glyphs in the stream.
436 				Should this function return NULL, the caller will need to
437 				allocate their own buffer and call CTRunGetAdvances to fetch the
438 				advances. Note that advances alone are not sufficient for correctly
439 				positioning glyphs in a line, as a run may have a non-identity
440 				matrix or the initial glyph in a line may have a non-zero origin;
441 				callers should consider using positions instead.
442 
443 	@param		run
444 				The run whose advances you wish to access.
445 
446 	@result		A valid pointer to an array of CGSize structures or NULL.
447 }
448 
CTRunGetAdvancesPtrnull449 function CTRunGetAdvancesPtr( run: CTRunRef ): CGSizePtr; external name '_CTRunGetAdvancesPtr';
450 (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
451 
452 
453 {!
454 	@function	CTRunGetAdvances
455 	@abstract	Copies a range of glyph advances into a user-provided buffer.
456 
457 	@param		run
458 				The run whose advances you wish to copy.
459 
460 	@param		range
461 				The range of glyph advances you wish to copy. If the length of
462 				the range is set to 0, then the copy operation will continue from
463 				the range's start index to the end of the run.
464 
465 	@param		buffer
466 				The buffer where the glyph advances will be copied to. The buffer
467 				must be allocated to at least the value specified by the range's
468 				length.
469 }
470 
471 procedure CTRunGetAdvances( run: CTRunRef; range: CFRange; buffer: {variable-size-array} CGSizePtr ); external name '_CTRunGetAdvances';
472 (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
473 
474 
475 {!
476 	@function	CTRunGetStringIndicesPtr
477 	@abstract	Returns a direct pointer for the string indices stored in the run.
478 
479 	@discussion The indices are the character indices that originally spawned the
480 				glyphs that make up the run. They can be used to map the glyphs in
481 				the run back to the characters in the backing store. The string
482 				indices array will have a length equal to the value returned by
483 				CTRunGetGlyphCount. The caller should be prepared for this
484 				function to return NULL even if there are glyphs in the stream.
485 				Should this function return NULL, the caller will need to allocate
486 				their own buffer and call CTRunGetStringIndices to fetch the
487 				indices.
488 
489 	@param		run
490 				The run whose string indices you wish to access.
491 
492 	@result		A valid pointer to an array of CFIndex structures or NULL.
493 }
494 
CTRunGetStringIndicesPtrnull495 function CTRunGetStringIndicesPtr( run: CTRunRef ): CFIndexPtr; external name '_CTRunGetStringIndicesPtr';
496 (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
497 
498 
499 {!
500 	@function	CTRunGetStringIndices
501 	@abstract	Copies a range of string indices int o a user-provided buffer.
502 
503 	@discussion The indices are the character indices that originally spawned the
504 				glyphs that make up the run. They can be used to map the glyphs
505 				in the run back to the characters in the backing store.
506 
507 	@param		run
508 				The run whose string indices you wish to copy.
509 
510 	@param		range
511 				The range of string indices you wish to copy. If the length of
512 				the range is set to 0, then the copy operation will continue from
513 				the range's start index to the end of the run.
514 
515 	@param		buffer
516 				The buffer where the string indices will be copied to. The buffer
517 				must be allocated to at least the value specified by the range's
518 				length.
519 }
520 
521 procedure CTRunGetStringIndices( run: CTRunRef; range: CFRange; buffer: {variable-size-array} CFIndexPtr ); external name '_CTRunGetStringIndices';
522 (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
523 
524 
525 {!
526 	@function	CTRunGetStringRange
527 	@abstract	Gets the range of characters that originally spawned the glyphs
528 				in the run.
529 
530 	@param		run
531 				The run whose string range you wish to access.
532 
533 	@result		Returns the range of characters that originally spawned the
534 				glyphs. If run is invalid, this will return an empty range.
535 }
536 
CTRunGetStringRangenull537 function CTRunGetStringRange( run: CTRunRef ): CFRange; external name '_CTRunGetStringRange';
538 (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
539 
540 
541 {!
542 	@function	CTRunGetTypographicBounds
543 	@abstract	Gets the typographic bounds of the run.
544 
545 	@param		run
546 				The run that you want to calculate the typographic bounds for.
547 
548 	@param		range
549 				The portion of the run which to measure. If the length of the
550 				range is set to 0, then the measure operation will continue from
551 				the range's start index to the end of the run.
552 
553 	@param		ascent
554 				Upon return, this parameter will contain the ascent of the run.
555 				This may be set to NULL if not needed.
556 
557 	@param		descent
558 				Upon return, this parameter will contain the descent of the run.
559 				This may be set to NULL if not needed.
560 
561 	@param		leading
562 				Upon return, this parameter will contain the leading of the run.
563 				This may be set to NULL if not needed.
564 
565 	@result		The typographic width of the run. If run or range is
566 				invalid, then this function will always return zero.
567 }
568 
CTRunGetTypographicBoundsnull569 function CTRunGetTypographicBounds( run: CTRunRef; range: CFRange; ascent: CGFloatPtr {can be null}; descent: CGFloatPtr {can be null}; leading: CGFloat {can be null} ): Float64; external name '_CTRunGetTypographicBounds';
570 (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
571 
572 
573 {!
574 	@function	CTRunGetImageBounds
575 	@abstract	Calculates the image bounds for a glyph range.
576 
577 	@discussion The image bounds for a run is the union of all non-empty glyph
578 				bounding rects, each positioned as it would be if drawn using
579 				CTRunDraw using the current context. Note that the result is
580 				ideal and does not account for raster coverage due to rendering.
581 				This function is purely a convenience for using glyphs as an
582 				image and should not be used for typographic purposes.
583 
584 	@param		run
585 				The run that you want to calculate the image bounds for.
586 
587 	@param		context
588 				The context which the image bounds will be calculated for or NULL,
589                 in which case the bounds are relative to CGPointZero.
590 
591 	@param		range
592 				The portion of the run which to measure. If the length of the
593 				range is set to 0, then the measure operation will continue from
594 				the range's start index to the end of the run.
595 
596 	@result		A rect that tightly encloses the paths of the run's glyphs. The
597 				rect origin will match the drawn position of the requested range;
598 				that is, it will be translated by the supplied context's text
599 				position and the positions of the individual glyphs. If the run
600                 or range is invalid, CGRectNull will be returned.
601 
602 	@seealso	CTRunGetTypographicBounds
603 }
604 
CTRunGetImageBoundsnull605 function CTRunGetImageBounds( run: CTRunRef; context: CGContextRef; range: CFRange ): CGRect; external name '_CTRunGetImageBounds';
606 (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
607 
608 
609 {!
610 	@function	CTRunGetTextMatrix
611 	@abstract	Returns the text matrix needed to draw this run.
612 
613 	@discussion To properly draw the glyphs in a run, the fields 'tx' and 'ty' of
614 				the CGAffineTransform returned by this function should be set to
615 				the current text position.
616 
617 	@param		run
618 				The run object from which to get the text matrix.
619 
620 	@result		A CGAffineTransform.
621 }
622 
CTRunGetTextMatrixnull623 function CTRunGetTextMatrix( run: CTRunRef ): CGAffineTransform; external name '_CTRunGetTextMatrix';
624 (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
625 
626 
627 {!
628 	@function	CTRunDraw
629 	@abstract	Draws a complete run or part of one.
630 
631 	@discussion This is a convenience call, since the run could also be drawn by
632 				accessing its glyphs, positions, and text matrix. Unlike when
633 				drawing the entire line containing the run with CTLineDraw, the
634 				run's underline (if any) will not be drawn, since the underline's
635 				appearance may depend on other runs in the line. Note that this
636 				call may leave the graphics context in any state and does not
637 				flush the context after the draw operation.
638 
639 	@param		run
640 				The run that you want to draw.
641 
642 	@param		context
643 				The context to draw the run to.
644 
645 	@param		range
646 				The portion of the run to draw. If the length of the range is set
647 				to 0, then the draw operation will continue from the range's
648 				start index to the end of the run.
649 }
650 
651 procedure CTRunDraw( run: CTRunRef; context: CGContextRef; range: CFRange ); external name '_CTRunDraw';
652 (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
653 
654 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
655 
656 end.
657 {$endc} {not MACOSALLINCLUDE}
658