-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCoreText.framework.h
More file actions
9290 lines (7485 loc) · 373 KB
/
CoreText.framework.h
File metadata and controls
9290 lines (7485 loc) · 373 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ========== CoreText.framework/Headers/CTRunDelegate.h
/*
* CTRunDelegate.h
* CoreText
*
* Copyright (c) 2006-2018 Apple Inc. All rights reserved.
*
*/
#ifndef __CTRUNDELEGATE__
#define __CTRUNDELEGATE__
#include <CoreText/CTRun.h>
CF_IMPLICIT_BRIDGING_ENABLED
CF_EXTERN_C_BEGIN
CF_ASSUME_NONNULL_BEGIN
/* --------------------------------------------------------------------------- */
/* Run Delegate Types */
/* --------------------------------------------------------------------------- */
typedef const struct CF_BRIDGED_TYPE(id) __CTRunDelegate * CTRunDelegateRef;
/*!
@function CTRunDelegateGetTypeID
@abstract Returns the CFType of CTRunDelegate objects.
*/
CFTypeID CTRunDelegateGetTypeID( void ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/* --------------------------------------------------------------------------- */
/* Run Delegate Callbacks */
/* --------------------------------------------------------------------------- */
/*!
@typedef CTRunDelegateDeallocateCallback
@abstract The callback invoked when a CTRunDelegate is deallocated.
@param refCon
The value supplied to CTRunDelegateCreate.
*/
typedef void (*CTRunDelegateDeallocateCallback) (
void * refCon );
/*!
@typedef CTRunDelegateGetAscentCallback
@abstract The callback used to determine typographic ascent.
@param refCon
The value supplied to CTRunDelegateCreate.
@result A CGFloat value indicating the typographic ascent of glyphs to
which a run delegate pertains.
*/
typedef CGFloat (*CTRunDelegateGetAscentCallback) (
void * refCon );
/*!
@typedef CTRunDelegateGetDescentCallback
@abstract The callback used to determine typographic descent.
@param refCon
The value supplied to CTRunDelegateCreate.
@result A CGFloat value indicating the typographic descent of glyphs to
which a run delegate pertains.
*/
typedef CGFloat (*CTRunDelegateGetDescentCallback) (
void * refCon );
/*!
@typedef CTRunDelegateGetWidthCallback
@abstract The callback used to determine width.
@param refCon
The value supplied to CTRunDelegateCreate.
@result A CGFloat value indicating the width of glyphs to which a run
delegate pertains. A value of 0.0 indicates that the glyphs
should not be drawn.
*/
typedef CGFloat (*CTRunDelegateGetWidthCallback) (
void * refCon );
/*!
@typedef CTRunDelegateCallbacks
@abstract Structure containing the callbacks of a CTRunDelegate.
@discussion These callbacks are provided by the owner of a run delegate and
are used to modify glyph metrics during layout. The values
returned by a delegate are applied to each glyph in the run(s)
corresponding to the attribute containing that delegate.
@field version
The version number of the callbacks being passed in as a
parameter to CTRunDelegateCreate. This field should always
be set to kCTRunDelegateCurrentVersion.
@field dealloc
The callback used when a CTRunDelegate's retain count reaches
0 and the CTRunDelegate is deallocated. This callback may be
NULL.
@field getAscent
The callback used to indicate the ascent of the
CTRunDelegate. This callback may be NULL, which is equivalent
to a getAscent callback that always returns 0.
@field getDescent
The callback used to indicate the descent of the
CTRunDelegate. This callback may be NULL, which is equivalent
to a getDescent callback that always returns 0.
@field getWidth
The callback used to indicate the width of the
CTRunDelegate. This callback may be NULL, which is equivalent
to a getWidth callback that always returns 0.
*/
typedef struct
{
CFIndex version;
CTRunDelegateDeallocateCallback dealloc;
CTRunDelegateGetAscentCallback getAscent;
CTRunDelegateGetDescentCallback getDescent;
CTRunDelegateGetWidthCallback getWidth;
} CTRunDelegateCallbacks;
/* --------------------------------------------------------------------------- */
/* Run Delegate Versions */
/* --------------------------------------------------------------------------- */
/*!
@enum Run Delegate Versions
@discussion Set version field of CTRunDelegateCallbacks to kCTRunDelegateCurrentVersion
when calling CTRunDelegateCreate.
*/
enum {
kCTRunDelegateVersion1 = 1,
kCTRunDelegateCurrentVersion = kCTRunDelegateVersion1
};
/* --------------------------------------------------------------------------- */
/* Run Delegate Creation */
/* --------------------------------------------------------------------------- */
/*!
@function CTRunDelegateCreate
@abstract Creates an immutable instance of a run delegate.
@discussion This function creates an immutable instance of a run delegate
that can be used for reserving space in a line or for eliding the
glyphs for a range of text altogether.
@param callbacks
The callbacks for this run delegate.
@result If run delegate creation was successful, this function will
return a valid reference to an immutable CTRunDelegate
object. Otherwise, this function will return NULL.
*/
CTRunDelegateRef _Nullable CTRunDelegateCreate(
const CTRunDelegateCallbacks* callbacks,
void * _Nullable refCon ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/* --------------------------------------------------------------------------- */
/* Run Delegate Access */
/* --------------------------------------------------------------------------- */
/*!
@function CTRunDelegateGetRefCon
@abstract Returns a run delegate's refCon value.
@discussion This function returns the refCon value that a run delegate was
created with.
@param runDelegate
The run delegate to be queried.
@result The refCon value of the supplied run delegate.
*/
void * CTRunDelegateGetRefCon(
CTRunDelegateRef runDelegate ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
CF_ASSUME_NONNULL_END
CF_EXTERN_C_END
CF_IMPLICIT_BRIDGING_DISABLED
#endif
// ========== CoreText.framework/Headers/CTTextTab.h
/*
* CTTextTab.h
* CoreText
*
* Copyright (c) 2004-2018 Apple Inc. All rights reserved.
*
*/
/*!
@header
Thread Safety Information
All functions in this header are thread safe unless otherwise specified.
*/
#ifndef __CTTEXTTAB__
#define __CTTEXTTAB__
#include <CoreText/CTParagraphStyle.h>
CF_IMPLICIT_BRIDGING_ENABLED
CF_EXTERN_C_BEGIN
CF_ASSUME_NONNULL_BEGIN
/* --------------------------------------------------------------------------- */
/* Text Tab Types */
/* --------------------------------------------------------------------------- */
/* A CTTextTab represents a tab in an CTParagraphStyle object, storing an
alignment type and location.
CoreText supports four alignment types: left, center, right, and decimal.
These alignment types are absolute, not based on the line sweep direction
of text. For example, tabbed text is always positioned to the left of a
right-aligned tab, whether the line sweep direction is left to right or right
to left. A tab's location, on the other hand, is relative to the back margin.
A tab set at 1.5", for example, is at 1.5" from the right in right to left
text.
*/
typedef const struct CF_RELATED_TYPE(NSTextTab,,) __CTTextTab * CTTextTabRef;
/*!
@function CTTypesetterGetTypeID
@abstract Returns the CFType of the text tab object
*/
CFTypeID CTTextTabGetTypeID( void ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/* --------------------------------------------------------------------------- */
/* Text Tab Constants */
/* --------------------------------------------------------------------------- */
/*!
@const kCTTabColumnTerminatorsAttributeName
@abstract Used to specify the terminating character for a tab column
@discussion The value associated with this attribute is a CFCharacterSet. The
character set is used to determine the terminating character for
a tab column. The tab and newline characters are implied even if
they don't exist in the character set. This attribute can be used
to implement decimal tabs, for instance. This attribute is
optional.
*/
CT_EXPORT const CFStringRef kCTTabColumnTerminatorsAttributeName CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/* --------------------------------------------------------------------------- */
/* Text Tab Creation */
/* --------------------------------------------------------------------------- */
/*!
@function CTTextTabCreate
@abstract Creates and initializes a new text tab.
@param alignment
The tab's alignment. This is used to determine the position of
text inside the tab column. This parameter must be set to a valid
CTTextAlignment value or this function will return NULL.
@param location
The tab's ruler location, relative to the back margin.
@param options
Options to pass in when the tab is created. Currently, the only
option available is kCTTabColumnTerminatorsAttributeName. This
parameter is optional and can be set to NULL if not needed.
@result The new CTTextTab.
*/
CTTextTabRef CTTextTabCreate(
CTTextAlignment alignment,
double location,
CFDictionaryRef _Nullable options ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/* --------------------------------------------------------------------------- */
/* Text Tab Access */
/* --------------------------------------------------------------------------- */
/*!
@function CTTextTabGetAlignment
@abstract Returns the text alignment of the tab.
@param tab
The tab whose text alignment you wish to access.
@result The tab's text alignment value.
*/
CTTextAlignment CTTextTabGetAlignment(
CTTextTabRef tab ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@function CTTextTabGetLocation
@abstract Returns the tab's ruler location.
@param tab
The tab whose location you wish to access.
@result The tab's ruler location relative to the back margin.
*/
double CTTextTabGetLocation(
CTTextTabRef tab ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@function CTTextTabGetOptions
@abstract Returns the dictionary of attributes associated with the tab.
@param tab
The tab whose attributes you wish to access.
@result The dictionary of attributes associated with the tab or NULL if
no dictionary is present.
*/
CFDictionaryRef _Nullable CTTextTabGetOptions(
CTTextTabRef tab ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
CF_ASSUME_NONNULL_END
CF_EXTERN_C_END
CF_IMPLICIT_BRIDGING_DISABLED
#endif
// ========== CoreText.framework/Headers/CTFontDescriptor.h
/*
* CTFontDescriptor.h
* CoreText
*
* Copyright (c) 2006-2018 Apple Inc. All rights reserved.
*
*/
/*!
@header
Thread Safety Information
All functions in this header are thread safe unless otherwise specified.
*/
#ifndef __CTFONTDESCRIPTOR__
#define __CTFONTDESCRIPTOR__
#include <CoreText/CTFontTraits.h>
#include <CoreGraphics/CoreGraphics.h>
CF_IMPLICIT_BRIDGING_ENABLED
CF_EXTERN_C_BEGIN
CF_ASSUME_NONNULL_BEGIN
/*! --------------------------------------------------------------------------
@group Descriptor Types
*///--------------------------------------------------------------------------
/*!
@typedef CTFontDescriptorRef
@abstract The Core Text Font Descriptor reference.
@discussion This is a opaque reference to a font descriptor.
*/
#if TARGET_OS_IPHONE
typedef const struct CF_BRIDGED_TYPE(UIFontDescriptor) __CTFontDescriptor * CTFontDescriptorRef;
#else
typedef const struct CF_BRIDGED_TYPE(NSFontDescriptor) __CTFontDescriptor * CTFontDescriptorRef;
#endif
/*!
@function CTFontDescriptorGetTypeID
@abstract Returns the type identifier for Core Text font descriptor
references.
@result The identifier for the opaque type CTFontDescriptorRef.
*/
CFTypeID CTFontDescriptorGetTypeID( void ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*! --------------------------------------------------------------------------
@group Descriptor Constants
*///--------------------------------------------------------------------------
/*!
@defined kCTFontURLAttribute
@abstract The font URL.
@discussion This is the key for accessing the font URL from the font descriptor. The value associated with this key is a CFURLRef.
*/
CT_EXPORT const CFStringRef kCTFontURLAttribute CT_AVAILABLE(macos(10.6), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontNameAttribute
@abstract The PostScript name.
@discussion This is the key for retrieving the PostScript name from the font descriptor. When matching, this is treated more generically: the system first tries to find fonts with this PostScript name. If none is found, the system tries to find fonts with this family name, and, finally, if still nothing, tries to find fonts with this display name. The value associated with this key is a CFStringRef. If unspecified, defaults to "Helvetica", if unavailable falls back to global font cascade list.
*/
CT_EXPORT const CFStringRef kCTFontNameAttribute CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontDisplayNameAttribute
@abstract The display name.
@discussion This is the key for accessing the name used to display the font. Most commonly this is the full name. The value associated with this key is a CFStringRef.
*/
CT_EXPORT const CFStringRef kCTFontDisplayNameAttribute CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontFamilyNameAttribute
@abstract The family name.
@discussion This is the key for accessing the family name from the font descriptor. The value associated with this key is a CFStringRef.
*/
CT_EXPORT const CFStringRef kCTFontFamilyNameAttribute CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontStyleNameAttribute
@abstract The style name.
@discussion This is the key for accessing the style name of the font. This name represents the designer's description of the font's style. The value associated with this key is a CFStringRef.
*/
CT_EXPORT const CFStringRef kCTFontStyleNameAttribute CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontTraitsAttribute
@abstract The font traits dictionary.
@discussion This is the key for accessing the dictionary of font traits for stylistic information. See CTFontTraits.h for the list of font traits. The value associated with this key is a CFDictionaryRef.
*/
CT_EXPORT const CFStringRef kCTFontTraitsAttribute CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontVariationAttribute
@abstract The font variation dictionary.
@discussion This key is used to obtain the font variation instance as a CFDictionaryRef. If specified in a font descriptor, fonts with the specified axes will be primary match candidates, if no such fonts exist, this attribute will be ignored.
*/
CT_EXPORT const CFStringRef kCTFontVariationAttribute CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontSizeAttribute
@abstract The font point size.
@discussion This key is used to obtain or specify the font point size. Creating a font with this unspecified will default to a point size of 12.0. The value for this key is represented as a CFNumberRef.
*/
CT_EXPORT const CFStringRef kCTFontSizeAttribute CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontMatrixAttribute
@abstract The font transformation matrix.
@discussion This key is used to specify the font transformation matrix when creating a font. The default value is CGAffineTransformIdentity. The value for this key is a CFDataRef containing a CGAffineTransform, of which only the a, b, c, and d fields are used.
*/
CT_EXPORT const CFStringRef kCTFontMatrixAttribute CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontCascadeListAttribute
@abstract The font cascade list.
@discussion This key is used to specify or obtain the cascade list used for a font reference. The cascade list is a CFArrayRef containing CTFontDescriptorRefs. If unspecified, the global cascade list is used. This list is not consulted for private-use characters on OS X 10.10, iOS 8, or earlier.
*/
CT_EXPORT const CFStringRef kCTFontCascadeListAttribute CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontCharacterSetAttribute
@abstract The font Unicode character coverage set.
@discussion The value for this key is a CFCharacterSetRef. Creating a font with this attribute will restrict the font to a subset of its actual character set.
*/
CT_EXPORT const CFStringRef kCTFontCharacterSetAttribute CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontLanguagesAttribute
@abstract The list of supported languages.
@discussion The value for this key is a CFArrayRef of CFStringRef language identifiers conforming to UTS #35. It can be requested from any font. If present in a descriptor used for matching, only fonts supporting the specified languages will be returned.
*/
CT_EXPORT const CFStringRef kCTFontLanguagesAttribute CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontBaselineAdjustAttribute
@abstract The baseline adjustment to apply to font metrics.
@discussion The value for this key is a floating-point CFNumberRef. This is primarily used when defining font descriptors for a cascade list to keep the baseline of all fonts even.
*/
CT_EXPORT const CFStringRef kCTFontBaselineAdjustAttribute CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontMacintoshEncodingsAttribute
@abstract The Macintosh encodings (legacy script codes).
@discussion The value associated with this key is a CFNumberRef containing a bitfield of the script codes in <CoreText/SFNTTypes.h>; bit 0 corresponds to kFontRomanScript, and so on. This attribute is provided for legacy compatibility.
*/
CT_EXPORT const CFStringRef kCTFontMacintoshEncodingsAttribute CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontFeaturesAttribute
@abstract The array of font features.
@discussion This key is used to specify or obtain the font features for a font reference. The value associated with this key is a CFArrayRef of font feature dictionaries. This features list contains the feature information from the 'feat' table of the font. See the CTFontCopyFeatures() API in CTFont.h.
*/
CT_EXPORT const CFStringRef kCTFontFeaturesAttribute CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontFeatureSettingsAttribute
@abstract The array of typographic feature settings.
@discussion This key is used to specify an array of zero or more feature settings. Each setting dictionary indicates which setting should be applied. In the case of duplicate or conflicting settings the last setting in the list will take precedence. In the case of AAT settings, it is the caller's responsibility to handle exclusive and non-exclusive settings as necessary.
An AAT setting dictionary contains a tuple of a kCTFontFeatureTypeIdentifierKey key-value pair and a kCTFontFeatureSelectorIdentifierKey key-value pair.
An OpenType setting dictionary contains a tuple of a kCTFontOpenTypeFeatureTag key-value pair and a kCTFontOpenTypeFeatureValue key-value pair.
Starting with OS X 10.10 and iOS 8.0, settings are also accepted (but not returned) in the following simplified forms:
An OpenType setting can be either an array pair of tag string and value number, or a tag string on its own. For example: @[ @"c2sc", @1 ] or simply @"c2sc". An unspecified value enables the feature and a value of zero disables it.
An AAT setting can be specified as an array pair of type and selector numbers. For example: @[ @(kUpperCaseType), @(kUpperCaseSmallCapsSelector) ].
*/
CT_EXPORT const CFStringRef kCTFontFeatureSettingsAttribute CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontFixedAdvanceAttribute
@abstract Specifies advance width.
@discussion This key is used to specify a constant advance width, which affects the glyph metrics of any font instance created with this key; it overrides font values and the font transformation matrix, if any. The value associated with this key must be a CFNumberRef.
Starting with macOS 10.14 and iOS 12.0, this only affects glyph advances that have non-zero width when this attribute is not present.
*/
CT_EXPORT const CFStringRef kCTFontFixedAdvanceAttribute CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontOrientationAttribute
@abstract The orientation attribute.
@discussion This key is used to specify a particular orientation for the glyphs of the font. The value associated with this key is a int as a CFNumberRef. If you want to receive vertical metrics from a font for vertical rendering, specify kCTFontVerticalOrientation. If unspecified, the font will use its native orientation.
*/
CT_EXPORT const CFStringRef kCTFontOrientationAttribute CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@enum CTFontOrientation
@abstract Specifies the intended rendering orientation of the font for obtaining glyph metrics.
*/
typedef CF_ENUM(uint32_t, CTFontOrientation) {
kCTFontOrientationDefault = 0,
kCTFontOrientationHorizontal = 1,
kCTFontOrientationVertical = 2,
kCTFontDefaultOrientation CT_ENUM_DEPRECATED("Deprecated", macos(10.5, 10.11), ios(3.2, 9.0)) CT_ENUM_UNAVAILABLE(watchos, tvos)
= kCTFontOrientationDefault,
kCTFontHorizontalOrientation CT_ENUM_DEPRECATED("Deprecated", macos(10.5, 10.11), ios(3.2, 9.0)) CT_ENUM_UNAVAILABLE(watchos, tvos)
= kCTFontOrientationHorizontal,
kCTFontVerticalOrientation CT_ENUM_DEPRECATED("Deprecated", macos(10.5, 10.11), ios(3.2, 9.0)) CT_ENUM_UNAVAILABLE(watchos, tvos)
= kCTFontOrientationVertical
};
/*!
@defined kCTFontFormatAttribute
@abstract Specifies the recognized format of the font.
@discussion The attribute is used to specify or obtain the format of the font. The returned value is a CFNumber containing one of the constants defined below.
*/
CT_EXPORT const CFStringRef kCTFontFormatAttribute CT_AVAILABLE(macos(10.6), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@constant kCTFontFormatUnrecognized
The font is not a recognized format
@constant kCTFontFormatOpenTypePostScript
The font is an OpenType format containing PostScript data
@constant kCTFontFormatOpenTypeTrueType
The font is an OpenType format containing TrueType data
@constant kCTFontFormatTrueType
The font is a recognized TrueType format
@constant kCTFontFormatPostScript
The font is a recognized PostScript format
@constant kCTFontFormatBitmap
The font is a bitmap only format
*/
typedef CF_ENUM(uint32_t, CTFontFormat) {
kCTFontFormatUnrecognized = 0,
kCTFontFormatOpenTypePostScript = 1,
kCTFontFormatOpenTypeTrueType = 2,
kCTFontFormatTrueType = 3,
kCTFontFormatPostScript = 4,
kCTFontFormatBitmap = 5
};
/*!
@defined kCTFontRegistrationScopeAttribute
@abstract Specifies the font descriptor's registration scope.
@discussion The attribute is used to specify or obtain the font registration scope. The value returned is a CFNumberRef containing one of the CTFontManagerScope enumerated values. A value of NULL can be returned for font descriptors that are not registered.
*/
CT_EXPORT const CFStringRef kCTFontRegistrationScopeAttribute CT_AVAILABLE(macos(10.6), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontPriorityAttribute
@abstract The font descriptors priority when resolving duplicates and sorting match results.
@discussion This key is used to obtain or specify the font priority. The value returned is a CFNumberRef containing an integer value as defined below. The higher the value, the higher the priority of the font. Only registered fonts will have a priority. Unregistered font descriptors will return NULL.
*/
CT_EXPORT const CFStringRef kCTFontPriorityAttribute CT_AVAILABLE(macos(10.6), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@constant kCTFontPrioritySystem
Priority of system fonts (located in /System/Library/Fonts).
@constant kCTFontPriorityNetwork
Priority of network fonts (located in /Network/Library/Fonts).
@constant kCTFontPriorityComputer
Priority of computer local fonts (located in /Library/Fonts).
@constant kCTFontPriorityUser
Priority of local fonts (located in user's Library/Fonts).
@constant kCTFontPriorityDynamic
Priority of fonts registered dynamically, not located in a standard location (either kCTFontManagerScopeUser, or kCTFontManagerScopeSession).
@constant kCTFontPriorityProcess
Priority of fonts registered for the process (kCTFontManagerScopeProcess).
*/
enum {
kCTFontPrioritySystem = 10000,
kCTFontPriorityNetwork = 20000,
kCTFontPriorityComputer = 30000,
kCTFontPriorityUser = 40000,
kCTFontPriorityDynamic = 50000,
kCTFontPriorityProcess = 60000
};
typedef uint32_t CTFontPriority;
/*!
@defined kCTFontEnabledAttribute
@abstract The font enabled state.
@discussion This key is used to obtain the font state. The returned value is a CFNumberRef representing a boolean value. Unregistered font descriptors will return NULL, which is equivalent to false.
*/
CT_EXPORT const CFStringRef kCTFontEnabledAttribute CT_AVAILABLE(macos(10.6), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontDownloadableAttribute
@abstract The font downloadable state.
@discussion The value associated with this key is a CFBoolean. If it is kCFBooleanTrue, CoreText attempts to download a font if necessary when matching a descriptor.
*/
CT_EXPORT const CFStringRef kCTFontDownloadableAttribute CT_AVAILABLE(macos(10.8), ios(6.0), watchos(2.0), tvos(9.0));
/*!
@defined kCTFontDownloadedAttribute
@abstract The download state.
@discussion The value associated with this key is a CFBoolean. If it is kCFBooleanTrue, corresponding FontAsset has been downloaded. (but still it may be necessary to call appropriate API in order to use the font in the FontAsset.)
*/
CT_EXPORT const CFStringRef kCTFontDownloadedAttribute CT_AVAILABLE(macos(10.12), ios(7.0), watchos(2.0), tvos(9.0));
/*! --------------------------------------------------------------------------
@group Descriptor Creation
*///--------------------------------------------------------------------------
/*!
@function CTFontDescriptorCreateWithNameAndSize
@abstract Creates a new font descriptor with the provided PostScript name and size.
@param name
The PostScript name to be used for the font descriptor as a CFStringRef.
@param size
The point size. If 0.0, the kCTFontSizeAttribute will be omitted from the font descriptor.
@result This function creates a new font descriptor reference with the given PostScript name and point size.
*/
CTFontDescriptorRef CTFontDescriptorCreateWithNameAndSize(
CFStringRef name,
CGFloat size ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@function CTFontDescriptorCreateWithAttributes
@abstract Creates a new font descriptor reference from a dictionary of attributes.
@param attributes
A CFDictionaryRef of arbitrary attributes.
@result This function creates a new font descriptor with the attributes specified. This dictionary can contain arbitrary attributes that will be preserved, however unrecognized attributes will be ignored on font creation and and may not be preserved over the round trip (descriptor -> font -> descriptor).
*/
CTFontDescriptorRef CTFontDescriptorCreateWithAttributes(
CFDictionaryRef attributes ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@function CTFontDescriptorCreateCopyWithAttributes
@abstract Creates a copy of the original font descriptor with new attributes.
@param original
The original font descriptor reference.
@param attributes
A CFDictionaryRef of arbitrary attributes.
@result This function creates a new copy of the original font descriptor with attributes augmented by those specified. If there are conflicts between attributes, the new attributes will replace existing ones, except for kCTFontVariationAttribute and kCTFontFeatureSettingsAttribute which will be merged.
Starting with macOS 10.12 and iOS 10.0, setting the value of kCTFontFeatureSettingsAttribute to kCFNull will clear the feature settings of the original font descriptor. Setting the value of any individual feature settings pair in the kCTFontFeatureSettingsAttribute value array to kCFNull will clear that feature setting alone. For example, an element like @{ (id)kCTFontFeatureTypeIdentifierKey: @(kLigaturesType), (id)kCTFontFeatureSelectorIdentifierKey: (id)kCFNull } means clear the kLigatureType feature set in the original font descriptor. An element like @[ @"liga", (id)kCFNull ] will have the same effect.
*/
CTFontDescriptorRef CTFontDescriptorCreateCopyWithAttributes(
CTFontDescriptorRef original,
CFDictionaryRef attributes ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@function CTFontCreateCopyWithFamily
@abstract Returns a new font descriptor in the specified family based on the traits of the original descriptor.
@param original
The original font descriptor reference.
@param family
The name of the desired family.
@result Returns a new font reference with the original traits in the given family, or NULL if none found in the system.
*/
CTFontDescriptorRef _Nullable CTFontDescriptorCreateCopyWithFamily(
CTFontDescriptorRef original,
CFStringRef family ) CT_AVAILABLE(macos(10.9), ios(7.0), watchos(2.0), tvos(9.0));
/*!
@function CTFontDescriptorCreateCopyWithSymbolicTraits
@abstract Returns a new font descriptor based on the original descriptor having the specified symbolic traits.
@param original
The original font descriptor reference.
@param symTraitValue
The value of the symbolic traits. This bitfield is used to indicate the desired value for the traits specified by the symTraitMask parameter. Used in conjunction, they can allow for trait removal as well as addition.
@param symTraitMask
The mask bits of the symbolic traits. This bitfield is used to indicate the traits that should be changed.
@result Returns a new font descriptor reference in the same family with the given symbolic traits, or NULL if none found in the system.
*/
CTFontDescriptorRef _Nullable CTFontDescriptorCreateCopyWithSymbolicTraits(
CTFontDescriptorRef original,
CTFontSymbolicTraits symTraitValue,
CTFontSymbolicTraits symTraitMask ) CT_AVAILABLE(macos(10.9), ios(7.0), watchos(2.0), tvos(9.0));
/*!
@function CTFontDescriptorCreateCopyWithVariation
@abstract Creates a copy of the original font descriptor with a new variation instance.
@param original
The original font descriptor reference.
@param variationIdentifier
The variation axis identifier. This is the four character code of the variation axis as a CFNumberRef.
@param variationValue
The value corresponding with the variation instance.
@result This function returns a copy of the original font descriptor with a new variation instance. This is a convenience method for easily creating new variation font instances.
*/
CTFontDescriptorRef CTFontDescriptorCreateCopyWithVariation(
CTFontDescriptorRef original,
CFNumberRef variationIdentifier,
CGFloat variationValue ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@function CTFontDescriptorCreateCopyWithFeature
@abstract Copies a font descriptor with new feature setting.
@discussion This is a convenience method to more easily toggle the state of individual features.
@param original
The original font descriptor reference.
@param featureTypeIdentifier
The feature type identifier.
@param featureSelectorIdentifier
The feature selector identifier.
@result A copy of the original font descriptor modified with the given feature settings.
*/
CTFontDescriptorRef CTFontDescriptorCreateCopyWithFeature(
CTFontDescriptorRef original,
CFNumberRef featureTypeIdentifier,
CFNumberRef featureSelectorIdentifier ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@function CTFontDescriptorCreateMatchingFontDescriptors
@abstract Returns an array of font normalized font descriptors matching the provided descriptor.
@param descriptor
The font descriptor reference.
@param mandatoryAttributes
A set of attribute keys which are required to be identically matched in any returned font descriptors. Optional.
@result This function returns a retained array of normalized font descriptors matching the attributes present in descriptor. If descriptor itself is normalized then the array will contain only one item, the original descriptor.
*/
CFArrayRef _Nullable CTFontDescriptorCreateMatchingFontDescriptors(
CTFontDescriptorRef descriptor,
CFSetRef _Nullable mandatoryAttributes ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@function CTFontDescriptorCreateMatchingFontDescriptor
@abstract Returns an the single preferred matching font descriptor based on the original descriptor and system precedence.
@param descriptor
The font descriptor reference.
@param mandatoryAttributes
A set of attribute keys which are required to be identically matched in any returned font descriptors. Optional.
@result This function returns a retained normalized font descriptor matching the attributes present in descriptor. The original descriptor may be returned in normalized form.
*/
CTFontDescriptorRef _Nullable CTFontDescriptorCreateMatchingFontDescriptor(
CTFontDescriptorRef descriptor,
CFSetRef _Nullable mandatoryAttributes ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
Progress state
*/
typedef CF_ENUM(uint32_t, CTFontDescriptorMatchingState) {
kCTFontDescriptorMatchingDidBegin, // called once at the beginning.
kCTFontDescriptorMatchingDidFinish, // called once at the end.
kCTFontDescriptorMatchingWillBeginQuerying, // called once before talking to the server. Skipped if not necessary.
kCTFontDescriptorMatchingStalled, // called when stalled. (e.g. while waiting for server response.)
// Downloading and activating are repeated for each descriptor.
kCTFontDescriptorMatchingWillBeginDownloading, // Downloading part may be skipped if all the assets are already downloaded
kCTFontDescriptorMatchingDownloading,
kCTFontDescriptorMatchingDidFinishDownloading,
kCTFontDescriptorMatchingDidMatch, // called when font descriptor is matched.
kCTFontDescriptorMatchingDidFailWithError // called when an error occurred. (may be called multiple times.)
};
/*!
keys for progressParameter dictionary.
*/
/* CTFontDescriptorRef; The current font descriptor. Valid when state is kCTFontDescriptorMatchingDidMatch. */
CT_EXPORT const CFStringRef kCTFontDescriptorMatchingSourceDescriptor CT_AVAILABLE(macos(10.8), ios(6.0), watchos(2.0), tvos(9.0));
/* CFArray; Array of descriptors to be queried. Valid while downloading or when state is kCTFontDescriptorMatchingWillBeginQuerying. */
CT_EXPORT const CFStringRef kCTFontDescriptorMatchingDescriptors CT_AVAILABLE(macos(10.8), ios(6.0), watchos(2.0), tvos(9.0));
/* CFArray; Array of matched font descriptors. Valid when state is kCTFontDescriptorMatchingDidMatch or CTFontDescriptorMatchingEnd. */
CT_EXPORT const CFStringRef kCTFontDescriptorMatchingResult CT_AVAILABLE(macos(10.8), ios(6.0), watchos(2.0), tvos(9.0));
/* CFNumber; Download progress in 0 - 100. Valid during Downloading state. */
CT_EXPORT const CFStringRef kCTFontDescriptorMatchingPercentage CT_AVAILABLE(macos(10.8), ios(6.0), watchos(2.0), tvos(9.0));
/* CFNumber; Byte size to download for the current descriptor. Valid during Downloading state. */
CT_EXPORT const CFStringRef kCTFontDescriptorMatchingCurrentAssetSize CT_AVAILABLE(macos(10.8), ios(6.0), watchos(2.0), tvos(9.0));
/* CFNumber; Total downloaded byte size. Valid during Downloading state. */
CT_EXPORT const CFStringRef kCTFontDescriptorMatchingTotalDownloadedSize CT_AVAILABLE(macos(10.8), ios(6.0), watchos(2.0), tvos(9.0));
/* CFNumber; Total byte size to download. Always valid, but may be Zero when information is not available. */
CT_EXPORT const CFStringRef kCTFontDescriptorMatchingTotalAssetSize CT_AVAILABLE(macos(10.8), ios(6.0), watchos(2.0), tvos(9.0));
/* CFError; Valid when state kCTFontDescriptorMatchingDidFailWithError. */
CT_EXPORT const CFStringRef kCTFontDescriptorMatchingError CT_AVAILABLE(macos(10.8), ios(6.0), watchos(2.0), tvos(9.0));
#if defined(__BLOCKS__)
/* Progress callback type */
typedef bool (^CTFontDescriptorProgressHandler)(CTFontDescriptorMatchingState state, CFDictionaryRef progressParameter);
/*
@function CTFontDescriptorMatchFontDescriptorsWithProgressHandler
This function returns immediately, but can potentially take long time to process. The progress is notified via progressBlock.
@param descriptors
An array of descriptors to process.
@param mandatoryAttributes
@param progressBlock
Callback block to indicate the progress.
Return true to continue, and return false to cancel the process.
This block is called on a private serial queue on OS X 10.15, iOS 13, and later.
@result false if it couldn't start the work.
*/
bool CTFontDescriptorMatchFontDescriptorsWithProgressHandler(
CFArrayRef descriptors,
CFSetRef _Nullable mandatoryAttributes,
CTFontDescriptorProgressHandler progressBlock) CT_AVAILABLE(macos(10.9), ios(6.0), watchos(2.0), tvos(9.0));
#endif // defined(__BLOCKS__)
/*! --------------------------------------------------------------------------
@group Descriptor Accessors
*///--------------------------------------------------------------------------
/*!
@function CTFontDescriptorCopyAttributes
@abstract Returns the attributes dictionary of the font descriptor.
@param descriptor
The font descriptor reference.
@result A retained reference to the font descriptor attributes dictionary. This dictionary will contain the minimum number of attributes to fully specify this particular font descriptor.
*/
CFDictionaryRef CTFontDescriptorCopyAttributes(
CTFontDescriptorRef descriptor ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
@function CTFontDescriptorCopyAttribute
@abstract Returns the value associated with an arbitrary attribute.
@param descriptor
The font descriptor.
@param attribute
The requested attribute.
@result A retained reference to the requested attribute, or NULL if the requested attribute is not present. Refer to the attribute definitions for documentation as to how each attribute is packaged as a CFType.
*/
CFTypeRef _Nullable CTFontDescriptorCopyAttribute(
CTFontDescriptorRef descriptor,
CFStringRef attribute ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
/*!
function CTFontDescriptorCopyLocalizedAttribute
@abstract Returns a localized value for the requested attribute if available.
@discussion This function returns a localized attribute based on the global language list. If localization is not possible for the attribute the behavior matches CTFontDescriptorCopyAttribute(). Generally, localization of attributes is only applicable to name attributes of a normalized font descriptor.
@param descriptor
The font descriptor reference.
@param attribute
The requested font attribute.
@param language
If non-NULL, this will be receive a retained reference to the matched language. The language identifier will conform to UTS #35.
If CoreText can supply its own localized string where the font cannot, this value will be NULL.
@result A retained reference to the requested attribute, or NULL if the requested attribute is not present. Refer to the attribute definitions for documentation as to how each attribute is packaged as a CFType.
*/
CFTypeRef _Nullable CTFontDescriptorCopyLocalizedAttribute(
CTFontDescriptorRef descriptor,
CFStringRef attribute,
CFStringRef _Nullable * _Nullable language ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
CF_ASSUME_NONNULL_END
CF_EXTERN_C_END
CF_IMPLICIT_BRIDGING_DISABLED
#endif
// ========== CoreText.framework/Headers/SFNTTypes.h
/*
* SFNTTypes.h
* CoreText
*
* Copyright 1994-2013 Apple Inc. All rights reserved.
*
*/
#ifndef __SFNTTYPES__
#define __SFNTTYPES__
#if !0
#include <MacTypes.h>
#elif !defined(__MACTYPES__)
typedef SInt32 Fixed;
#endif
#ifdef __cplusplus
extern "C" {
#endif
#pragma pack(push, 2)
struct sfntDirectoryEntry {
FourCharCode tableTag;
UInt32 checkSum;
UInt32 offset;
UInt32 length;
};
typedef struct sfntDirectoryEntry sfntDirectoryEntry;
/* The search fields limits numOffsets to 4096. */
struct sfntDirectory {
FourCharCode format;
UInt16 numOffsets; /* number of tables */
UInt16 searchRange; /* (max2 <= numOffsets)*16 */
UInt16 entrySelector; /* log2(max2 <= numOffsets) */
UInt16 rangeShift; /* numOffsets*16-searchRange*/
sfntDirectoryEntry table[1]; /* table[numOffsets] */
};
typedef struct sfntDirectory sfntDirectory;
enum {
sizeof_sfntDirectory = 12
};
/* Cmap - character id to glyph id mapping */
enum {
cmapFontTableTag = 'cmap'
};
enum {
kFontUnicodePlatform = 0,
kFontMacintoshPlatform = 1,
kFontReservedPlatform = 2,
kFontMicrosoftPlatform = 3,
kFontCustomPlatform = 4
};
enum {
kFontUnicodeDefaultSemantics = 0,
kFontUnicodeV1_1Semantics = 1,
kFontISO10646_1993Semantics = 2,
kFontUnicodeV2_0BMPOnlySemantics = 3,
kFontUnicodeV2_0FullCoverageSemantics = 4,
kFontUnicodeV4_0VariationSequenceSemantics = 5,
kFontUnicode_FullRepertoire = 6
};
enum {
kFontRomanScript = 0,
kFontJapaneseScript = 1,
kFontTraditionalChineseScript = 2,