1 {
2 File: CommonPanels/FontPanel.h
3
4 Contains: Carbon Font Panel package Interfaces.
5
6 Version: CommonPanels-94~602
7
8 Copyright: � 2002-2008 by Apple Computer, Inc., all rights reserved
9
10 Bugs?: For bug reports, consult the following page on
11 the World Wide Web:
12
13 http://bugs.freepascal.org
14
15 }
16 { Pascal Translation: Gale R Paeper, <gpaeper@empirenet.com>, 2006 }
17 { Pascal Translation Updated: Jonas Maebe, <jonas@freepascal.org>, October 2009 }
18 { Pascal Translation Updated: Jonas Maebe, <jonas@freepascal.org>, October 2012 }
19 {
20 Modified for use with Free Pascal
21 Version 308
22 Please report any bugs to <gpc@microbizz.nl>
23 }
24
25 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
26 {$mode macpas}
27 {$modeswitch cblocks}
28 {$packenum 1}
29 {$macro on}
30 {$inline on}
31 {$calling mwpascal}
32
33 unit FontPanel;
34 interface
35 {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
36 {$setc GAP_INTERFACES_VERSION := $0308}
37
38 {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
39 {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
40 {$endc}
41
42 {$ifc defined CPUPOWERPC and defined CPUI386}
43 {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
44 {$endc}
45 {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
46 {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
47 {$endc}
48
49 {$ifc not defined __ppc__ and defined CPUPOWERPC32}
50 {$setc __ppc__ := 1}
51 {$elsec}
52 {$setc __ppc__ := 0}
53 {$endc}
54 {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
55 {$setc __ppc64__ := 1}
56 {$elsec}
57 {$setc __ppc64__ := 0}
58 {$endc}
59 {$ifc not defined __i386__ and defined CPUI386}
60 {$setc __i386__ := 1}
61 {$elsec}
62 {$setc __i386__ := 0}
63 {$endc}
64 {$ifc not defined __x86_64__ and defined CPUX86_64}
65 {$setc __x86_64__ := 1}
66 {$elsec}
67 {$setc __x86_64__ := 0}
68 {$endc}
69 {$ifc not defined __arm__ and defined CPUARM}
70 {$setc __arm__ := 1}
71 {$elsec}
72 {$setc __arm__ := 0}
73 {$endc}
74 {$ifc not defined __arm64__ and defined CPUAARCH64}
75 {$setc __arm64__ := 1}
76 {$elsec}
77 {$setc __arm64__ := 0}
78 {$endc}
79
80 {$ifc defined cpu64}
81 {$setc __LP64__ := 1}
82 {$elsec}
83 {$setc __LP64__ := 0}
84 {$endc}
85
86
87 {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
88 {$error Conflicting definitions for __ppc__ and __i386__}
89 {$endc}
90
91 {$ifc defined __ppc__ and __ppc__}
92 {$setc TARGET_CPU_PPC := TRUE}
93 {$setc TARGET_CPU_PPC64 := FALSE}
94 {$setc TARGET_CPU_X86 := FALSE}
95 {$setc TARGET_CPU_X86_64 := FALSE}
96 {$setc TARGET_CPU_ARM := FALSE}
97 {$setc TARGET_CPU_ARM64 := FALSE}
98 {$setc TARGET_OS_MAC := TRUE}
99 {$setc TARGET_OS_IPHONE := FALSE}
100 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
101 {$setc TARGET_OS_EMBEDDED := FALSE}
102 {$elifc defined __ppc64__ and __ppc64__}
103 {$setc TARGET_CPU_PPC := FALSE}
104 {$setc TARGET_CPU_PPC64 := TRUE}
105 {$setc TARGET_CPU_X86 := FALSE}
106 {$setc TARGET_CPU_X86_64 := FALSE}
107 {$setc TARGET_CPU_ARM := FALSE}
108 {$setc TARGET_CPU_ARM64 := FALSE}
109 {$setc TARGET_OS_MAC := TRUE}
110 {$setc TARGET_OS_IPHONE := FALSE}
111 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
112 {$setc TARGET_OS_EMBEDDED := FALSE}
113 {$elifc defined __i386__ and __i386__}
114 {$setc TARGET_CPU_PPC := FALSE}
115 {$setc TARGET_CPU_PPC64 := FALSE}
116 {$setc TARGET_CPU_X86 := TRUE}
117 {$setc TARGET_CPU_X86_64 := FALSE}
118 {$setc TARGET_CPU_ARM := FALSE}
119 {$setc TARGET_CPU_ARM64 := FALSE}
120 {$ifc defined iphonesim}
121 {$setc TARGET_OS_MAC := FALSE}
122 {$setc TARGET_OS_IPHONE := TRUE}
123 {$setc TARGET_IPHONE_SIMULATOR := TRUE}
124 {$elsec}
125 {$setc TARGET_OS_MAC := TRUE}
126 {$setc TARGET_OS_IPHONE := FALSE}
127 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
128 {$endc}
129 {$setc TARGET_OS_EMBEDDED := FALSE}
130 {$elifc defined __x86_64__ and __x86_64__}
131 {$setc TARGET_CPU_PPC := FALSE}
132 {$setc TARGET_CPU_PPC64 := FALSE}
133 {$setc TARGET_CPU_X86 := FALSE}
134 {$setc TARGET_CPU_X86_64 := TRUE}
135 {$setc TARGET_CPU_ARM := FALSE}
136 {$setc TARGET_CPU_ARM64 := FALSE}
137 {$ifc defined iphonesim}
138 {$setc TARGET_OS_MAC := FALSE}
139 {$setc TARGET_OS_IPHONE := TRUE}
140 {$setc TARGET_IPHONE_SIMULATOR := TRUE}
141 {$elsec}
142 {$setc TARGET_OS_MAC := TRUE}
143 {$setc TARGET_OS_IPHONE := FALSE}
144 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
145 {$endc}
146 {$setc TARGET_OS_EMBEDDED := FALSE}
147 {$elifc defined __arm__ and __arm__}
148 {$setc TARGET_CPU_PPC := FALSE}
149 {$setc TARGET_CPU_PPC64 := FALSE}
150 {$setc TARGET_CPU_X86 := FALSE}
151 {$setc TARGET_CPU_X86_64 := FALSE}
152 {$setc TARGET_CPU_ARM := TRUE}
153 {$setc TARGET_CPU_ARM64 := FALSE}
154 {$setc TARGET_OS_MAC := FALSE}
155 {$setc TARGET_OS_IPHONE := TRUE}
156 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
157 {$setc TARGET_OS_EMBEDDED := TRUE}
158 {$elifc defined __arm64__ and __arm64__}
159 {$setc TARGET_CPU_PPC := FALSE}
160 {$setc TARGET_CPU_PPC64 := FALSE}
161 {$setc TARGET_CPU_X86 := FALSE}
162 {$setc TARGET_CPU_X86_64 := FALSE}
163 {$setc TARGET_CPU_ARM := FALSE}
164 {$setc TARGET_CPU_ARM64 := TRUE}
165 {$ifc defined ios}
166 {$setc TARGET_OS_MAC := FALSE}
167 {$setc TARGET_OS_IPHONE := TRUE}
168 {$setc TARGET_OS_EMBEDDED := TRUE}
169 {$elsec}
170 {$setc TARGET_OS_MAC := TRUE}
171 {$setc TARGET_OS_IPHONE := FALSE}
172 {$setc TARGET_OS_EMBEDDED := FALSE}
173 {$endc}
174 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
175 {$elsec}
176 {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
177 {$endc}
178
179 {$ifc defined __LP64__ and __LP64__ }
180 {$setc TARGET_CPU_64 := TRUE}
181 {$elsec}
182 {$setc TARGET_CPU_64 := FALSE}
183 {$endc}
184
185 {$ifc defined FPC_BIG_ENDIAN}
186 {$setc TARGET_RT_BIG_ENDIAN := TRUE}
187 {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
188 {$elifc defined FPC_LITTLE_ENDIAN}
189 {$setc TARGET_RT_BIG_ENDIAN := FALSE}
190 {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
191 {$elsec}
192 {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
193 {$endc}
194 {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
195 {$setc CALL_NOT_IN_CARBON := FALSE}
196 {$setc OLDROUTINENAMES := FALSE}
197 {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
198 {$setc OPAQUE_UPP_TYPES := TRUE}
199 {$setc OTCARBONAPPLICATION := TRUE}
200 {$setc OTKERNEL := FALSE}
201 {$setc PM_USE_SESSION_APIS := TRUE}
202 {$setc TARGET_API_MAC_CARBON := TRUE}
203 {$setc TARGET_API_MAC_OS8 := FALSE}
204 {$setc TARGET_API_MAC_OSX := TRUE}
205 {$setc TARGET_CARBON := TRUE}
206 {$setc TARGET_CPU_68K := FALSE}
207 {$setc TARGET_CPU_MIPS := FALSE}
208 {$setc TARGET_CPU_SPARC := FALSE}
209 {$setc TARGET_OS_UNIX := FALSE}
210 {$setc TARGET_OS_WIN32 := FALSE}
211 {$setc TARGET_RT_MAC_68881 := FALSE}
212 {$setc TARGET_RT_MAC_CFM := FALSE}
213 {$setc TARGET_RT_MAC_MACHO := TRUE}
214 {$setc TYPED_FUNCTION_POINTERS := TRUE}
215 {$setc TYPE_BOOL := FALSE}
216 {$setc TYPE_EXTENDED := FALSE}
217 {$setc TYPE_LONGLONG := TRUE}
218 uses MacTypes, AEDataModel, AERegistry, ATSTypes, CarbonEventsCore, CFArray, CFBase, CFDictionary, QuickdrawTypes,CGBase;
219 {$endc} {not MACOSALLINCLUDE}
220
221
222 {$ifc TARGET_OS_MAC}
223
224 {$ALIGN MAC68K}
225
226 {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
227 Font Panel-Related Events
228 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
229
230 {
231 * Discussion:
232 * Event classes
233 }
234 const
235 {
236 * Events related to font selection or handling.
237 }
238 kEventClassFont = FourCharCode('font');
239
240
241 {
242 * Summary:
243 * Common command IDs
244 }
245 const
246 {
247 * The state of the Font Panel should be toggled, displaying it or
248 * hiding it as necessary. If the user closes the Font Panel directly
249 * from the window, the application will receive a
250 * kEventFontPanelClosed event.
251 }
252 kHICommandShowHideFontPanel = FourCharCode('shfp');
253
254 { Font Events }
255
256 {
257 * Summary:
258 * Font events (kEventClassFont)
259 *
260 * Discussion:
261 * When the user closes the Font Panel, a kEventWindowClosed event
262 * will be detected by the Carbon event handler installed by the
263 * system. The system then notifies the application that the Font
264 * Panel has closed by posting a Carbon Event Manager event. This
265 * allows the application to update any menu items or other controls
266 * whose state may have to change because the Font Panel has closed.
267 * kEventWindowClosed has no parameters. When the user selects an
268 * item in the Font Panel, the system will send a
269 * kEventFontSelection event to the event target specified when the
270 * application called SetFontInfoForSelection(). kEventFontSelection
271 * will contain parameters reflecting the current Font Panel
272 * selection in all supported formats. Font events are available
273 * after Mac OS X 10.2 in the Carbon framework.
274 }
275 const
276 {
277 * The Font Panel has been closed. The application should update its
278 * corresponding UI element (e.g., a menu item) accordingly.
279 }
280 kEventFontPanelClosed = 1;
281
282 {
283 * The user has specified font settings in the Font Panel. The
284 * application can obtain these settings from the event, in which
285 * they are stored as parameters. Not all parameters are guaranteed
286 * to be present; the application should check for all those which it
287 * recognizes and apply the ones found as appropriate to the target
288 * text.
289 }
290 kEventFontSelection = 2;
291
292 {
293 Parameters for font events:
294
295 kEventFontPanelClosed
296 None.
297
298 kEventFontSelection
299 --> kEventParamATSUFontID typeATSUFontID
300 --> kEventParamATSUFontSize typeATSUSize
301 --> kEventParamFMFontFamily typeFMFontFamily
302 --> kEventParamFMFontSize typeFMFontSize
303 --> kEventParamFontColor typeFontColor
304 --> kEventParamDictionary typeCFDictionaryRef
305 --> kEventParamViewAttributesDictionary typeCFDictionaryRef
306 A dictionary containing attributes that can be applied to an entire text view. An example of this is the background color to
307 apply to the view.
308 }
309 const
310 typeCTFontDescriptorRef = typeCFTypeRef; { CTFontDescriptor reference.}
311 typeATSUFontID = typeUInt32; { ATSUI font ID.}
312 typeATSUSize = typeFixed; { ATSUI font size.}
313 typeFMFontFamily = typeSInt16; { Font family reference.}
314 typeFMFontStyle = typeSInt16; { Quickdraw font style}
315 typeFMFontSize = typeSInt16; { Integer font size.}
316 typeFontColor = typeRGBColor; { Font color spec (optional).}
317 kEventParamCTFontDescriptor = FourCharCode('ctfd'); { typeCTFontDescriptorRef}
318 kEventParamATSUFontID = FourCharCode('auid'); { typeATSUFontID}
319 kEventParamATSUFontSize = FourCharCode('ausz'); { typeATSUSize}
320 kEventParamFMFontFamily = FourCharCode('fmfm'); { typeFMFontFamily}
321 kEventParamFMFontStyle = FourCharCode('fmst'); { typeFMFontStyle}
322 kEventParamFMFontSize = FourCharCode('fmsz'); { typeFMFontSize}
323 kEventParamFontColor = FourCharCode('fclr'); { typeFontColor}
324 kEventParamDictionary = FourCharCode('dict'); { typeCFDictionaryRef}
325 kEventParamViewAttributesDictionary = FourCharCode('dadc'); { typeCFDictionaryRef}
326
327 {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
328 Key constants to be used to access data inside the dictionary that may
329 be contained in the kEventFontSelection dictionary. (kEventParamDictionary)
330 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
331 {
332 * kFontPanelATSUFontIDKey
333 *
334 * Availability:
335 * Mac OS X: in version 10.3 and later in Carbon.framework
336 * CarbonLib: not available
337 * Non-Carbon CFM: not available
338 }
339 var kFontPanelATSUFontIDKey: CFStringRef; external name '_kFontPanelATSUFontIDKey'; (* attribute const *)
340 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
341 {Value is a CFNumber containing the ATSU Font ID}
342 {
343 * kFontPanelVariationAxesKey
344 *
345 * Availability:
346 * Mac OS X: in version 10.3 and later in Carbon.framework
347 * CarbonLib: not available
348 * Non-Carbon CFM: not available
349 }
350 var kFontPanelVariationAxesKey: CFStringRef; external name '_kFontPanelVariationAxesKey'; (* attribute const *)
351 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
352 { Value is a CFDataRef containing one or more ATSUI Variation Axes}
353 {
354 * kFontPanelVariationValuesKey
355 *
356 * Availability:
357 * Mac OS X: in version 10.3 and later in Carbon.framework
358 * CarbonLib: not available
359 * Non-Carbon CFM: not available
360 }
361 var kFontPanelVariationValuesKey: CFStringRef; external name '_kFontPanelVariationValuesKey'; (* attribute const *)
362 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
363 {Value is a CFDataRef containing one or more ATSU Variation values}
364 {
365 * kFontPanelFeatureTypesKey
366 *
367 * Availability:
368 * Mac OS X: in version 10.3 and later in Carbon.framework
369 * CarbonLib: not available
370 * Non-Carbon CFM: not available
371 }
372 var kFontPanelFeatureTypesKey: CFStringRef; external name '_kFontPanelFeatureTypesKey'; (* attribute const *)
373 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
374 { Value is a CFDataRef containing one or more ATSUI feature types}
375 {
376 * kFontPanelFeatureSelectorsKey
377 *
378 * Availability:
379 * Mac OS X: in version 10.3 and later in Carbon.framework
380 * CarbonLib: not available
381 * Non-Carbon CFM: not available
382 }
383 var kFontPanelFeatureSelectorsKey: CFStringRef; external name '_kFontPanelFeatureSelectorsKey'; (* attribute const *)
384 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
385 { Value is a CFDataRef containing one or more ATSUI feature selectors}
386 {
387 * kFontPanelAttributesKey
388 *
389 * Availability:
390 * Mac OS X: in version 10.3 and later in Carbon.framework
391 * CarbonLib: not available
392 * Non-Carbon CFM: not available
393 }
394 var kFontPanelAttributesKey: CFStringRef; external name '_kFontPanelAttributesKey'; (* attribute const *)
395 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
396 {
397 const <CFString> string kFontPanelAttributesKey = "FontAttributes";
398 Value is a CFDictionaryRef containing three keyed values. Each value is
399 a CFDataRef. One CFDataRef contains one or more ATSUAttributeTags.
400 One CFDataRef contains one or more value sizes for each tag. And the last
401 CFDataRef contains the actual values. It is important to understand that
402 these are the actual values and not value ptrs. To pass these values to
403 ATSUI they must be converted into ptrs. The following code fragment demonstrates
404 one technique
405 CFDataRef values;
406 CFDataRef tags;
407 CFDataRef sizes;
408 if ( CFDictionaryGetValueIfPresent( attributesDict, kFontPanelAttributeValuesKey, &values ) &&
409 CFDictionaryGetValueIfPresent( attributesDict, kFontPanelAttributeTagsKey, &tags )
410 CFDictionaryGetValueIfPresent( attributesDict, kFontPanelAttributeSizesKey, &sizes ))
411 (
412 ItemCount count = CFDataGetLength( tags )/sizeof(ATSUAttributeTag);
413 CFIndex index;
414 ATSUAttributeValuePtr valuePtrs = malloc( count * sizeof(ATSUAttributeValuePtr) );
415 UInt32* sizePtr = (UInt32*)CFDataGetBytePtr(sizes);
416 UInt32* bytePtr = (UInt32*)CFDataGetBytePtr(values);
417 for ( index = 0; index < count; index++ )
418 (
419 valuePtrs[index] = bytePtr;
420 bytePtr = (UInt32*)( (UInt8*)bytePtr + sizePtr[index]);
421 )
422 verify_noerr( ATSUSetAttributes( someATSUStyle, count, (ATSUAttributeTag*)CFDataGetBytePtr(tags),sizePtr, valuePtrs ) );
423 free( valuePtrs );
424 }
425 {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
426 Keys to access the CFDataRefs inside the attributes dictionary (see above)
427 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
428 {
429 * kFontPanelAttributeTagsKey
430 *
431 * Availability:
432 * Mac OS X: in version 10.3 and later in Carbon.framework
433 * CarbonLib: not available
434 * Non-Carbon CFM: not available
435 }
436 var kFontPanelAttributeTagsKey: CFStringRef; external name '_kFontPanelAttributeTagsKey'; (* attribute const *)
437 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
438 {Value is a CFDataRef containing one or more style attribute tags}
439 {
440 * kFontPanelAttributeSizesKey
441 *
442 * Availability:
443 * Mac OS X: in version 10.3 and later in Carbon.framework
444 * CarbonLib: not available
445 * Non-Carbon CFM: not available
446 }
447 var kFontPanelAttributeSizesKey: CFStringRef; external name '_kFontPanelAttributeSizesKey'; (* attribute const *)
448 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
449 {Value is a CFDataRef containing one or more style attribute sizes}
450 {
451 * kFontPanelAttributeValuesKey
452 *
453 * Availability:
454 * Mac OS X: in version 10.3 and later in Carbon.framework
455 * CarbonLib: not available
456 * Non-Carbon CFM: not available
457 }
458 var kFontPanelAttributeValuesKey: CFStringRef; external name '_kFontPanelAttributeValuesKey'; (* attribute const *)
459 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
460 {Value is a CFDataRef containing one or more style values}
461 {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
462 Keys to access to access the optional mouse tracking state if the font attribute/feature control is tracking
463 An application can look for this optional value to aid in supporting undo/redo for a font attribute/feature that is represented by
464 a control that tracks such as a slider.
465 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
466 {
467 * kFontPanelMouseTrackingState
468 *
469 * Availability:
470 * Mac OS X: in version 10.5 and later in Carbon.framework
471 * CarbonLib: not available
472 * Non-Carbon CFM: not available
473 }
474 var kFontPanelMouseTrackingState: CFStringRef; external name '_kFontPanelMouseTrackingState'; (* attribute const *)
475 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
476 {
477 The value referenced by this key is a CFNumberRef that will contain one of the following values
478 from CarbonEvents.h
479 kEventMouseDown
480 kEventMouseUp
481 kEventMouseDragged
482 }
483
484 {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
485 Keys to access the data from the document attributes dictionary (kEventParamViewAttributesDictionary)
486 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
487 {
488 * kFontPanelBackgroundColorAttributeName
489 *
490 * Availability:
491 * Mac OS X: in version 10.5 and later in Carbon.framework
492 * CarbonLib: not available
493 * Non-Carbon CFM: not available
494 }
495 var kFontPanelBackgroundColorAttributeName: CFStringRef; external name '_kFontPanelBackgroundColorAttributeName'; (* attribute const *)
496 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
497 {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
498 Other Font Panel Constants
499 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
500 {
501 Error codes (Font Panel codes in range [-8880,-8899]).
502 }
503 const
504 fontPanelShowErr = -8880; { Can't display the Font Panel.}
505 fontPanelSelectionStyleErr = -8881; { Bad font selection style info.}
506 fontPanelFontSelectionQDStyleVersionErr = -8882; { Unsupported record version.}
507
508 {
509 Type of font information passed in SetFontInfoForSelection(). If the client is
510 sending ATSUI style data, it specifies kFontSelectionATSUIType; if it is
511 sending Quickdraw style data, it specifies kFontSelectionQDType.
512 }
513 const
514 kFontSelectionATSUIType = FourCharCode('astl'); { Use ATSUIStyle collection.}
515 kFontSelectionQDType = FourCharCode('qstl'); { Use FontSelectionQDStyle record.}
516 kFontSelectionCoreTextType = FourCharCode('ctfd'); { Use CTFontDescriptorRef.}
517
518 {
519 Supported versions of the FontSelectionQDStyle record. Clients should always set
520 the <version> field to one of these values.
521 }
522 const
523 kFontSelectionQDStyleVersionZero = 0;
524
525
526 {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
527 Font Panel Types
528 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
529 {
530 Record specifying the font information to be specified in the Font
531 Panel. This record is used if the client is sending Quickdraw style data
532 (i.e., it specified kFontSelectionQDType in SetFontInfoForSelection()).
533 }
534 type
535 FontSelectionQDStyle = record
536 version: UInt32; { Version number of struct.}
537 instance: FMFontFamilyInstance; { Font instance data.}
538 size: FMFontSize; { Size of font in points.}
539 hasColor: Boolean; { true if color info supplied.}
540 reserved: UInt8; { Filler byte.}
541 color: RGBColor; { Color specification for font.}
542 end;
543 FontSelectionQDStylePtr = ^FontSelectionQDStyle;
544 {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
545 Font Panel Functions
546 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
547 {
548 * FPIsFontPanelVisible()
549 *
550 * Availability:
551 * Mac OS X: in version 10.2 and later in Carbon.framework
552 * CarbonLib: not available in CarbonLib 1.x
553 * Non-Carbon CFM: not available
554 }
FPIsFontPanelVisiblenull555 function FPIsFontPanelVisible: Boolean; external name '_FPIsFontPanelVisible';
556 (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
557
558
559 {
560 * FPShowHideFontPanel()
561 *
562 * Availability:
563 * Mac OS X: in version 10.2 and later in Carbon.framework
564 * CarbonLib: not available in CarbonLib 1.x
565 * Non-Carbon CFM: not available
566 }
FPShowHideFontPanelnull567 function FPShowHideFontPanel: OSStatus; external name '_FPShowHideFontPanel';
568 (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
569
570
571 {
572 * SetFontInfoForSelection()
573 *
574 * Availability:
575 * Mac OS X: in version 10.2 and later in Carbon.framework
576 * CarbonLib: not available in CarbonLib 1.x
577 * Non-Carbon CFM: not available
578 }
SetFontInfoForSelectionnull579 function SetFontInfoForSelection( iStyleType: OSType; iNumStyles: UInt32; iStyles: UnivPtr; iFPEventTarget: EventTargetRef ): OSStatus; external name '_SetFontInfoForSelection';
580 (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
581
582
583 {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
584 Font Collection Functions
585
586 In 10.3 the ability to create and modify font collections is available. Font
587 collections are files containing font descriptions. Font descriptions are
588 encapsulated in the opaque object FCFontDescriptorRef. A FCFontDescriptroRef
589 is a CFType. To release one call CFRelease.
590
591 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
592 {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
593 Font Collection Types
594 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
595 type
596 FCFontDescriptorRef = ^OpaqueFCFontDescriptorRef; { an opaque type }
597 OpaqueFCFontDescriptorRef = record end;
598 {
599 * FCCopyCollectionNames()
600 *
601 * Discussion:
602 * FCCopyCollectionNames returns a copy of the CFArrayRef containing
603 * the displayable names of every font collection available to the
604 * current user.
605 *
606 * Result:
607 * A CFArrayRef containing CFStringRefs where each CFStringRef
608 * contains a font collection's displayable name. Callers are
609 * responsible for releasing the returned CFArrayRef. If the
610 * operation is not successful NULL is returned.
611 *
612 * Availability:
613 * Mac OS X: in version 10.3 and later in Carbon.framework
614 * CarbonLib: not available
615 * Non-Carbon CFM: not available
616 }
FCCopyCollectionNamesnull617 function FCCopyCollectionNames: CFArrayRef; external name '_FCCopyCollectionNames';
618 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
619
620
621 {
622 * FCCopyFontDescriptorsInCollection()
623 *
624 * Discussion:
625 * FCCopyFontDescriptorsInCollection copies the fontDescriptors in a
626 * named collection into an array.
627 *
628 * Parameters:
629 *
630 * iCollection:
631 * The name of a collection that descriptors should be copied from.
632 *
633 * Result:
634 * A CFArrayRef containing copies of the FCFontDescriptorRefs
635 * contained in the name collection. Callers are responsible for
636 * releasing the returned CFArrayRef. The FCFontDescriptorRefs are
637 * retained when added to the array and released when the array is
638 * destroyed. You can access a font descriptor in the array in the
639 * following manner: fd =
640 * (FCFontDescriptorRef)CFArrayGetValueAtIndex(array, i);
641 *
642 * Availability:
643 * Mac OS X: in version 10.3 and later in Carbon.framework
644 * CarbonLib: not available
645 * Non-Carbon CFM: not available
646 }
FCCopyFontDescriptorsInCollectionnull647 function FCCopyFontDescriptorsInCollection( iCollection: CFStringRef ): CFArrayRef; external name '_FCCopyFontDescriptorsInCollection';
648 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
649
650
651 {
652 * FCAddCollection()
653 *
654 * Discussion:
655 * Add a collection to the font descriptor collections available to
656 * the current user. If the collection is successfully added noErr
657 * is returned. If the collection is not added an error code is
658 * returned.
659 *
660 * Parameters:
661 *
662 * iCollection:
663 * the name of the collection to add.
664 *
665 * iCollectionOptions:
666 * currently there are no options. Set to kNilOptions. This
667 * parameter is available for future expansion.
668 *
669 * Availability:
670 * Mac OS X: in version 10.3 and later in Carbon.framework
671 * CarbonLib: not available
672 * Non-Carbon CFM: not available
673 }
FCAddCollectionnull674 function FCAddCollection( iCollection: CFStringRef; iCollectionOptions: OptionBits ): OSStatus; external name '_FCAddCollection';
675 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
676
677
678 {
679 * FCRemoveCollection()
680 *
681 * Discussion:
682 * Remove a named collection from the font descriptor collections
683 * available to the current user. Returns noErr if the collection
684 * was successfully removed. An appropriate error code is returned
685 * if the operation was not successful.
686 *
687 * Parameters:
688 *
689 * iCollection:
690 * the name of the collection to remove.
691 *
692 * Availability:
693 * Mac OS X: in version 10.3 and later in Carbon.framework
694 * CarbonLib: not available
695 * Non-Carbon CFM: not available
696 }
FCRemoveCollectionnull697 function FCRemoveCollection( iCollection: CFStringRef ): OSStatus; external name '_FCRemoveCollection';
698 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
699
700
701 {
702 * FCAddFontDescriptorToCollection()
703 *
704 * Discussion:
705 * Add a font descriptor to the named collection. noErr is returned
706 * if the font descriptor is added. An error code describing the
707 * failure is returned if the descriptor is not added.
708 *
709 * Parameters:
710 *
711 * iDescriptor:
712 * the font descriptor that should be added. The
713 * FCFontDescriptorRef is retained when it is added to the
714 * collection. After calling this function the caller may release
715 * their copy.
716 *
717 * iCollection:
718 * the name of the collection to which the font descriptor should
719 * be added.
720 *
721 * Availability:
722 * Mac OS X: in version 10.3 and later in Carbon.framework
723 * CarbonLib: not available
724 * Non-Carbon CFM: not available
725 }
FCAddFontDescriptorToCollectionnull726 function FCAddFontDescriptorToCollection( iDescriptor: FCFontDescriptorRef; iCollection: CFStringRef ): OSStatus; external name '_FCAddFontDescriptorToCollection';
727 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
728
729
730 {
731 * FCRemoveFontDescriptorFromCollection()
732 *
733 * Discussion:
734 * Remove a font descriptor from the named collection. An error is
735 * returned if the font descriptor can not be removed. noErr is
736 * returned if the descriptor is removed.
737 *
738 * Parameters:
739 *
740 * iDescriptor:
741 * the descriptor that should be removed.
742 *
743 * iCollection:
744 * the name of the collection that the descriptor should be
745 * removed from.
746 *
747 * Availability:
748 * Mac OS X: in version 10.3 and later in Carbon.framework
749 * CarbonLib: not available
750 * Non-Carbon CFM: not available
751 }
FCRemoveFontDescriptorFromCollectionnull752 function FCRemoveFontDescriptorFromCollection( iDescriptor: FCFontDescriptorRef; iCollection: CFStringRef ): OSStatus; external name '_FCRemoveFontDescriptorFromCollection';
753 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
754
755
756 {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
757
758 Font Descriptor Attribute Keys
759
760 Font Descriptors contain font attributes that are set and accessed via a set of
761 keys. The keys are all constant CFStringRefs.
762
763 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
764
765 {
766 * kFCFontFamilyAttribute
767 *
768 * Discussion:
769 * The key for a CFStringRef that contains a font family name (e.g.
770 * Baskerville).
771 *
772 * Availability:
773 * Mac OS X: in version 10.3 and later in Carbon.framework
774 * CarbonLib: not available
775 * Non-Carbon CFM: not available
776 }
777 var kFCFontFamilyAttribute: CFStringRef; external name '_kFCFontFamilyAttribute'; (* attribute const *)
778 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
779 {
780 * kFCFontNameAttribute
781 *
782 * Discussion:
783 * The key for a CFStringRef containing a font name (e.g.
784 * Baskerville-Italic).
785 *
786 * Availability:
787 * Mac OS X: in version 10.3 and later in Carbon.framework
788 * CarbonLib: not available
789 * Non-Carbon CFM: not available
790 }
791 var kFCFontNameAttribute: CFStringRef; external name '_kFCFontNameAttribute'; (* attribute const *)
792 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
793 {
794 * kFCFontFaceAttribute
795 *
796 * Discussion:
797 * The key for a CFStringRef containing a face name (e.g. Italic).
798 *
799 * Availability:
800 * Mac OS X: in version 10.3 and later in Carbon.framework
801 * CarbonLib: not available
802 * Non-Carbon CFM: not available
803 }
804 var kFCFontFaceAttribute: CFStringRef; external name '_kFCFontFaceAttribute'; (* attribute const *)
805 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
806 {
807 * kFCFontSizeAttribute
808 *
809 * Discussion:
810 * The key for a CFNumber containg the font size (e.g. 12).
811 *
812 * Availability:
813 * Mac OS X: in version 10.3 and later in Carbon.framework
814 * CarbonLib: not available
815 * Non-Carbon CFM: not available
816 }
817 var kFCFontSizeAttribute: CFStringRef; external name '_kFCFontSizeAttribute'; (* attribute const *)
818 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
819 {
820 * kFCFontVisibleNameAttribute
821 *
822 * Discussion:
823 * The Key for a CFStringRef containing the name that should be used
824 * in a UI to describe the font.
825 *
826 * Availability:
827 * Mac OS X: in version 10.3 and later in Carbon.framework
828 * CarbonLib: not available
829 * Non-Carbon CFM: not available
830 }
831 var kFCFontVisibleNameAttribute: CFStringRef; external name '_kFCFontVisibleNameAttribute'; (* attribute const *)
832 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
833 {
834 * kFCFontCGColorAttribute
835 *
836 * Discussion:
837 * The Key for a CGColorRef containing the fonts color.
838 *
839 * Availability:
840 * Mac OS X: in version 10.3 and later in Carbon.framework
841 * CarbonLib: not available
842 * Non-Carbon CFM: not available
843 }
844 var kFCFontCGColorAttribute: CFStringRef; external name '_kFCFontCGColorAttribute'; (* attribute const *)
845 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
846 {
847 * FCFontDescriptorCreateWithFontAttributes()
848 *
849 * Discussion:
850 * Create a font descriptor using the attributes contained in the
851 * dictionary.
852 *
853 * Parameters:
854 *
855 * iAttributes:
856 * a dictionary containing one or more of the attributes described
857 * above.
858 *
859 * Result:
860 * A valid FCFontDescriptorRef. NULL if one cannot be created.
861 *
862 * Availability:
863 * Mac OS X: in version 10.3 and later in Carbon.framework
864 * CarbonLib: not available
865 * Non-Carbon CFM: not available
866 }
FCFontDescriptorCreateWithFontAttributesnull867 function FCFontDescriptorCreateWithFontAttributes( iAttributes: CFDictionaryRef ): FCFontDescriptorRef; external name '_FCFontDescriptorCreateWithFontAttributes';
868 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
869
870
871 {
872 * FCFontDescriptorCreateWithName()
873 *
874 * Discussion:
875 * Create a font descriptor using a fontname and font size.
876 *
877 * Parameters:
878 *
879 * iFontName:
880 * The name of the font (e.g. Baskerville-Italic).
881 *
882 * iSize:
883 * the size of the font. (e.g. 12.0).
884 *
885 * Result:
886 * A valid FCFontDescriptorRef. NULL if one cannot be created.
887 *
888 * Availability:
889 * Mac OS X: in version 10.3 and later in Carbon.framework
890 * CarbonLib: not available
891 * Non-Carbon CFM: not available
892 }
FCFontDescriptorCreateWithNamenull893 function FCFontDescriptorCreateWithName( iFontName: CFStringRef; iSize: CGFloat ): FCFontDescriptorRef; external name '_FCFontDescriptorCreateWithName';
894 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
895
896
897 {$endc} {TARGET_OS_MAC}
898
899 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
900
901 end.
902 {$endc} {not MACOSALLINCLUDE}
903