objc2-core-text 0.3.2

Bindings to the CoreText framework
Documentation
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::cell::UnsafeCell;
use core::ffi::*;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/coretext/ctfont?language=objc)
///
/// This is toll-free bridged with `NSFont`.
#[doc(alias = "CTFontRef")]
#[repr(C)]
pub struct CTFont {
    inner: [u8; 0],
    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}

cf_type!(
    unsafe impl CTFont {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
    unsafe impl RefEncode<"__CTFont"> for CTFont {}
);

unsafe impl ConcreteType for CTFont {
    /// Returns the type identifier for Core Text font references.
    ///
    /// Returns: The identifier for the opaque type CTFontRef.
    #[doc(alias = "CTFontGetTypeID")]
    #[inline]
    fn type_id() -> CFTypeID {
        extern "C-unwind" {
            fn CTFontGetTypeID() -> CFTypeID;
        }
        unsafe { CTFontGetTypeID() }
    }
}

extern "C" {
    /// kCTFontCopyrightNameKey
    ///
    /// The name specifier for the copyright name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontcopyrightnamekey?language=objc)
    pub static kCTFontCopyrightNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontFamilyNameKey
    ///
    /// The name specifier for the family name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfamilynamekey?language=objc)
    pub static kCTFontFamilyNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontSubFamilyNameKey
    ///
    /// The name specifier for the subfamily name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontsubfamilynamekey?language=objc)
    pub static kCTFontSubFamilyNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontStyleNameKey
    ///
    /// The name specifier for the style name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontstylenamekey?language=objc)
    pub static kCTFontStyleNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontUniqueNameKey
    ///
    /// The name specifier for the unique name.
    ///
    /// Note that this name is often not unique and should not be
    /// assumed to be truly unique.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontuniquenamekey?language=objc)
    pub static kCTFontUniqueNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontFullNameKey
    ///
    /// The name specifier for the full name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfullnamekey?language=objc)
    pub static kCTFontFullNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontVersionNameKey
    ///
    /// The name specifier for the version name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontversionnamekey?language=objc)
    pub static kCTFontVersionNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontPostScriptNameKey
    ///
    /// The name specifier for the PostScript name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontpostscriptnamekey?language=objc)
    pub static kCTFontPostScriptNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontTrademarkNameKey
    ///
    /// The name specifier for the trademark name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttrademarknamekey?language=objc)
    pub static kCTFontTrademarkNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontManufacturerNameKey
    ///
    /// The name specifier for the manufacturer name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontmanufacturernamekey?language=objc)
    pub static kCTFontManufacturerNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontDesignerNameKey
    ///
    /// The name specifier for the designer name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontdesignernamekey?language=objc)
    pub static kCTFontDesignerNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontDescriptionNameKey
    ///
    /// The name specifier for the description name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontdescriptionnamekey?language=objc)
    pub static kCTFontDescriptionNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontVendorURLNameKey
    ///
    /// The name specifier for the vendor url name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontvendorurlnamekey?language=objc)
    pub static kCTFontVendorURLNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontDesignerURLNameKey
    ///
    /// The name specifier for the designer url name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontdesignerurlnamekey?language=objc)
    pub static kCTFontDesignerURLNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontLicenseNameKey
    ///
    /// The name specifier for the license name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontlicensenamekey?language=objc)
    pub static kCTFontLicenseNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontLicenseURLNameKey
    ///
    /// The name specifier for the license url name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontlicenseurlnamekey?language=objc)
    pub static kCTFontLicenseURLNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontSampleTextNameKey
    ///
    /// The name specifier for the sample text name string.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontsampletextnamekey?language=objc)
    pub static kCTFontSampleTextNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontPostScriptCIDNameKey
    ///
    /// The name specifier for the PostScript CID name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontpostscriptcidnamekey?language=objc)
    pub static kCTFontPostScriptCIDNameKey: &'static CFString;
}

impl CTFont {
    /// Returns a new font reference for the given name.
    ///
    ///
    /// This function uses font descriptor matching so only registered fonts can be returned; see CTFontManager.h for more information. If you are trying to create a system UI font (with name beginning with a "."), you should use CTFontCreateUIFontForLanguage() or appropriate AppKit/UIKit APIs instead.
    ///
    ///
    /// Parameter `name`: The font name for which you wish to create a new font reference. A valid PostScript name is preferred, although other font name types will be matched in a fallback manner. Any font name beginning with a "." is reserved for the system and should not be used here.
    ///
    ///
    /// Parameter `size`: The point size for the font reference. If 0.0 is specified, the default font size of 12.0 will be used.
    ///
    ///
    /// Parameter `matrix`: The transformation matrix for the font. If unspecified, the identity matrix will be used. Optional.
    ///
    ///
    /// Returns: This function will return a CTFontRef that best matches the name provided with size and matrix attributes. The name parameter is the only required parameters, and default values will be used for unspecified parameters. A best match will be found if all parameters cannot be matched identically.
    ///
    /// # Safety
    ///
    /// `matrix` must be a valid pointer or null.
    #[doc(alias = "CTFontCreateWithName")]
    #[inline]
    pub unsafe fn with_name(
        name: &CFString,
        size: CGFloat,
        matrix: *const CGAffineTransform,
    ) -> CFRetained<CTFont> {
        extern "C-unwind" {
            fn CTFontCreateWithName(
                name: &CFString,
                size: CGFloat,
                matrix: *const CGAffineTransform,
            ) -> Option<NonNull<CTFont>>;
        }
        let ret = unsafe { CTFontCreateWithName(name, size, matrix) };
        let ret =
            ret.expect("function was marked as returning non-null, but actually returned NULL");
        unsafe { CFRetained::from_raw(ret) }
    }

    /// Returns a new font reference that best matches the font descriptor.
    ///
    ///
    /// Parameter `descriptor`: A font descriptor containing attributes that specify the requested font.
    ///
    ///
    /// Parameter `size`: The point size for the font reference. If 0.0 is specified and the font descriptor does not specify the size, the default font size of 12.0 will be used.
    ///
    ///
    /// Parameter `matrix`: The transformation matrix for the font. If unspecified, the identity matrix will be used. Optional.
    ///
    ///
    /// Returns: This function will return a CTFontRef that best matches the attributes provided with the font descriptor. The size and matrix parameters will override any specified in the font descriptor, unless they are unspecified. A best match font will always be returned, and default values will be used for any unspecified.
    ///
    /// # Safety
    ///
    /// `matrix` must be a valid pointer or null.
    #[doc(alias = "CTFontCreateWithFontDescriptor")]
    #[cfg(feature = "CTFontDescriptor")]
    #[inline]
    pub unsafe fn with_font_descriptor(
        descriptor: &CTFontDescriptor,
        size: CGFloat,
        matrix: *const CGAffineTransform,
    ) -> CFRetained<CTFont> {
        extern "C-unwind" {
            fn CTFontCreateWithFontDescriptor(
                descriptor: &CTFontDescriptor,
                size: CGFloat,
                matrix: *const CGAffineTransform,
            ) -> Option<NonNull<CTFont>>;
        }
        let ret = unsafe { CTFontCreateWithFontDescriptor(descriptor, size, matrix) };
        let ret =
            ret.expect("function was marked as returning non-null, but actually returned NULL");
        unsafe { CFRetained::from_raw(ret) }
    }
}

/// Options for descriptor match and font creation.
///
/// Prevents automatic font activation from taking place.
/// This option is available only on macOS and will be deprecated on other platforms in the future.
///
/// Prevents automatic font download from taking place.
///
/// Font matching will prefer to match Apple system fonts.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/ctfontoptions?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CTFontOptions(pub CFOptionFlags);
bitflags::bitflags! {
    impl CTFontOptions: CFOptionFlags {
        #[doc(alias = "kCTFontOptionsDefault")]
        const Default = 0;
        #[doc(alias = "kCTFontOptionsPreventAutoActivation")]
        const PreventAutoActivation = 1<<0;
        #[doc(alias = "kCTFontOptionsPreventAutoDownload")]
        const PreventAutoDownload = 1<<1;
        #[doc(alias = "kCTFontOptionsPreferSystemFont")]
        const PreferSystemFont = 1<<2;
    }
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CTFontOptions {
    const ENCODING: Encoding = CFOptionFlags::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CTFontOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

impl CTFont {
    /// Returns a new font reference for the given name.
    ///
    ///
    /// This function uses font descriptor matching so only registered fonts can be returned; see CTFontManager.h for more information. If you are trying to create a system UI font (with name beginning with a "."), you should use CTFontCreateUIFontForLanguage() or appropriate AppKit/UIKit APIs instead.
    ///
    ///
    /// Parameter `name`: The font name for which you wish to create a new font reference. A valid PostScript name is preferred, although other font name types will be matched in a fallback manner. Any font name beginning with a "." is reserved for the system and should not be used here.
    ///
    ///
    /// Parameter `size`: The point size for the font reference. If 0.0 is specified, the default font size of 12.0 will be used.
    ///
    ///
    /// Parameter `matrix`: The transformation matrix for the font. If unspecified, the identity matrix will be used. Optional.
    ///
    ///
    /// Parameter `options`: Options flags.
    ///
    ///
    /// Returns: This function will return a CTFontRef that best matches the name provided with size and matrix attributes. The name parameter is the only required parameters, and default values will be used for unspecified parameters. A best match will be found if all parameters cannot be matched identically.
    ///
    /// # Safety
    ///
    /// `matrix` must be a valid pointer or null.
    #[doc(alias = "CTFontCreateWithNameAndOptions")]
    #[inline]
    pub unsafe fn with_name_and_options(
        name: &CFString,
        size: CGFloat,
        matrix: *const CGAffineTransform,
        options: CTFontOptions,
    ) -> CFRetained<CTFont> {
        extern "C-unwind" {
            fn CTFontCreateWithNameAndOptions(
                name: &CFString,
                size: CGFloat,
                matrix: *const CGAffineTransform,
                options: CTFontOptions,
            ) -> Option<NonNull<CTFont>>;
        }
        let ret = unsafe { CTFontCreateWithNameAndOptions(name, size, matrix, options) };
        let ret =
            ret.expect("function was marked as returning non-null, but actually returned NULL");
        unsafe { CFRetained::from_raw(ret) }
    }

    /// Returns a new font reference that best matches the font descriptor.
    ///
    ///
    /// Parameter `descriptor`: A font descriptor containing attributes that specify the requested font.
    ///
    ///
    /// Parameter `size`: The point size for the font reference. If 0.0 is specified, the default font size of 12.0 will be used.
    ///
    ///
    /// Parameter `matrix`: The transformation matrix for the font. If unspecified, the identity matrix will be used. Optional.
    ///
    ///
    /// Parameter `options`: Options flags.
    ///
    ///
    /// Returns: This function will return a CTFontRef that best matches the attributes provided with the font descriptor. The size and matrix parameters will override any specified in the font descriptor, unless they are unspecified. A best match font will always be returned, and default values will be used for any unspecified.
    ///
    /// # Safety
    ///
    /// `matrix` must be a valid pointer or null.
    #[doc(alias = "CTFontCreateWithFontDescriptorAndOptions")]
    #[cfg(feature = "CTFontDescriptor")]
    #[inline]
    pub unsafe fn with_font_descriptor_and_options(
        descriptor: &CTFontDescriptor,
        size: CGFloat,
        matrix: *const CGAffineTransform,
        options: CTFontOptions,
    ) -> CFRetained<CTFont> {
        extern "C-unwind" {
            fn CTFontCreateWithFontDescriptorAndOptions(
                descriptor: &CTFontDescriptor,
                size: CGFloat,
                matrix: *const CGAffineTransform,
                options: CTFontOptions,
            ) -> Option<NonNull<CTFont>>;
        }
        let ret =
            unsafe { CTFontCreateWithFontDescriptorAndOptions(descriptor, size, matrix, options) };
        let ret =
            ret.expect("function was marked as returning non-null, but actually returned NULL");
        unsafe { CFRetained::from_raw(ret) }
    }
}

/// These constants represent the specific user interface purpose to specify for font creation.
///
/// Use these constants with CTFontCreateUIFontForLanguage to indicate the intended user interface usage of the font reference to be created.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/ctfontuifonttype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CTFontUIFontType(pub u32);
impl CTFontUIFontType {
    #[doc(alias = "kCTFontUIFontNone")]
    pub const None: Self = Self(4294967295);
    #[doc(alias = "kCTFontUIFontUser")]
    pub const User: Self = Self(0);
    #[doc(alias = "kCTFontUIFontUserFixedPitch")]
    pub const UserFixedPitch: Self = Self(1);
    #[doc(alias = "kCTFontUIFontSystem")]
    pub const System: Self = Self(2);
    #[doc(alias = "kCTFontUIFontEmphasizedSystem")]
    pub const EmphasizedSystem: Self = Self(3);
    #[doc(alias = "kCTFontUIFontSmallSystem")]
    pub const SmallSystem: Self = Self(4);
    #[doc(alias = "kCTFontUIFontSmallEmphasizedSystem")]
    pub const SmallEmphasizedSystem: Self = Self(5);
    #[doc(alias = "kCTFontUIFontMiniSystem")]
    pub const MiniSystem: Self = Self(6);
    #[doc(alias = "kCTFontUIFontMiniEmphasizedSystem")]
    pub const MiniEmphasizedSystem: Self = Self(7);
    #[doc(alias = "kCTFontUIFontViews")]
    pub const Views: Self = Self(8);
    #[doc(alias = "kCTFontUIFontApplication")]
    pub const Application: Self = Self(9);
    #[doc(alias = "kCTFontUIFontLabel")]
    pub const Label: Self = Self(10);
    #[doc(alias = "kCTFontUIFontMenuTitle")]
    pub const MenuTitle: Self = Self(11);
    #[doc(alias = "kCTFontUIFontMenuItem")]
    pub const MenuItem: Self = Self(12);
    #[doc(alias = "kCTFontUIFontMenuItemMark")]
    pub const MenuItemMark: Self = Self(13);
    #[doc(alias = "kCTFontUIFontMenuItemCmdKey")]
    pub const MenuItemCmdKey: Self = Self(14);
    #[doc(alias = "kCTFontUIFontWindowTitle")]
    pub const WindowTitle: Self = Self(15);
    #[doc(alias = "kCTFontUIFontPushButton")]
    pub const PushButton: Self = Self(16);
    #[doc(alias = "kCTFontUIFontUtilityWindowTitle")]
    pub const UtilityWindowTitle: Self = Self(17);
    #[doc(alias = "kCTFontUIFontAlertHeader")]
    pub const AlertHeader: Self = Self(18);
    #[doc(alias = "kCTFontUIFontSystemDetail")]
    pub const SystemDetail: Self = Self(19);
    #[doc(alias = "kCTFontUIFontEmphasizedSystemDetail")]
    pub const EmphasizedSystemDetail: Self = Self(20);
    #[doc(alias = "kCTFontUIFontToolbar")]
    pub const Toolbar: Self = Self(21);
    #[doc(alias = "kCTFontUIFontSmallToolbar")]
    pub const SmallToolbar: Self = Self(22);
    #[doc(alias = "kCTFontUIFontMessage")]
    pub const Message: Self = Self(23);
    #[doc(alias = "kCTFontUIFontPalette")]
    pub const Palette: Self = Self(24);
    #[doc(alias = "kCTFontUIFontToolTip")]
    pub const ToolTip: Self = Self(25);
    #[doc(alias = "kCTFontUIFontControlContent")]
    pub const ControlContent: Self = Self(26);
    #[deprecated = "Deprecated"]
    pub const kCTFontNoFontType: Self = Self(CTFontUIFontType::None.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontUserFontType: Self = Self(CTFontUIFontType::User.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontUserFixedPitchFontType: Self = Self(CTFontUIFontType::UserFixedPitch.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontSystemFontType: Self = Self(CTFontUIFontType::System.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontEmphasizedSystemFontType: Self = Self(CTFontUIFontType::EmphasizedSystem.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontSmallSystemFontType: Self = Self(CTFontUIFontType::SmallSystem.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontSmallEmphasizedSystemFontType: Self =
        Self(CTFontUIFontType::SmallEmphasizedSystem.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontMiniSystemFontType: Self = Self(CTFontUIFontType::MiniSystem.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontMiniEmphasizedSystemFontType: Self =
        Self(CTFontUIFontType::MiniEmphasizedSystem.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontViewsFontType: Self = Self(CTFontUIFontType::Views.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontApplicationFontType: Self = Self(CTFontUIFontType::Application.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontLabelFontType: Self = Self(CTFontUIFontType::Label.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontMenuTitleFontType: Self = Self(CTFontUIFontType::MenuTitle.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontMenuItemFontType: Self = Self(CTFontUIFontType::MenuItem.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontMenuItemMarkFontType: Self = Self(CTFontUIFontType::MenuItemMark.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontMenuItemCmdKeyFontType: Self = Self(CTFontUIFontType::MenuItemCmdKey.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontWindowTitleFontType: Self = Self(CTFontUIFontType::WindowTitle.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontPushButtonFontType: Self = Self(CTFontUIFontType::PushButton.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontUtilityWindowTitleFontType: Self =
        Self(CTFontUIFontType::UtilityWindowTitle.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontAlertHeaderFontType: Self = Self(CTFontUIFontType::AlertHeader.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontSystemDetailFontType: Self = Self(CTFontUIFontType::SystemDetail.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontEmphasizedSystemDetailFontType: Self =
        Self(CTFontUIFontType::EmphasizedSystemDetail.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontToolbarFontType: Self = Self(CTFontUIFontType::Toolbar.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontSmallToolbarFontType: Self = Self(CTFontUIFontType::SmallToolbar.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontMessageFontType: Self = Self(CTFontUIFontType::Message.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontPaletteFontType: Self = Self(CTFontUIFontType::Palette.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontToolTipFontType: Self = Self(CTFontUIFontType::ToolTip.0);
    #[deprecated = "Deprecated"]
    pub const kCTFontControlContentFontType: Self = Self(CTFontUIFontType::ControlContent.0);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CTFontUIFontType {
    const ENCODING: Encoding = u32::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CTFontUIFontType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

impl CTFont {
    /// Returns the special UI font for the given language and UI type.
    ///
    ///
    /// Parameter `uiType`: A uiType constant specifying the intended UI use for the requested font reference.
    ///
    ///
    /// Parameter `size`: The point size for the font reference. If 0.0 is specified, the default size for the requested uiType is used.
    ///
    ///
    /// Parameter `language`: Language identifier to select a font for a particular localization. If unspecified, the current system language is used. The format of the language identifier should conform to UTS #35.
    ///
    ///
    /// Returns: This function returns the correct font for various UI uses. The only required parameter is the uiType selector, unspecified optional parameters will use default values.
    #[doc(alias = "CTFontCreateUIFontForLanguage")]
    #[inline]
    pub unsafe fn new_ui_font_for_language(
        ui_type: CTFontUIFontType,
        size: CGFloat,
        language: Option<&CFString>,
    ) -> Option<CFRetained<CTFont>> {
        extern "C-unwind" {
            fn CTFontCreateUIFontForLanguage(
                ui_type: CTFontUIFontType,
                size: CGFloat,
                language: Option<&CFString>,
            ) -> Option<NonNull<CTFont>>;
        }
        let ret = unsafe { CTFontCreateUIFontForLanguage(ui_type, size, language) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// Returns a new font with additional attributes based on the original font.
    ///
    ///
    /// This function provides a mechanism to quickly change attributes on a given font reference in response to user actions. For instance, the size can be changed in response to a user manipulating a size slider.
    ///
    ///
    /// Parameter `font`: Original font reference to base new font on.
    ///
    ///
    /// Parameter `size`: The point size for the font reference. If 0.0 is specified, the original font's size will be preserved.
    ///
    ///
    /// Parameter `matrix`: The transformation matrix for the font. If unspecified, the original font matrix will be preserved. Optional.
    ///
    ///
    /// Parameter `attributes`: A font descriptor containing additional attributes that the new font should contain.
    ///
    ///
    /// Returns: Returns a new font reference converted from the original with the specified attributes.
    ///
    /// # Safety
    ///
    /// `matrix` must be a valid pointer or null.
    #[doc(alias = "CTFontCreateCopyWithAttributes")]
    #[cfg(feature = "CTFontDescriptor")]
    #[inline]
    pub unsafe fn copy_with_attributes(
        &self,
        size: CGFloat,
        matrix: *const CGAffineTransform,
        attributes: Option<&CTFontDescriptor>,
    ) -> CFRetained<CTFont> {
        extern "C-unwind" {
            fn CTFontCreateCopyWithAttributes(
                font: &CTFont,
                size: CGFloat,
                matrix: *const CGAffineTransform,
                attributes: Option<&CTFontDescriptor>,
            ) -> Option<NonNull<CTFont>>;
        }
        let ret = unsafe { CTFontCreateCopyWithAttributes(self, size, matrix, attributes) };
        let ret =
            ret.expect("function was marked as returning non-null, but actually returned NULL");
        unsafe { CFRetained::from_raw(ret) }
    }

    /// Returns a new font based on the original font with the specified symbolic traits.
    ///
    ///
    /// Parameter `font`: Original font reference on which to base the new font.
    ///
    ///
    /// Parameter `size`: The point size for the font reference. If 0.0 is specified, the original font's size will be preserved.
    ///
    ///
    /// Parameter `matrix`: The transformation matrix for the font. If unspecified, the original font matrix will be preserved. Optional.
    ///
    ///
    /// Parameter `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.
    ///
    ///
    /// Parameter `symTraitMask`: The mask bits of the symbolic traits. This bitfield is used to indicate the traits that should be changed.
    ///
    ///
    /// Returns: Returns a new font reference in the same family with the given symbolic traits, or NULL if none found in the system.
    ///
    /// # Safety
    ///
    /// `matrix` must be a valid pointer or null.
    #[doc(alias = "CTFontCreateCopyWithSymbolicTraits")]
    #[cfg(feature = "CTFontTraits")]
    #[inline]
    pub unsafe fn copy_with_symbolic_traits(
        &self,
        size: CGFloat,
        matrix: *const CGAffineTransform,
        sym_trait_value: CTFontSymbolicTraits,
        sym_trait_mask: CTFontSymbolicTraits,
    ) -> Option<CFRetained<CTFont>> {
        extern "C-unwind" {
            fn CTFontCreateCopyWithSymbolicTraits(
                font: &CTFont,
                size: CGFloat,
                matrix: *const CGAffineTransform,
                sym_trait_value: CTFontSymbolicTraits,
                sym_trait_mask: CTFontSymbolicTraits,
            ) -> Option<NonNull<CTFont>>;
        }
        let ret = unsafe {
            CTFontCreateCopyWithSymbolicTraits(self, size, matrix, sym_trait_value, sym_trait_mask)
        };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// Returns a new font in the specified family based on the traits of the original font.
    ///
    ///
    /// Parameter `font`: Original font reference to base new font on.
    ///
    ///
    /// Parameter `size`: The point size for the font reference. If 0.0 is specified, the original font's size will be preserved.
    ///
    ///
    /// Parameter `matrix`: The transformation matrix for the font. If unspecified, the original font matrix will be preserved. Optional.
    ///
    ///
    /// Parameter `family`: The name of the desired family.
    ///
    ///
    /// Returns: Returns a new font reference with the original traits in the given family. NULL if non found in the system.
    ///
    /// # Safety
    ///
    /// `matrix` must be a valid pointer or null.
    #[doc(alias = "CTFontCreateCopyWithFamily")]
    #[inline]
    pub unsafe fn copy_with_family(
        &self,
        size: CGFloat,
        matrix: *const CGAffineTransform,
        family: &CFString,
    ) -> Option<CFRetained<CTFont>> {
        extern "C-unwind" {
            fn CTFontCreateCopyWithFamily(
                font: &CTFont,
                size: CGFloat,
                matrix: *const CGAffineTransform,
                family: &CFString,
            ) -> Option<NonNull<CTFont>>;
        }
        let ret = unsafe { CTFontCreateCopyWithFamily(self, size, matrix, family) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// Returns a new font reference that can best map the given string range based on the current font.
    ///
    ///
    /// This function is to be used when the current font does not cover the given range of the string. The current font itself will not be returned, but preference is given to fonts in its cascade list.
    ///
    ///
    /// Parameter `currentFont`: The current font that contains a valid cascade list.
    ///
    ///
    /// Parameter `string`: A unicode string containing characters that cannot be encoded by the current font.
    ///
    ///
    /// Parameter `range`: A CFRange specifying the range of the string that needs to be mapped.
    ///
    ///
    /// Returns: This function returns the best substitute font that can encode the specified string range.
    ///
    ///
    /// See also: CTFontCopyCharacterSet
    ///
    /// See also: CTFontGetGlyphsForCharacters
    ///
    /// See also: kCTFontCascadeListAttribute
    #[doc(alias = "CTFontCreateForString")]
    #[inline]
    pub unsafe fn for_string(&self, string: &CFString, range: CFRange) -> CFRetained<CTFont> {
        extern "C-unwind" {
            fn CTFontCreateForString(
                current_font: &CTFont,
                string: &CFString,
                range: CFRange,
            ) -> Option<NonNull<CTFont>>;
        }
        let ret = unsafe { CTFontCreateForString(self, string, range) };
        let ret =
            ret.expect("function was marked as returning non-null, but actually returned NULL");
        unsafe { CFRetained::from_raw(ret) }
    }

    /// Returns a new font reference that can best map the given string range based on the current font and language specified.
    ///
    ///
    /// The current font itself can be returned if it covers the string provided.
    ///
    ///
    /// Parameter `currentFont`: The current font that contains a valid cascade list.
    ///
    ///
    /// Parameter `string`: A unicode string containing characters that cannot be encoded by the current font.
    ///
    ///
    /// Parameter `range`: A CFRange specifying the range of the string that needs to be mapped.
    ///
    ///
    /// Parameter `language`: Language identifier to select a font for a particular localization. If unspecified, the current system language is used. The format of the language identifier should conform to UTS #35.
    ///
    ///
    /// Returns: This function returns the best substitute font that can encode the specified string range.
    ///
    ///
    /// See also: CTFontCopyCharacterSet
    ///
    /// See also: CTFontGetGlyphsForCharacters
    ///
    /// See also: kCTFontCascadeListAttribute
    #[doc(alias = "CTFontCreateForStringWithLanguage")]
    #[inline]
    pub unsafe fn for_string_with_language(
        &self,
        string: &CFString,
        range: CFRange,
        language: Option<&CFString>,
    ) -> CFRetained<CTFont> {
        extern "C-unwind" {
            fn CTFontCreateForStringWithLanguage(
                current_font: &CTFont,
                string: &CFString,
                range: CFRange,
                language: Option<&CFString>,
            ) -> Option<NonNull<CTFont>>;
        }
        let ret = unsafe { CTFontCreateForStringWithLanguage(self, string, range, language) };
        let ret =
            ret.expect("function was marked as returning non-null, but actually returned NULL");
        unsafe { CFRetained::from_raw(ret) }
    }

    /// Returns the normalized font descriptors for the given font reference.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns a normalized font descriptor for a font. The font descriptor contains enough information to recreate this font at a later time.
    #[doc(alias = "CTFontCopyFontDescriptor")]
    #[cfg(feature = "CTFontDescriptor")]
    #[inline]
    pub unsafe fn font_descriptor(&self) -> CFRetained<CTFontDescriptor> {
        extern "C-unwind" {
            fn CTFontCopyFontDescriptor(font: &CTFont) -> Option<NonNull<CTFontDescriptor>>;
        }
        let ret = unsafe { CTFontCopyFontDescriptor(self) };
        let ret =
            ret.expect("function was marked as returning non-null, but actually returned NULL");
        unsafe { CFRetained::from_raw(ret) }
    }

    /// Returns the value associated with an arbitrary attribute.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Parameter `attribute`: The requested attribute.
    ///
    ///
    /// Returns: This function returns a retained reference to an arbitrary attribute. If the requested attribute is not present, NULL is returned. Refer to the attribute definitions for documentation as to how each attribute is packaged as a CFType.
    #[doc(alias = "CTFontCopyAttribute")]
    #[inline]
    pub unsafe fn attribute(&self, attribute: &CFString) -> Option<CFRetained<CFType>> {
        extern "C-unwind" {
            fn CTFontCopyAttribute(font: &CTFont, attribute: &CFString) -> Option<NonNull<CFType>>;
        }
        let ret = unsafe { CTFontCopyAttribute(self, attribute) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// Returns the point size of the font reference.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns the point size of the given font reference. This is the point size provided when the font was created.
    #[doc(alias = "CTFontGetSize")]
    #[inline]
    pub unsafe fn size(&self) -> CGFloat {
        extern "C-unwind" {
            fn CTFontGetSize(font: &CTFont) -> CGFloat;
        }
        unsafe { CTFontGetSize(self) }
    }

    /// Returns the transformation matrix of the font.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns the transformation matrix for this given font reference. This is the matrix that was provided when the font was created.
    #[doc(alias = "CTFontGetMatrix")]
    #[inline]
    pub unsafe fn matrix(&self) -> CGAffineTransform {
        extern "C-unwind" {
            fn CTFontGetMatrix(font: &CTFont) -> CGAffineTransform;
        }
        unsafe { CTFontGetMatrix(self) }
    }

    /// Returns the symbolic font traits.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns the symbolic traits of the font. This is equivalent to the kCTFontSymbolicTrait of traits dictionary. See CTFontTraits.h for a definition of the font traits.
    #[doc(alias = "CTFontGetSymbolicTraits")]
    #[cfg(feature = "CTFontTraits")]
    #[inline]
    pub unsafe fn symbolic_traits(&self) -> CTFontSymbolicTraits {
        extern "C-unwind" {
            fn CTFontGetSymbolicTraits(font: &CTFont) -> CTFontSymbolicTraits;
        }
        unsafe { CTFontGetSymbolicTraits(self) }
    }

    /// Returns the font traits dictionary.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns a retained reference to the font traits dictionary. Individual traits can be accessed with the trait key constants. See CTFontTraits.h for a definition of the font traits.
    #[doc(alias = "CTFontCopyTraits")]
    #[inline]
    pub unsafe fn traits(&self) -> CFRetained<CFDictionary> {
        extern "C-unwind" {
            fn CTFontCopyTraits(font: &CTFont) -> Option<NonNull<CFDictionary>>;
        }
        let ret = unsafe { CTFontCopyTraits(self) };
        let ret =
            ret.expect("function was marked as returning non-null, but actually returned NULL");
        unsafe { CFRetained::from_raw(ret) }
    }

    /// Return an ordered list of CTFontDescriptorRef's for font fallback derived from the system default fallback according to the given language preferences, making a reasonable attempt to match the given font's style, weight, and width.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Parameter `languagePrefList`: An array of language identifiers as CFString values, in decreasing order of preference.
    ///
    ///
    /// Returns: The ordered list of fallback fonts - ordered array of CTFontDescriptors.
    ///
    /// # Safety
    ///
    /// `language_pref_list` generic must be of the correct type.
    #[doc(alias = "CTFontCopyDefaultCascadeListForLanguages")]
    #[inline]
    pub unsafe fn default_cascade_list_for_languages(
        &self,
        language_pref_list: Option<&CFArray>,
    ) -> Option<CFRetained<CFArray>> {
        extern "C-unwind" {
            fn CTFontCopyDefaultCascadeListForLanguages(
                font: &CTFont,
                language_pref_list: Option<&CFArray>,
            ) -> Option<NonNull<CFArray>>;
        }
        let ret = unsafe { CTFontCopyDefaultCascadeListForLanguages(self, language_pref_list) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// Returns the PostScript name.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns a retained reference to the PostScript name of the font.
    #[doc(alias = "CTFontCopyPostScriptName")]
    #[inline]
    pub unsafe fn post_script_name(&self) -> CFRetained<CFString> {
        extern "C-unwind" {
            fn CTFontCopyPostScriptName(font: &CTFont) -> Option<NonNull<CFString>>;
        }
        let ret = unsafe { CTFontCopyPostScriptName(self) };
        let ret =
            ret.expect("function was marked as returning non-null, but actually returned NULL");
        unsafe { CFRetained::from_raw(ret) }
    }

    /// Returns the family name.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns a retained reference to the family name of the font.
    #[doc(alias = "CTFontCopyFamilyName")]
    #[inline]
    pub unsafe fn family_name(&self) -> CFRetained<CFString> {
        extern "C-unwind" {
            fn CTFontCopyFamilyName(font: &CTFont) -> Option<NonNull<CFString>>;
        }
        let ret = unsafe { CTFontCopyFamilyName(self) };
        let ret =
            ret.expect("function was marked as returning non-null, but actually returned NULL");
        unsafe { CFRetained::from_raw(ret) }
    }

    /// Returns the display name.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns a retained reference to the full name of the font.
    #[doc(alias = "CTFontCopyFullName")]
    #[inline]
    pub unsafe fn full_name(&self) -> CFRetained<CFString> {
        extern "C-unwind" {
            fn CTFontCopyFullName(font: &CTFont) -> Option<NonNull<CFString>>;
        }
        let ret = unsafe { CTFontCopyFullName(self) };
        let ret =
            ret.expect("function was marked as returning non-null, but actually returned NULL");
        unsafe { CFRetained::from_raw(ret) }
    }

    /// Returns the display name.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns a retained reference to the localized display name of the font.
    #[doc(alias = "CTFontCopyDisplayName")]
    #[inline]
    pub unsafe fn display_name(&self) -> CFRetained<CFString> {
        extern "C-unwind" {
            fn CTFontCopyDisplayName(font: &CTFont) -> Option<NonNull<CFString>>;
        }
        let ret = unsafe { CTFontCopyDisplayName(self) };
        let ret =
            ret.expect("function was marked as returning non-null, but actually returned NULL");
        unsafe { CFRetained::from_raw(ret) }
    }

    /// Returns a reference to the requested name.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Parameter `nameKey`: The name specifier. See name specifier constants.
    ///
    ///
    /// Returns: This function creates the requested name for the font, or NULL if the font does not have an entry for the requested name. The Unicode version of the name will be preferred, otherwise the first available will be used.
    #[doc(alias = "CTFontCopyName")]
    #[inline]
    pub unsafe fn name(&self, name_key: &CFString) -> Option<CFRetained<CFString>> {
        extern "C-unwind" {
            fn CTFontCopyName(font: &CTFont, name_key: &CFString) -> Option<NonNull<CFString>>;
        }
        let ret = unsafe { CTFontCopyName(self, name_key) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// Returns a reference to a localized font name.
    ///
    ///
    /// Localized names are necessary for presentation to a human but are rarely appropriate for programmatic use. CoreText provides localizations for common names but will not attempt any sort of automated translation.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Parameter `nameKey`: A name specifier listed in "Font Constants", for example kCTFontStyleNameKey. Name keys present in dictionaries (such as those for axes or features) are handled not by this function but by the functions returning those dictionaries.
    ///
    ///
    /// Parameter `actualLanguage`: Pointer to a CFStringRef to receive the language identifier of the returned name string. The format of 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.
    ///
    ///
    /// Returns: This function returns a specific localized name from the font reference. The name is localized based on the user's global language precedence. If the font does not have an entry for the requested name, NULL will be returned. The matched language will be returned in the caller's buffer.
    ///
    ///
    /// See also: CTFontCopyVariationAxes
    ///
    /// See also: CTFontCopyFeatures
    ///
    /// # Safety
    ///
    /// `actual_language` must be a valid pointer or null.
    #[doc(alias = "CTFontCopyLocalizedName")]
    #[inline]
    pub unsafe fn localized_name(
        &self,
        name_key: &CFString,
        actual_language: *mut *const CFString,
    ) -> Option<CFRetained<CFString>> {
        extern "C-unwind" {
            fn CTFontCopyLocalizedName(
                font: &CTFont,
                name_key: &CFString,
                actual_language: *mut *const CFString,
            ) -> Option<NonNull<CFString>>;
        }
        let ret = unsafe { CTFontCopyLocalizedName(self, name_key, actual_language) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// Returns the Unicode character set of the font.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns a retained reference to the font's character set. This character set covers the nominal referenced by the font's Unicode cmap table (or equivalent).
    #[doc(alias = "CTFontCopyCharacterSet")]
    #[inline]
    pub unsafe fn character_set(&self) -> CFRetained<CFCharacterSet> {
        extern "C-unwind" {
            fn CTFontCopyCharacterSet(font: &CTFont) -> Option<NonNull<CFCharacterSet>>;
        }
        let ret = unsafe { CTFontCopyCharacterSet(self) };
        let ret =
            ret.expect("function was marked as returning non-null, but actually returned NULL");
        unsafe { CFRetained::from_raw(ret) }
    }

    /// Returns the best string encoding for legacy format support.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns the best string encoding for the font.
    #[doc(alias = "CTFontGetStringEncoding")]
    #[inline]
    pub unsafe fn string_encoding(&self) -> CFStringEncoding {
        extern "C-unwind" {
            fn CTFontGetStringEncoding(font: &CTFont) -> CFStringEncoding;
        }
        unsafe { CTFontGetStringEncoding(self) }
    }

    /// Returns an array of languages supported by the font.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns a retained reference to an array of languages supported by the font. The array contains language identifier strings as CFStringRefs. The format of the language identifier will conform to UTS #35.
    #[doc(alias = "CTFontCopySupportedLanguages")]
    #[inline]
    pub unsafe fn supported_languages(&self) -> CFRetained<CFArray> {
        extern "C-unwind" {
            fn CTFontCopySupportedLanguages(font: &CTFont) -> Option<NonNull<CFArray>>;
        }
        let ret = unsafe { CTFontCopySupportedLanguages(self) };
        let ret =
            ret.expect("function was marked as returning non-null, but actually returned NULL");
        unsafe { CFRetained::from_raw(ret) }
    }

    /// Performs basic character-to-glyph mapping.
    ///
    ///
    /// This function only provides the nominal mapping as specified by the font's Unicode cmap (or equivalent); such mapping does not constitute proper Unicode layout: it is the caller's responsibility to handle the Unicode properties of the characters.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Parameter `characters`: An array of characters (UTF-16 code units). Non-BMP characters must be encoded as surrogate pairs.
    ///
    ///
    /// Parameter `glyphs`: A pointer to a buffer to receive the glyphs. Glyphs for non-BMP characters are sparse: the first glyph corresponds to the full character and the second glyph will be 0.
    ///
    ///
    /// Parameter `count`: The capacity of both the characters and glyphs arrays.
    ///
    ///
    /// Returns: The return value indicates whether all provided characters were successfully mapped. A return value of true indicates that the font mapped all characters. A return value of false indicates that some or all of the characters were not mapped; glyphs for unmapped characters will be 0 (with the exception of those corresponding non-BMP characters as described above).
    ///
    ///
    /// See also: CTFontCopyCharacterSet
    ///
    /// # Safety
    ///
    /// - `characters` must be a valid pointer.
    /// - `glyphs` must be a valid pointer.
    #[doc(alias = "CTFontGetGlyphsForCharacters")]
    #[cfg(feature = "objc2-core-graphics")]
    #[inline]
    pub unsafe fn glyphs_for_characters(
        &self,
        characters: NonNull<UniChar>,
        glyphs: NonNull<CGGlyph>,
        count: CFIndex,
    ) -> bool {
        extern "C-unwind" {
            fn CTFontGetGlyphsForCharacters(
                font: &CTFont,
                characters: NonNull<UniChar>,
                glyphs: NonNull<CGGlyph>,
                count: CFIndex,
            ) -> bool;
        }
        unsafe { CTFontGetGlyphsForCharacters(self, characters, glyphs, count) }
    }

    /// Returns the scaled font ascent metric.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns the font ascent metric scaled based on the point size and matrix of the font reference.
    #[doc(alias = "CTFontGetAscent")]
    #[inline]
    pub unsafe fn ascent(&self) -> CGFloat {
        extern "C-unwind" {
            fn CTFontGetAscent(font: &CTFont) -> CGFloat;
        }
        unsafe { CTFontGetAscent(self) }
    }

    /// Returns the scaled font descent metric.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns the font descent metric scaled based on the point size and matrix of the font reference.
    #[doc(alias = "CTFontGetDescent")]
    #[inline]
    pub unsafe fn descent(&self) -> CGFloat {
        extern "C-unwind" {
            fn CTFontGetDescent(font: &CTFont) -> CGFloat;
        }
        unsafe { CTFontGetDescent(self) }
    }

    /// Returns the scaled font leading metric.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns the font leading metric scaled based on the point size and matrix of the font reference.
    #[doc(alias = "CTFontGetLeading")]
    #[inline]
    pub unsafe fn leading(&self) -> CGFloat {
        extern "C-unwind" {
            fn CTFontGetLeading(font: &CTFont) -> CGFloat;
        }
        unsafe { CTFontGetLeading(self) }
    }

    /// Returns the units per em metric.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns the units per em of the font.
    #[doc(alias = "CTFontGetUnitsPerEm")]
    #[inline]
    pub unsafe fn units_per_em(&self) -> c_uint {
        extern "C-unwind" {
            fn CTFontGetUnitsPerEm(font: &CTFont) -> c_uint;
        }
        unsafe { CTFontGetUnitsPerEm(self) }
    }

    /// Returns the number of glyphs.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns the number of glyphs in the font.
    #[doc(alias = "CTFontGetGlyphCount")]
    #[inline]
    pub unsafe fn glyph_count(&self) -> CFIndex {
        extern "C-unwind" {
            fn CTFontGetGlyphCount(font: &CTFont) -> CFIndex;
        }
        unsafe { CTFontGetGlyphCount(self) }
    }

    /// Returns the scaled bounding box.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This will return the design bounding box of the font, which is the rectangle defined by xMin, yMin, xMax, and yMax values for the font.
    #[doc(alias = "CTFontGetBoundingBox")]
    #[inline]
    pub unsafe fn bounding_box(&self) -> CGRect {
        extern "C-unwind" {
            fn CTFontGetBoundingBox(font: &CTFont) -> CGRect;
        }
        unsafe { CTFontGetBoundingBox(self) }
    }

    /// Returns the scaled underline position.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns the font underline position metric scaled based on the point size and matrix of the font reference.
    #[doc(alias = "CTFontGetUnderlinePosition")]
    #[inline]
    pub unsafe fn underline_position(&self) -> CGFloat {
        extern "C-unwind" {
            fn CTFontGetUnderlinePosition(font: &CTFont) -> CGFloat;
        }
        unsafe { CTFontGetUnderlinePosition(self) }
    }

    /// Returns the scaled underline thickness metric.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns the font underline thickness metric scaled based on the point size and matrix of the font reference.
    #[doc(alias = "CTFontGetUnderlineThickness")]
    #[inline]
    pub unsafe fn underline_thickness(&self) -> CGFloat {
        extern "C-unwind" {
            fn CTFontGetUnderlineThickness(font: &CTFont) -> CGFloat;
        }
        unsafe { CTFontGetUnderlineThickness(self) }
    }

    /// Returns the slant angle of the font.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns the transformed slant angle of the font. This is equivalent to the italic or caret angle with any skew from the transformation matrix applied.
    #[doc(alias = "CTFontGetSlantAngle")]
    #[inline]
    pub unsafe fn slant_angle(&self) -> CGFloat {
        extern "C-unwind" {
            fn CTFontGetSlantAngle(font: &CTFont) -> CGFloat;
        }
        unsafe { CTFontGetSlantAngle(self) }
    }

    /// Returns the cap height metric.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns the font cap height metric scaled based on the point size and matrix of the font reference.
    #[doc(alias = "CTFontGetCapHeight")]
    #[inline]
    pub unsafe fn cap_height(&self) -> CGFloat {
        extern "C-unwind" {
            fn CTFontGetCapHeight(font: &CTFont) -> CGFloat;
        }
        unsafe { CTFontGetCapHeight(self) }
    }

    /// Returns the X height metric.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns the font X height metric scaled based on the point size and matrix of the font reference.
    #[doc(alias = "CTFontGetXHeight")]
    #[inline]
    pub unsafe fn x_height(&self) -> CGFloat {
        extern "C-unwind" {
            fn CTFontGetXHeight(font: &CTFont) -> CGFloat;
        }
        unsafe { CTFontGetXHeight(self) }
    }

    /// Returns the CGGlyph for the specified glyph name.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Parameter `glyphName`: The glyph name as a CFString.
    ///
    ///
    /// Returns: The glyph with the specified name or 0 if the name is not recognized; this glyph can be used with other Core Text glyph data accessors or with Quartz.
    #[doc(alias = "CTFontGetGlyphWithName")]
    #[cfg(feature = "objc2-core-graphics")]
    #[inline]
    pub unsafe fn glyph_with_name(&self, glyph_name: &CFString) -> CGGlyph {
        extern "C-unwind" {
            fn CTFontGetGlyphWithName(font: &CTFont, glyph_name: &CFString) -> CGGlyph;
        }
        unsafe { CTFontGetGlyphWithName(self, glyph_name) }
    }

    /// Returns the name for the specified glyph.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Parameter `glyph`: The glyph.
    ///
    ///
    /// Returns: The glyph name as a CFString or NULL if the glyph is invalid.
    ///
    ///
    /// See also: CTFontGetGlyphWithName
    #[doc(alias = "CTFontCopyNameForGlyph")]
    #[cfg(feature = "objc2-core-graphics")]
    #[inline]
    pub unsafe fn name_for_glyph(&self, glyph: CGGlyph) -> Option<CFRetained<CFString>> {
        extern "C-unwind" {
            fn CTFontCopyNameForGlyph(font: &CTFont, glyph: CGGlyph) -> Option<NonNull<CFString>>;
        }
        let ret = unsafe { CTFontCopyNameForGlyph(self, glyph) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// Calculates the bounding rects for an array of glyphs and returns the overall bounding rect for the run.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Parameter `orientation`: The intended drawing orientation of the glyphs. Used to determined which glyph metrics to return.
    ///
    ///
    /// Parameter `glyphs`: An array of count number of glyphs.
    ///
    ///
    /// Parameter `boundingRects`: An array of count number of CGRects to receive the computed glyph rects. Can be NULL, in which case only the overall bounding rect is calculated.
    ///
    ///
    /// Parameter `count`: The capacity of the glyphs and boundingRects buffers.
    ///
    ///
    /// Returns: This function returns the overall bounding rectangle for an array or run of glyphs. The bounding rects of the individual glyphs are returned through the boundingRects parameter. These are the design metrics from the font transformed in font space.
    ///
    /// # Safety
    ///
    /// - `glyphs` must be a valid pointer.
    /// - `bounding_rects` must be a valid pointer or null.
    #[doc(alias = "CTFontGetBoundingRectsForGlyphs")]
    #[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
    #[inline]
    pub unsafe fn bounding_rects_for_glyphs(
        &self,
        orientation: CTFontOrientation,
        glyphs: NonNull<CGGlyph>,
        bounding_rects: *mut CGRect,
        count: CFIndex,
    ) -> CGRect {
        extern "C-unwind" {
            fn CTFontGetBoundingRectsForGlyphs(
                font: &CTFont,
                orientation: CTFontOrientation,
                glyphs: NonNull<CGGlyph>,
                bounding_rects: *mut CGRect,
                count: CFIndex,
            ) -> CGRect;
        }
        unsafe { CTFontGetBoundingRectsForGlyphs(self, orientation, glyphs, bounding_rects, count) }
    }

    /// Calculates the optical bounding rects for an array of glyphs and returns the overall optical bounding rect for the run.
    ///
    ///
    /// Fonts may specify the optical edges of glyphs that can be used to make the edges of lines of text line up in a more visually pleasing way. This function returns bounding rects corresponding to this information if present in a font, otherwise it returns typographic bounding rects (composed of the font's ascent and descent and a glyph's advance width).
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Parameter `glyphs`: An array of count number of glyphs.
    ///
    ///
    /// Parameter `boundingRects`: An array of count number of CGRects to receive the computed glyph rects. Can be NULL, in which case only the overall bounding rect is calculated.
    ///
    ///
    /// Parameter `count`: The capacity of the glyphs and boundingRects buffers.
    ///
    ///
    /// Parameter `options`: Reserved, set to zero.
    ///
    ///
    /// Returns: This function returns the overall bounding rectangle for an array or run of glyphs. The bounding rects of the individual glyphs are returned through the boundingRects parameter. These are the design metrics from the font transformed in font space.
    ///
    /// # Safety
    ///
    /// - `glyphs` must be a valid pointer.
    /// - `bounding_rects` must be a valid pointer or null.
    #[doc(alias = "CTFontGetOpticalBoundsForGlyphs")]
    #[cfg(feature = "objc2-core-graphics")]
    #[inline]
    pub unsafe fn optical_bounds_for_glyphs(
        &self,
        glyphs: NonNull<CGGlyph>,
        bounding_rects: *mut CGRect,
        count: CFIndex,
        options: CFOptionFlags,
    ) -> CGRect {
        extern "C-unwind" {
            fn CTFontGetOpticalBoundsForGlyphs(
                font: &CTFont,
                glyphs: NonNull<CGGlyph>,
                bounding_rects: *mut CGRect,
                count: CFIndex,
                options: CFOptionFlags,
            ) -> CGRect;
        }
        unsafe { CTFontGetOpticalBoundsForGlyphs(self, glyphs, bounding_rects, count, options) }
    }

    /// Calculates the advances for an array of glyphs and returns the summed advance.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Parameter `orientation`: The intended drawing orientation of the glyphs. Used to determined which glyph metrics to return.
    ///
    ///
    /// Parameter `glyphs`: An array of count number of glyphs.
    ///
    ///
    /// Parameter `advances`: An array of count number of CGSize to receive the computed glyph advances. Can be NULL, in which case only the overall advance is calculated.
    ///
    ///
    /// Parameter `count`: The capacity of the glyphs and advances buffers.
    ///
    ///
    /// Returns: This function returns the summed glyph advance of an array of glyphs. Individual glyph advances are passed back via the advances parameter. These are the ideal metrics for each glyph scaled and transformed in font space.
    ///
    /// # Safety
    ///
    /// - `glyphs` must be a valid pointer.
    /// - `advances` must be a valid pointer or null.
    #[doc(alias = "CTFontGetAdvancesForGlyphs")]
    #[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
    #[inline]
    pub unsafe fn advances_for_glyphs(
        &self,
        orientation: CTFontOrientation,
        glyphs: NonNull<CGGlyph>,
        advances: *mut CGSize,
        count: CFIndex,
    ) -> c_double {
        extern "C-unwind" {
            fn CTFontGetAdvancesForGlyphs(
                font: &CTFont,
                orientation: CTFontOrientation,
                glyphs: NonNull<CGGlyph>,
                advances: *mut CGSize,
                count: CFIndex,
            ) -> c_double;
        }
        unsafe { CTFontGetAdvancesForGlyphs(self, orientation, glyphs, advances, count) }
    }

    /// Calculates the offset from the default (horizontal) origin to the vertical origin for an array of glyphs.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Parameter `glyphs`: An array of count number of glyphs.
    ///
    ///
    /// Parameter `translations`: An array of count number of CGSize to receive the computed origin offsets.
    ///
    ///
    /// Parameter `count`: The capacity of the glyphs and translations buffers.
    ///
    /// # Safety
    ///
    /// - `glyphs` must be a valid pointer.
    /// - `translations` must be a valid pointer.
    #[doc(alias = "CTFontGetVerticalTranslationsForGlyphs")]
    #[cfg(feature = "objc2-core-graphics")]
    #[inline]
    pub unsafe fn vertical_translations_for_glyphs(
        &self,
        glyphs: NonNull<CGGlyph>,
        translations: NonNull<CGSize>,
        count: CFIndex,
    ) {
        extern "C-unwind" {
            fn CTFontGetVerticalTranslationsForGlyphs(
                font: &CTFont,
                glyphs: NonNull<CGGlyph>,
                translations: NonNull<CGSize>,
                count: CFIndex,
            );
        }
        unsafe { CTFontGetVerticalTranslationsForGlyphs(self, glyphs, translations, count) }
    }

    /// Creates a path for the specified glyph.
    ///
    ///
    /// Creates a path from the outlines of the glyph for the specified font. The path will reflect the font point size, matrix, and transform parameter, in that order. The transform parameter will most commonly be used to provide a translation to the desired glyph origin.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Parameter `glyph`: The glyph.
    ///
    ///
    /// Parameter `matrix`: An affine transform applied to the path. Can be NULL, in which case CGAffineTransformIdentity will be used.
    ///
    ///
    /// Returns: A retained CGPath reference containing the glyph outlines or NULL if there is no such glyph or it has no outline.
    ///
    /// # Safety
    ///
    /// `matrix` must be a valid pointer or null.
    #[doc(alias = "CTFontCreatePathForGlyph")]
    #[cfg(feature = "objc2-core-graphics")]
    #[inline]
    pub unsafe fn path_for_glyph(
        &self,
        glyph: CGGlyph,
        matrix: *const CGAffineTransform,
    ) -> Option<CFRetained<CGPath>> {
        extern "C-unwind" {
            fn CTFontCreatePathForGlyph(
                font: &CTFont,
                glyph: CGGlyph,
                matrix: *const CGAffineTransform,
            ) -> Option<NonNull<CGPath>>;
        }
        let ret = unsafe { CTFontCreatePathForGlyph(self, glyph, matrix) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }
}

extern "C" {
    /// kCTFontVariationAxisIdentifierKey
    ///
    /// Key to get the variation axis identifier.
    ///
    /// This key is used with a variation axis dictionary to get the axis identifier value as a CFNumberRef.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontvariationaxisidentifierkey?language=objc)
    pub static kCTFontVariationAxisIdentifierKey: &'static CFString;
}

extern "C" {
    /// kCTFontVariationAxisMinimumValueKey
    ///
    /// Key to get the variation axis minimum value.
    ///
    /// This key is used with a variation axis dictionary to get the minimum axis value as a CFNumberRef.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontvariationaxisminimumvaluekey?language=objc)
    pub static kCTFontVariationAxisMinimumValueKey: &'static CFString;
}

extern "C" {
    /// kCTFontVariationAxisMaximumValueKey
    ///
    /// Key to get the variation axis maximum value.
    ///
    /// This key is used with a variation axis dictionary to get the maximum axis value as a CFNumberRef.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontvariationaxismaximumvaluekey?language=objc)
    pub static kCTFontVariationAxisMaximumValueKey: &'static CFString;
}

extern "C" {
    /// kCTFontVariationAxisDefaultValueKey
    ///
    /// Key to get the variation axis default value.
    ///
    /// This key is used with a variation axis dictionary to get the default axis value as a CFNumberRef.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontvariationaxisdefaultvaluekey?language=objc)
    pub static kCTFontVariationAxisDefaultValueKey: &'static CFString;
}

extern "C" {
    /// kCTFontVariationAxisNameKey
    ///
    /// Key to get the variation axis name string.
    ///
    /// This key is used with a variation axis dictionary to get the variation axis name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontvariationaxisnamekey?language=objc)
    pub static kCTFontVariationAxisNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontVariationAxisHiddenKey
    ///
    /// Key to get the hidden axis flag.
    ///
    /// This key contains a CFBoolean value that is true when the font designer recommends the axis not be exposed directly to end users in application interfaces.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontvariationaxishiddenkey?language=objc)
    pub static kCTFontVariationAxisHiddenKey: &'static CFString;
}

impl CTFont {
    /// Returns an array of variation axis dictionaries.
    ///
    /// Each variation axis dictionary contains the five kCTFontVariationAxis* keys above, and kCTFontVariationAxisNameKey values will be localized when supported by the font; for programmatic uses kCTFontVariationAxesAttribute may be used instead.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: An array of variation axis dictionaries or null if the font does not support variations.
    ///
    ///
    /// See also: kCTFontVariationAxesAttribute
    #[doc(alias = "CTFontCopyVariationAxes")]
    #[inline]
    pub unsafe fn variation_axes(&self) -> Option<CFRetained<CFArray>> {
        extern "C-unwind" {
            fn CTFontCopyVariationAxes(font: &CTFont) -> Option<NonNull<CFArray>>;
        }
        let ret = unsafe { CTFontCopyVariationAxes(self) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// Returns a variation dictionary.
    ///
    /// This function describes the current configuration of a variation font: a dictionary of number values with variation identifier number keys. As of macOS 10.12 and iOS 10.0, only non-default values (as determined by the variation axis) are returned.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns a variation dictionary or null if the font does not support variations.
    ///
    ///
    /// See also: kCTFontVariationAxisIdentifierKey
    ///
    /// See also: kCTFontVariationAxisDefaultValueKey
    #[doc(alias = "CTFontCopyVariation")]
    #[inline]
    pub unsafe fn variation(&self) -> Option<CFRetained<CFDictionary>> {
        extern "C-unwind" {
            fn CTFontCopyVariation(font: &CTFont) -> Option<NonNull<CFDictionary>>;
        }
        let ret = unsafe { CTFontCopyVariation(self) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }
}

extern "C" {
    /// kCTFontOpenTypeFeatureTag
    ///
    /// Key to get the OpenType feature tag.
    ///
    /// This key can be used with a font feature dictionary to get the tag as a CFStringRef.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontopentypefeaturetag?language=objc)
    pub static kCTFontOpenTypeFeatureTag: &'static CFString;
}

extern "C" {
    /// kCTFontOpenTypeFeatureValue
    ///
    /// Key to get the OpenType feature value.
    ///
    /// This key can be used with a font feature dictionary to get the value as a CFNumberRef.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontopentypefeaturevalue?language=objc)
    pub static kCTFontOpenTypeFeatureValue: &'static CFString;
}

extern "C" {
    /// kCTFontFeatureTypeIdentifierKey
    ///
    /// Key to get the font feature type value.
    ///
    /// This key can be used with a font feature dictionary to get the type identifier as a CFNumberRef.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeaturetypeidentifierkey?language=objc)
    pub static kCTFontFeatureTypeIdentifierKey: &'static CFString;
}

extern "C" {
    /// kCTFontFeatureTypeNameKey
    ///
    /// Key to get the font feature name.
    ///
    /// This key can be used with a font feature dictionary to get the localized type name string as a CFString.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeaturetypenamekey?language=objc)
    pub static kCTFontFeatureTypeNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontFeatureTypeExclusiveKey
    ///
    /// Key to get the font feature exclusive setting.
    ///
    /// This key can be used with a font feature dictionary to get the the exclusive setting of the feature as a CFBoolean. The value associated with this key indicates whether the feature selectors associated with this type should be mutually exclusive.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeaturetypeexclusivekey?language=objc)
    pub static kCTFontFeatureTypeExclusiveKey: &'static CFString;
}

extern "C" {
    /// kCTFontFeatureTypeSelectorsKey
    ///
    /// Key to get the font feature selectors.
    ///
    /// This key can be used with a font feature dictionary to get the array of font feature selectors as a CFArrayRef. This is an array of selector dictionaries that contain the values for the following selector keys.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeaturetypeselectorskey?language=objc)
    pub static kCTFontFeatureTypeSelectorsKey: &'static CFString;
}

extern "C" {
    /// kCTFontFeatureSelectorIdentifierKey
    ///
    /// Key to get the font feature selector identifier.
    ///
    /// This key can be used with a selector dictionary corresponding to a feature type to obtain the selector identifier value as a CFNumberRef.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeatureselectoridentifierkey?language=objc)
    pub static kCTFontFeatureSelectorIdentifierKey: &'static CFString;
}

extern "C" {
    /// kCTFontFeatureSelectorNameKey
    ///
    /// Key to get the font feature selector name.
    ///
    /// This key is used with a selector dictionary to get the localized name string for the selector as a CFStringRef.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeatureselectornamekey?language=objc)
    pub static kCTFontFeatureSelectorNameKey: &'static CFString;
}

extern "C" {
    /// kCTFontFeatureSelectorDefaultKey
    ///
    /// Key to get the font feature selector default setting value.
    ///
    /// This key is used with a selector dictionary to get the default indicator for the selector. This value is a CFBooleanRef which if present and true indicates that this selector is the default setting for the current feature type.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeatureselectordefaultkey?language=objc)
    pub static kCTFontFeatureSelectorDefaultKey: &'static CFString;
}

extern "C" {
    /// kCTFontFeatureSelectorSettingKey
    ///
    /// Key to get or specify the current feature setting.
    ///
    /// This key is used with a selector dictionary to get or specify the current setting for the selector. This value is a CFBooleanRef to indicate whether this selector is on or off. If this key is not present, the default setting is used.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeatureselectorsettingkey?language=objc)
    pub static kCTFontFeatureSelectorSettingKey: &'static CFString;
}

extern "C" {
    /// kCTFontFeatureSampleTextKey
    ///
    /// Key to get the font feature sample text.
    ///
    /// This key can be used with a font feature dictionary to get the localized sample text as a CFStringRef.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeaturesampletextkey?language=objc)
    pub static kCTFontFeatureSampleTextKey: &'static CFString;
}

extern "C" {
    /// kCTFontFeatureTooltipTextKey
    ///
    /// Key to get the font feature tooltip text.
    ///
    /// This key can be used with a font feature dictionary to get the localized tooltip text as a CFStringRef.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeaturetooltiptextkey?language=objc)
    pub static kCTFontFeatureTooltipTextKey: &'static CFString;
}

impl CTFont {
    /// Returns an array of font features
    ///
    ///
    /// The returned value describes the features available for the provided font. Each array value is a feature dictionary describing a feature type, with related selector dictionaries in an array under the kCTFontFeatureTypeSelectorsKey.
    /// While CoreText supports AAT and OpenType font features, they are preferentially represented as AAT features owing to their more formal structure: individual feature types can be either exclusive or non-exclusive, which indicates whether one or more of its selectors can be simultaneously enabled. Where possible features are elaborated with their OpenType feature tag and value, which can occur within both type or selector dictionaries depending on the feature's mapping to an AAT type and selector pair.
    /// Names are localized according to the preferred langauges of the caller and therefore are not appropriate for programmatically identifying features.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns an array of font feature dictionaries for the font reference.
    #[doc(alias = "CTFontCopyFeatures")]
    #[inline]
    pub unsafe fn features(&self) -> Option<CFRetained<CFArray>> {
        extern "C-unwind" {
            fn CTFontCopyFeatures(font: &CTFont) -> Option<NonNull<CFArray>>;
        }
        let ret = unsafe { CTFontCopyFeatures(self) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// Returns an array of font feature setting tuples
    ///
    ///
    /// A setting tuple is a dictionary of a kCTFontFeatureTypeIdentifierKey key-value pair and a kCTFontFeatureSelectorIdentifierKey key-value pair. Each tuple corresponds to an enabled non-default setting. It is the caller's responsibility to handle exclusive and non-exclusive settings as necessary.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Returns: This function returns a normalized array of font feature setting dictionaries. The array will only contain the non-default settings that should be applied to the font, or NULL if the default settings should be used.
    #[doc(alias = "CTFontCopyFeatureSettings")]
    #[inline]
    pub unsafe fn feature_settings(&self) -> Option<CFRetained<CFArray>> {
        extern "C-unwind" {
            fn CTFontCopyFeatureSettings(font: &CTFont) -> Option<NonNull<CFArray>>;
        }
        let ret = unsafe { CTFontCopyFeatureSettings(self) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// Returns a CGFontRef and attributes.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Parameter `attributes`: A pointer to a CTFontDescriptorRef to receive a font descriptor containing additional attributes. Can be NULL. Must be released by caller.
    ///
    ///
    /// Returns: This function returns a CGFontRef for the given font reference. Additional attributes from the font will be passed back as a font descriptor via the attributes parameter. The result must be released by the caller.
    ///
    /// # Safety
    ///
    /// `attributes` must be a valid pointer or null.
    #[doc(alias = "CTFontCopyGraphicsFont")]
    #[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
    #[inline]
    pub unsafe fn graphics_font(
        &self,
        attributes: *mut *const CTFontDescriptor,
    ) -> CFRetained<CGFont> {
        extern "C-unwind" {
            fn CTFontCopyGraphicsFont(
                font: &CTFont,
                attributes: *mut *const CTFontDescriptor,
            ) -> Option<NonNull<CGFont>>;
        }
        let ret = unsafe { CTFontCopyGraphicsFont(self, attributes) };
        let ret =
            ret.expect("function was marked as returning non-null, but actually returned NULL");
        unsafe { CFRetained::from_raw(ret) }
    }

    /// Creates a new font reference from a CGFontRef.
    ///
    ///
    /// Parameter `graphicsFont`: A valid CGFontRef.
    ///
    ///
    /// Parameter `size`: The point size for the font reference. If 0.0 is specified, the default font size of 12.0 will be used.
    ///
    ///
    /// Parameter `matrix`: The transformation matrix for the font. If unspecified, the identity matrix will be used. Optional.
    ///
    ///
    /// Parameter `attributes`: A CTFontDescriptorRef containing additional attributes that should be matched. Optional.
    ///
    ///
    /// Returns: This function returns a new font reference for an existing CGFontRef with the specified size, matrix, and additional attributes.
    ///
    /// # Safety
    ///
    /// `matrix` must be a valid pointer or null.
    #[doc(alias = "CTFontCreateWithGraphicsFont")]
    #[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
    #[inline]
    pub unsafe fn with_graphics_font(
        graphics_font: &CGFont,
        size: CGFloat,
        matrix: *const CGAffineTransform,
        attributes: Option<&CTFontDescriptor>,
    ) -> CFRetained<CTFont> {
        extern "C-unwind" {
            fn CTFontCreateWithGraphicsFont(
                graphics_font: &CGFont,
                size: CGFloat,
                matrix: *const CGAffineTransform,
                attributes: Option<&CTFontDescriptor>,
            ) -> Option<NonNull<CTFont>>;
        }
        let ret = unsafe { CTFontCreateWithGraphicsFont(graphics_font, size, matrix, attributes) };
        let ret =
            ret.expect("function was marked as returning non-null, but actually returned NULL");
        unsafe { CFRetained::from_raw(ret) }
    }
}

/// [Apple's documentation](https://developer.apple.com/documentation/coretext/atsfontref?language=objc)
pub type ATSFontRef = u32;

impl CTFont {
    /// Returns a font reference for the given Quickdraw instance.
    ///
    ///
    /// This function is provided for compatibility support between Core Text and clients needing to support Quickdraw font references.
    ///
    ///
    /// Parameter `name`: The Quickdraw font name. If NULL or zero length, an identifier must be specified instead.
    ///
    ///
    /// Parameter `identifier`: The Quickdraw font identifier. If 0, a name must be specified instead.
    ///
    ///
    /// Parameter `style`: The Quickdraw font style.
    ///
    ///
    /// Parameter `size`: The point size for the font reference. If 0.0 is specified, the default size of 12.0 is used.
    ///
    ///
    /// Returns: This function returns the best font instance matching the Quickdraw instance information.
    ///
    /// # Safety
    ///
    /// `name` must be a valid pointer or null.
    #[doc(alias = "CTFontCreateWithQuickdrawInstance")]
    #[deprecated = "Quickdraw font references are deprecated"]
    #[inline]
    pub unsafe fn with_quickdraw_instance(
        name: ConstStr255Param,
        identifier: i16,
        style: u8,
        size: CGFloat,
    ) -> CFRetained<CTFont> {
        extern "C-unwind" {
            fn CTFontCreateWithQuickdrawInstance(
                name: ConstStr255Param,
                identifier: i16,
                style: u8,
                size: CGFloat,
            ) -> Option<NonNull<CTFont>>;
        }
        let ret = unsafe { CTFontCreateWithQuickdrawInstance(name, identifier, style, size) };
        let ret =
            ret.expect("function was marked as returning non-null, but actually returned NULL");
        unsafe { CFRetained::from_raw(ret) }
    }
}

/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablebase?language=objc)
pub const kCTFontTableBASE: c_uint = 0x42415345;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecbdt?language=objc)
pub const kCTFontTableCBDT: c_uint = 0x43424454;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecblc?language=objc)
pub const kCTFontTableCBLC: c_uint = 0x43424c43;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecff?language=objc)
pub const kCTFontTableCFF: c_uint = 0x43464620;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecff2?language=objc)
pub const kCTFontTableCFF2: c_uint = 0x43464632;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecolr?language=objc)
pub const kCTFontTableCOLR: c_uint = 0x434f4c52;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecpal?language=objc)
pub const kCTFontTableCPAL: c_uint = 0x4350414c;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttabledsig?language=objc)
pub const kCTFontTableDSIG: c_uint = 0x44534947;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableebdt?language=objc)
pub const kCTFontTableEBDT: c_uint = 0x45424454;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableeblc?language=objc)
pub const kCTFontTableEBLC: c_uint = 0x45424c43;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableebsc?language=objc)
pub const kCTFontTableEBSC: c_uint = 0x45425343;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablegdef?language=objc)
pub const kCTFontTableGDEF: c_uint = 0x47444546;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablegpos?language=objc)
pub const kCTFontTableGPOS: c_uint = 0x47504f53;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablegsub?language=objc)
pub const kCTFontTableGSUB: c_uint = 0x47535542;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablehvar?language=objc)
pub const kCTFontTableHVAR: c_uint = 0x48564152;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablejstf?language=objc)
pub const kCTFontTableJSTF: c_uint = 0x4a535446;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableltsh?language=objc)
pub const kCTFontTableLTSH: c_uint = 0x4c545348;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablemath?language=objc)
pub const kCTFontTableMATH: c_uint = 0x4d415448;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablemerg?language=objc)
pub const kCTFontTableMERG: c_uint = 0x4d455247;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablemvar?language=objc)
pub const kCTFontTableMVAR: c_uint = 0x4d564152;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableos2?language=objc)
pub const kCTFontTableOS2: c_uint = 0x4f532f32;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablepclt?language=objc)
pub const kCTFontTablePCLT: c_uint = 0x50434c54;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablestat?language=objc)
pub const kCTFontTableSTAT: c_uint = 0x53544154;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablesvg?language=objc)
pub const kCTFontTableSVG: c_uint = 0x53564720;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablevdmx?language=objc)
pub const kCTFontTableVDMX: c_uint = 0x56444d58;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablevorg?language=objc)
pub const kCTFontTableVORG: c_uint = 0x564f5247;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablevvar?language=objc)
pub const kCTFontTableVVAR: c_uint = 0x56564152;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablezapf?language=objc)
pub const kCTFontTableZapf: c_uint = 0x5a617066;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableacnt?language=objc)
pub const kCTFontTableAcnt: c_uint = 0x61636e74;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableankr?language=objc)
pub const kCTFontTableAnkr: c_uint = 0x616e6b72;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableavar?language=objc)
pub const kCTFontTableAvar: c_uint = 0x61766172;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablebdat?language=objc)
pub const kCTFontTableBdat: c_uint = 0x62646174;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablebhed?language=objc)
pub const kCTFontTableBhed: c_uint = 0x62686564;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablebloc?language=objc)
pub const kCTFontTableBloc: c_uint = 0x626c6f63;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablebsln?language=objc)
pub const kCTFontTableBsln: c_uint = 0x62736c6e;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecidg?language=objc)
pub const kCTFontTableCidg: c_uint = 0x63696467;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecmap?language=objc)
pub const kCTFontTableCmap: c_uint = 0x636d6170;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecvar?language=objc)
pub const kCTFontTableCvar: c_uint = 0x63766172;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecvt?language=objc)
pub const kCTFontTableCvt: c_uint = 0x63767420;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablefdsc?language=objc)
pub const kCTFontTableFdsc: c_uint = 0x66647363;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablefeat?language=objc)
pub const kCTFontTableFeat: c_uint = 0x66656174;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablefmtx?language=objc)
pub const kCTFontTableFmtx: c_uint = 0x666d7478;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablefond?language=objc)
pub const kCTFontTableFond: c_uint = 0x666f6e64;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablefpgm?language=objc)
pub const kCTFontTableFpgm: c_uint = 0x6670676d;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablefvar?language=objc)
pub const kCTFontTableFvar: c_uint = 0x66766172;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablegasp?language=objc)
pub const kCTFontTableGasp: c_uint = 0x67617370;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableglyf?language=objc)
pub const kCTFontTableGlyf: c_uint = 0x676c7966;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablegvar?language=objc)
pub const kCTFontTableGvar: c_uint = 0x67766172;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablehdmx?language=objc)
pub const kCTFontTableHdmx: c_uint = 0x68646d78;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablehead?language=objc)
pub const kCTFontTableHead: c_uint = 0x68656164;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablehhea?language=objc)
pub const kCTFontTableHhea: c_uint = 0x68686561;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablehmtx?language=objc)
pub const kCTFontTableHmtx: c_uint = 0x686d7478;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablehsty?language=objc)
pub const kCTFontTableHsty: c_uint = 0x68737479;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablejust?language=objc)
pub const kCTFontTableJust: c_uint = 0x6a757374;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablekern?language=objc)
pub const kCTFontTableKern: c_uint = 0x6b65726e;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablekerx?language=objc)
pub const kCTFontTableKerx: c_uint = 0x6b657278;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablelcar?language=objc)
pub const kCTFontTableLcar: c_uint = 0x6c636172;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableloca?language=objc)
pub const kCTFontTableLoca: c_uint = 0x6c6f6361;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableltag?language=objc)
pub const kCTFontTableLtag: c_uint = 0x6c746167;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablemaxp?language=objc)
pub const kCTFontTableMaxp: c_uint = 0x6d617870;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablemeta?language=objc)
pub const kCTFontTableMeta: c_uint = 0x6d657461;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablemort?language=objc)
pub const kCTFontTableMort: c_uint = 0x6d6f7274;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablemorx?language=objc)
pub const kCTFontTableMorx: c_uint = 0x6d6f7278;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablename?language=objc)
pub const kCTFontTableName: c_uint = 0x6e616d65;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableopbd?language=objc)
pub const kCTFontTableOpbd: c_uint = 0x6f706264;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablepost?language=objc)
pub const kCTFontTablePost: c_uint = 0x706f7374;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableprep?language=objc)
pub const kCTFontTablePrep: c_uint = 0x70726570;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableprop?language=objc)
pub const kCTFontTableProp: c_uint = 0x70726f70;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablesbit?language=objc)
pub const kCTFontTableSbit: c_uint = 0x73626974;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablesbix?language=objc)
pub const kCTFontTableSbix: c_uint = 0x73626978;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttabletrak?language=objc)
pub const kCTFontTableTrak: c_uint = 0x7472616b;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablevhea?language=objc)
pub const kCTFontTableVhea: c_uint = 0x76686561;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablevmtx?language=objc)
pub const kCTFontTableVmtx: c_uint = 0x766d7478;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablexref?language=objc)
pub const kCTFontTableXref: c_uint = 0x78726566;

/// [Apple's documentation](https://developer.apple.com/documentation/coretext/ctfonttabletag?language=objc)
pub type CTFontTableTag = FourCharCode;

/// [Apple's documentation](https://developer.apple.com/documentation/coretext/ctfonttableoptions?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CTFontTableOptions(pub u32);
bitflags::bitflags! {
    impl CTFontTableOptions: u32 {
        #[doc(alias = "kCTFontTableOptionNoOptions")]
        const NoOptions = 0;
        #[doc(alias = "kCTFontTableOptionExcludeSynthetic")]
#[deprecated = "Unsupported"]
        const ExcludeSynthetic = 1<<0;
    }
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CTFontTableOptions {
    const ENCODING: Encoding = u32::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CTFontTableOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

impl CTFont {
    /// Returns an array of font table tags.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Parameter `options`: The options used when copying font tables.
    ///
    ///
    /// Returns: This function returns an array of CTFontTableTag values for the given font and the supplied options. The returned set will contain unboxed values, which may be extracted like so:
    /// <code>
    /// CTFontTableTag tag = (CTFontTableTag)(uintptr_t)CFArrayGetValueAtIndex(tags, index);
    /// </code>
    #[doc(alias = "CTFontCopyAvailableTables")]
    #[inline]
    pub unsafe fn available_tables(
        &self,
        options: CTFontTableOptions,
    ) -> Option<CFRetained<CFArray>> {
        extern "C-unwind" {
            fn CTFontCopyAvailableTables(
                font: &CTFont,
                options: CTFontTableOptions,
            ) -> Option<NonNull<CFArray>>;
        }
        let ret = unsafe { CTFontCopyAvailableTables(self, options) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// Determine whether a table is present in a font.
    ///
    /// This is a convenience function to avoid requesting an array of table tags or any table data. It behaves according as if using `kCTFontTableOptionNoOptions`.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Parameter `tag`: The font table identifier as a CTFontTableTag.
    ///
    ///
    /// Returns: Returns true if the call was successful and the requested table is present.
    #[doc(alias = "CTFontHasTable")]
    #[inline]
    pub unsafe fn has_table(&self, tag: CTFontTableTag) -> bool {
        extern "C-unwind" {
            fn CTFontHasTable(font: &CTFont, tag: CTFontTableTag) -> bool;
        }
        unsafe { CTFontHasTable(self, tag) }
    }

    /// Returns a reference to the font table data.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Parameter `table`: The font table identifier as a CTFontTableTag.
    ///
    ///
    /// Parameter `options`: The options used when copying font table.
    ///
    ///
    /// Returns: This function returns a retained reference to the font table data as CFDataRef or NULL if the table is not present.
    #[doc(alias = "CTFontCopyTable")]
    #[inline]
    pub unsafe fn table(
        &self,
        table: CTFontTableTag,
        options: CTFontTableOptions,
    ) -> Option<CFRetained<CFData>> {
        extern "C-unwind" {
            fn CTFontCopyTable(
                font: &CTFont,
                table: CTFontTableTag,
                options: CTFontTableOptions,
            ) -> Option<NonNull<CFData>>;
        }
        let ret = unsafe { CTFontCopyTable(self, table, options) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// Renders the given glyphs from the CTFont at the given positions in the CGContext.
    ///
    /// This function will modify the CGContext's font, text size, and text matrix if specified in the CTFont. These attributes will not be restored.
    /// The given glyphs should be the result of proper Unicode text layout operations (such as CTLine). Results from CTFontGetGlyphsForCharacters (or similar APIs) do not perform any Unicode text layout.
    ///
    ///
    /// Parameter `font`: The font to render glyphs from. If the font has a size or matrix attribute, the CGContext will be set with these values.
    ///
    ///
    /// Parameter `glyphs`: The glyphs to be rendered. See above discussion of how the glyphs should be derived.
    ///
    ///
    /// Parameter `positions`: The positions (origins) for each glyph. The positions are in user space. The number of positions passed in must be equivalent to the number of glyphs.
    ///
    ///
    /// Parameter `count`: The number of glyphs to be rendered from the glyphs array.
    ///
    ///
    /// Parameter `context`: CGContext used to render the glyphs.
    ///
    /// # Safety
    ///
    /// - `glyphs` must be a valid pointer.
    /// - `positions` must be a valid pointer.
    #[doc(alias = "CTFontDrawGlyphs")]
    #[cfg(feature = "objc2-core-graphics")]
    #[inline]
    pub unsafe fn draw_glyphs(
        &self,
        glyphs: NonNull<CGGlyph>,
        positions: NonNull<CGPoint>,
        count: usize,
        context: &CGContext,
    ) {
        extern "C-unwind" {
            fn CTFontDrawGlyphs(
                font: &CTFont,
                glyphs: NonNull<CGGlyph>,
                positions: NonNull<CGPoint>,
                count: usize,
                context: &CGContext,
            );
        }
        unsafe { CTFontDrawGlyphs(self, glyphs, positions, count, context) }
    }

    /// Returns caret positions within a glyph.
    ///
    /// This function is used to obtain caret positions for a specific glyph.
    /// The return value is the max number of positions possible, and the function
    /// will populate the caller's positions buffer with available positions if possible.
    /// This function may not be able to produce positions if the font does not
    /// have the appropriate data, in which case it will return 0.
    ///
    ///
    /// Parameter `font`: The font reference.
    ///
    ///
    /// Parameter `glyph`: The glyph.
    ///
    ///
    /// Parameter `positions`: A buffer of at least maxPositions to receive the ligature caret positions for
    /// the glyph.
    ///
    ///
    /// Parameter `maxPositions`: The maximum number of positions to return.
    ///
    ///
    /// Returns: Returns the number of caret positions for the specified glyph.
    ///
    /// # Safety
    ///
    /// `positions` must be a valid pointer or null.
    #[doc(alias = "CTFontGetLigatureCaretPositions")]
    #[cfg(feature = "objc2-core-graphics")]
    #[inline]
    pub unsafe fn ligature_caret_positions(
        &self,
        glyph: CGGlyph,
        positions: *mut CGFloat,
        max_positions: CFIndex,
    ) -> CFIndex {
        extern "C-unwind" {
            fn CTFontGetLigatureCaretPositions(
                font: &CTFont,
                glyph: CGGlyph,
                positions: *mut CGFloat,
                max_positions: CFIndex,
            ) -> CFIndex;
        }
        unsafe { CTFontGetLigatureCaretPositions(self, glyph, positions, max_positions) }
    }
}

extern "C" {
    /// kCTBaselineClassRoman
    ///
    ///
    /// Key to reference the Roman baseline class.
    ///
    ///
    /// This key can be used with a baseline info dictionary to offset to the Roman baseline as a CFNumberRef float. It can also be used as the value for kCTBaselineClassAttributeName.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineclassroman?language=objc)
    pub static kCTBaselineClassRoman: &'static CFString;
}

extern "C" {
    /// kCTBaselineClassIdeographicCentered
    ///
    ///
    /// Key to reference the Ideographic Centered baseline class.
    ///
    ///
    /// This key can be used with a baseline info dictionary to offset to the Ideographic Centered baseline as a CFNumberRef float. It can also be used as the value for kCTBaselineClassAttributeName.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineclassideographiccentered?language=objc)
    pub static kCTBaselineClassIdeographicCentered: &'static CFString;
}

extern "C" {
    /// kCTBaselineClassIdeographicLow
    ///
    ///
    /// Key to reference the Ideographic Low baseline class.
    ///
    ///
    /// This key can be used with a baseline info dictionary to offset to the Ideographic Low baseline as a CFNumberRef float. It can also be used as the value for kCTBaselineClassAttributeName.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineclassideographiclow?language=objc)
    pub static kCTBaselineClassIdeographicLow: &'static CFString;
}

extern "C" {
    /// kCTBaselineClassIdeographicHigh
    ///
    ///
    /// Key to reference the Ideographic High baseline class.
    ///
    ///
    /// This key can be used with a baseline info dictionary to offset to the Ideographic High baseline as a CFNumberRef float. It can also be used as the value for kCTBaselineClassAttributeName.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineclassideographichigh?language=objc)
    pub static kCTBaselineClassIdeographicHigh: &'static CFString;
}

extern "C" {
    /// kCTBaselineClassHanging
    ///
    ///
    /// Key to reference the Hanging baseline class.
    ///
    ///
    /// This key can be used with a baseline info dictionary to offset to the Hanging baseline as a CFNumberRef float. It can also be used as the value for kCTBaselineClassAttributeName.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineclasshanging?language=objc)
    pub static kCTBaselineClassHanging: &'static CFString;
}

extern "C" {
    /// kCTBaselineClassMath
    ///
    ///
    /// Key to reference the Math baseline class.
    ///
    ///
    /// This key can be used with a baseline info dictionary to offset to the Math baseline as a CFNumberRef float. It can also be used as the value for kCTBaselineClassAttributeName.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineclassmath?language=objc)
    pub static kCTBaselineClassMath: &'static CFString;
}

extern "C" {
    /// kCTBaselineReferenceFont
    ///
    ///
    /// Key to reference a font for the reference baseline.
    ///
    ///
    /// This key can be used to specify a font for the reference baseline. The value is a CTFontRef or the kCTBaselineOriginalFont constant.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselinereferencefont?language=objc)
    pub static kCTBaselineReferenceFont: &'static CFString;
}

extern "C" {
    /// kCTBaselineOriginalFont
    ///
    ///
    /// Use the original font for setting the reference baseline.
    ///
    ///
    /// This constant can be used as the value for kCTBaselineReferenceFont to specify that the original font should be used for the reference baseline.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineoriginalfont?language=objc)
    pub static kCTBaselineOriginalFont: &'static CFString;
}

impl CTFont {
    #[doc(alias = "CTFontGetTypographicBoundsForAdaptiveImageProvider")]
    #[cfg(all(feature = "CTRunDelegate", feature = "objc2"))]
    #[inline]
    pub unsafe fn typographic_bounds_for_adaptive_image_provider(
        &self,
        provider: Option<&ProtocolObject<dyn CTAdaptiveImageProviding>>,
    ) -> CGRect {
        extern "C-unwind" {
            fn CTFontGetTypographicBoundsForAdaptiveImageProvider(
                font: &CTFont,
                provider: Option<&ProtocolObject<dyn CTAdaptiveImageProviding>>,
            ) -> CGRect;
        }
        unsafe { CTFontGetTypographicBoundsForAdaptiveImageProvider(self, provider) }
    }

    #[doc(alias = "CTFontDrawImageFromAdaptiveImageProviderAtPoint")]
    #[cfg(all(
        feature = "CTRunDelegate",
        feature = "objc2",
        feature = "objc2-core-graphics"
    ))]
    #[inline]
    pub unsafe fn draw_image_from_adaptive_image_provider_at_point(
        &self,
        provider: &ProtocolObject<dyn CTAdaptiveImageProviding>,
        point: CGPoint,
        context: &CGContext,
    ) {
        extern "C-unwind" {
            fn CTFontDrawImageFromAdaptiveImageProviderAtPoint(
                font: &CTFont,
                provider: &ProtocolObject<dyn CTAdaptiveImageProviding>,
                point: CGPoint,
                context: &CGContext,
            );
        }
        unsafe { CTFontDrawImageFromAdaptiveImageProviderAtPoint(self, provider, point, context) }
    }
}

#[deprecated = "renamed to `CTFont::with_name`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCreateWithName(
    name: &CFString,
    size: CGFloat,
    matrix: *const CGAffineTransform,
) -> CFRetained<CTFont> {
    extern "C-unwind" {
        fn CTFontCreateWithName(
            name: &CFString,
            size: CGFloat,
            matrix: *const CGAffineTransform,
        ) -> Option<NonNull<CTFont>>;
    }
    let ret = unsafe { CTFontCreateWithName(name, size, matrix) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

#[cfg(feature = "CTFontDescriptor")]
#[deprecated = "renamed to `CTFont::with_font_descriptor`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCreateWithFontDescriptor(
    descriptor: &CTFontDescriptor,
    size: CGFloat,
    matrix: *const CGAffineTransform,
) -> CFRetained<CTFont> {
    extern "C-unwind" {
        fn CTFontCreateWithFontDescriptor(
            descriptor: &CTFontDescriptor,
            size: CGFloat,
            matrix: *const CGAffineTransform,
        ) -> Option<NonNull<CTFont>>;
    }
    let ret = unsafe { CTFontCreateWithFontDescriptor(descriptor, size, matrix) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

#[deprecated = "renamed to `CTFont::with_name_and_options`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCreateWithNameAndOptions(
    name: &CFString,
    size: CGFloat,
    matrix: *const CGAffineTransform,
    options: CTFontOptions,
) -> CFRetained<CTFont> {
    extern "C-unwind" {
        fn CTFontCreateWithNameAndOptions(
            name: &CFString,
            size: CGFloat,
            matrix: *const CGAffineTransform,
            options: CTFontOptions,
        ) -> Option<NonNull<CTFont>>;
    }
    let ret = unsafe { CTFontCreateWithNameAndOptions(name, size, matrix, options) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

#[cfg(feature = "CTFontDescriptor")]
#[deprecated = "renamed to `CTFont::with_font_descriptor_and_options`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCreateWithFontDescriptorAndOptions(
    descriptor: &CTFontDescriptor,
    size: CGFloat,
    matrix: *const CGAffineTransform,
    options: CTFontOptions,
) -> CFRetained<CTFont> {
    extern "C-unwind" {
        fn CTFontCreateWithFontDescriptorAndOptions(
            descriptor: &CTFontDescriptor,
            size: CGFloat,
            matrix: *const CGAffineTransform,
            options: CTFontOptions,
        ) -> Option<NonNull<CTFont>>;
    }
    let ret =
        unsafe { CTFontCreateWithFontDescriptorAndOptions(descriptor, size, matrix, options) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

#[deprecated = "renamed to `CTFont::new_ui_font_for_language`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCreateUIFontForLanguage(
    ui_type: CTFontUIFontType,
    size: CGFloat,
    language: Option<&CFString>,
) -> Option<CFRetained<CTFont>> {
    extern "C-unwind" {
        fn CTFontCreateUIFontForLanguage(
            ui_type: CTFontUIFontType,
            size: CGFloat,
            language: Option<&CFString>,
        ) -> Option<NonNull<CTFont>>;
    }
    let ret = unsafe { CTFontCreateUIFontForLanguage(ui_type, size, language) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

#[cfg(feature = "CTFontDescriptor")]
#[deprecated = "renamed to `CTFont::copy_with_attributes`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCreateCopyWithAttributes(
    font: &CTFont,
    size: CGFloat,
    matrix: *const CGAffineTransform,
    attributes: Option<&CTFontDescriptor>,
) -> CFRetained<CTFont> {
    extern "C-unwind" {
        fn CTFontCreateCopyWithAttributes(
            font: &CTFont,
            size: CGFloat,
            matrix: *const CGAffineTransform,
            attributes: Option<&CTFontDescriptor>,
        ) -> Option<NonNull<CTFont>>;
    }
    let ret = unsafe { CTFontCreateCopyWithAttributes(font, size, matrix, attributes) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

#[cfg(feature = "CTFontTraits")]
#[deprecated = "renamed to `CTFont::copy_with_symbolic_traits`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCreateCopyWithSymbolicTraits(
    font: &CTFont,
    size: CGFloat,
    matrix: *const CGAffineTransform,
    sym_trait_value: CTFontSymbolicTraits,
    sym_trait_mask: CTFontSymbolicTraits,
) -> Option<CFRetained<CTFont>> {
    extern "C-unwind" {
        fn CTFontCreateCopyWithSymbolicTraits(
            font: &CTFont,
            size: CGFloat,
            matrix: *const CGAffineTransform,
            sym_trait_value: CTFontSymbolicTraits,
            sym_trait_mask: CTFontSymbolicTraits,
        ) -> Option<NonNull<CTFont>>;
    }
    let ret = unsafe {
        CTFontCreateCopyWithSymbolicTraits(font, size, matrix, sym_trait_value, sym_trait_mask)
    };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

#[deprecated = "renamed to `CTFont::copy_with_family`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCreateCopyWithFamily(
    font: &CTFont,
    size: CGFloat,
    matrix: *const CGAffineTransform,
    family: &CFString,
) -> Option<CFRetained<CTFont>> {
    extern "C-unwind" {
        fn CTFontCreateCopyWithFamily(
            font: &CTFont,
            size: CGFloat,
            matrix: *const CGAffineTransform,
            family: &CFString,
        ) -> Option<NonNull<CTFont>>;
    }
    let ret = unsafe { CTFontCreateCopyWithFamily(font, size, matrix, family) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

#[deprecated = "renamed to `CTFont::for_string`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCreateForString(
    current_font: &CTFont,
    string: &CFString,
    range: CFRange,
) -> CFRetained<CTFont> {
    extern "C-unwind" {
        fn CTFontCreateForString(
            current_font: &CTFont,
            string: &CFString,
            range: CFRange,
        ) -> Option<NonNull<CTFont>>;
    }
    let ret = unsafe { CTFontCreateForString(current_font, string, range) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

#[deprecated = "renamed to `CTFont::for_string_with_language`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCreateForStringWithLanguage(
    current_font: &CTFont,
    string: &CFString,
    range: CFRange,
    language: Option<&CFString>,
) -> CFRetained<CTFont> {
    extern "C-unwind" {
        fn CTFontCreateForStringWithLanguage(
            current_font: &CTFont,
            string: &CFString,
            range: CFRange,
            language: Option<&CFString>,
        ) -> Option<NonNull<CTFont>>;
    }
    let ret = unsafe { CTFontCreateForStringWithLanguage(current_font, string, range, language) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

#[cfg(feature = "CTFontDescriptor")]
#[deprecated = "renamed to `CTFont::font_descriptor`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyFontDescriptor(
    font: &CTFont,
) -> CFRetained<CTFontDescriptor> {
    extern "C-unwind" {
        fn CTFontCopyFontDescriptor(font: &CTFont) -> Option<NonNull<CTFontDescriptor>>;
    }
    let ret = unsafe { CTFontCopyFontDescriptor(font) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

#[deprecated = "renamed to `CTFont::attribute`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyAttribute(
    font: &CTFont,
    attribute: &CFString,
) -> Option<CFRetained<CFType>> {
    extern "C-unwind" {
        fn CTFontCopyAttribute(font: &CTFont, attribute: &CFString) -> Option<NonNull<CFType>>;
    }
    let ret = unsafe { CTFontCopyAttribute(font, attribute) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

extern "C-unwind" {
    #[deprecated = "renamed to `CTFont::size`"]
    pub fn CTFontGetSize(font: &CTFont) -> CGFloat;
}

extern "C-unwind" {
    #[deprecated = "renamed to `CTFont::matrix`"]
    pub fn CTFontGetMatrix(font: &CTFont) -> CGAffineTransform;
}

extern "C-unwind" {
    #[cfg(feature = "CTFontTraits")]
    #[deprecated = "renamed to `CTFont::symbolic_traits`"]
    pub fn CTFontGetSymbolicTraits(font: &CTFont) -> CTFontSymbolicTraits;
}

#[deprecated = "renamed to `CTFont::traits`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyTraits(font: &CTFont) -> CFRetained<CFDictionary> {
    extern "C-unwind" {
        fn CTFontCopyTraits(font: &CTFont) -> Option<NonNull<CFDictionary>>;
    }
    let ret = unsafe { CTFontCopyTraits(font) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

#[deprecated = "renamed to `CTFont::default_cascade_list_for_languages`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyDefaultCascadeListForLanguages(
    font: &CTFont,
    language_pref_list: Option<&CFArray>,
) -> Option<CFRetained<CFArray>> {
    extern "C-unwind" {
        fn CTFontCopyDefaultCascadeListForLanguages(
            font: &CTFont,
            language_pref_list: Option<&CFArray>,
        ) -> Option<NonNull<CFArray>>;
    }
    let ret = unsafe { CTFontCopyDefaultCascadeListForLanguages(font, language_pref_list) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

#[deprecated = "renamed to `CTFont::post_script_name`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyPostScriptName(font: &CTFont) -> CFRetained<CFString> {
    extern "C-unwind" {
        fn CTFontCopyPostScriptName(font: &CTFont) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { CTFontCopyPostScriptName(font) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

#[deprecated = "renamed to `CTFont::family_name`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyFamilyName(font: &CTFont) -> CFRetained<CFString> {
    extern "C-unwind" {
        fn CTFontCopyFamilyName(font: &CTFont) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { CTFontCopyFamilyName(font) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

#[deprecated = "renamed to `CTFont::full_name`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyFullName(font: &CTFont) -> CFRetained<CFString> {
    extern "C-unwind" {
        fn CTFontCopyFullName(font: &CTFont) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { CTFontCopyFullName(font) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

#[deprecated = "renamed to `CTFont::display_name`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyDisplayName(font: &CTFont) -> CFRetained<CFString> {
    extern "C-unwind" {
        fn CTFontCopyDisplayName(font: &CTFont) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { CTFontCopyDisplayName(font) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

#[deprecated = "renamed to `CTFont::name`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyName(
    font: &CTFont,
    name_key: &CFString,
) -> Option<CFRetained<CFString>> {
    extern "C-unwind" {
        fn CTFontCopyName(font: &CTFont, name_key: &CFString) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { CTFontCopyName(font, name_key) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

#[deprecated = "renamed to `CTFont::localized_name`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyLocalizedName(
    font: &CTFont,
    name_key: &CFString,
    actual_language: *mut *const CFString,
) -> Option<CFRetained<CFString>> {
    extern "C-unwind" {
        fn CTFontCopyLocalizedName(
            font: &CTFont,
            name_key: &CFString,
            actual_language: *mut *const CFString,
        ) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { CTFontCopyLocalizedName(font, name_key, actual_language) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

#[deprecated = "renamed to `CTFont::character_set`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyCharacterSet(
    font: &CTFont,
) -> CFRetained<CFCharacterSet> {
    extern "C-unwind" {
        fn CTFontCopyCharacterSet(font: &CTFont) -> Option<NonNull<CFCharacterSet>>;
    }
    let ret = unsafe { CTFontCopyCharacterSet(font) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

extern "C-unwind" {
    #[deprecated = "renamed to `CTFont::string_encoding`"]
    pub fn CTFontGetStringEncoding(font: &CTFont) -> CFStringEncoding;
}

#[deprecated = "renamed to `CTFont::supported_languages`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopySupportedLanguages(font: &CTFont) -> CFRetained<CFArray> {
    extern "C-unwind" {
        fn CTFontCopySupportedLanguages(font: &CTFont) -> Option<NonNull<CFArray>>;
    }
    let ret = unsafe { CTFontCopySupportedLanguages(font) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

extern "C-unwind" {
    #[cfg(feature = "objc2-core-graphics")]
    #[deprecated = "renamed to `CTFont::glyphs_for_characters`"]
    pub fn CTFontGetGlyphsForCharacters(
        font: &CTFont,
        characters: NonNull<UniChar>,
        glyphs: NonNull<CGGlyph>,
        count: CFIndex,
    ) -> bool;
}

extern "C-unwind" {
    #[deprecated = "renamed to `CTFont::ascent`"]
    pub fn CTFontGetAscent(font: &CTFont) -> CGFloat;
}

extern "C-unwind" {
    #[deprecated = "renamed to `CTFont::descent`"]
    pub fn CTFontGetDescent(font: &CTFont) -> CGFloat;
}

extern "C-unwind" {
    #[deprecated = "renamed to `CTFont::leading`"]
    pub fn CTFontGetLeading(font: &CTFont) -> CGFloat;
}

extern "C-unwind" {
    #[deprecated = "renamed to `CTFont::units_per_em`"]
    pub fn CTFontGetUnitsPerEm(font: &CTFont) -> c_uint;
}

extern "C-unwind" {
    #[deprecated = "renamed to `CTFont::glyph_count`"]
    pub fn CTFontGetGlyphCount(font: &CTFont) -> CFIndex;
}

extern "C-unwind" {
    #[deprecated = "renamed to `CTFont::bounding_box`"]
    pub fn CTFontGetBoundingBox(font: &CTFont) -> CGRect;
}

extern "C-unwind" {
    #[deprecated = "renamed to `CTFont::underline_position`"]
    pub fn CTFontGetUnderlinePosition(font: &CTFont) -> CGFloat;
}

extern "C-unwind" {
    #[deprecated = "renamed to `CTFont::underline_thickness`"]
    pub fn CTFontGetUnderlineThickness(font: &CTFont) -> CGFloat;
}

extern "C-unwind" {
    #[deprecated = "renamed to `CTFont::slant_angle`"]
    pub fn CTFontGetSlantAngle(font: &CTFont) -> CGFloat;
}

extern "C-unwind" {
    #[deprecated = "renamed to `CTFont::cap_height`"]
    pub fn CTFontGetCapHeight(font: &CTFont) -> CGFloat;
}

extern "C-unwind" {
    #[deprecated = "renamed to `CTFont::x_height`"]
    pub fn CTFontGetXHeight(font: &CTFont) -> CGFloat;
}

extern "C-unwind" {
    #[cfg(feature = "objc2-core-graphics")]
    #[deprecated = "renamed to `CTFont::glyph_with_name`"]
    pub fn CTFontGetGlyphWithName(font: &CTFont, glyph_name: &CFString) -> CGGlyph;
}

#[cfg(feature = "objc2-core-graphics")]
#[deprecated = "renamed to `CTFont::name_for_glyph`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyNameForGlyph(
    font: &CTFont,
    glyph: CGGlyph,
) -> Option<CFRetained<CFString>> {
    extern "C-unwind" {
        fn CTFontCopyNameForGlyph(font: &CTFont, glyph: CGGlyph) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { CTFontCopyNameForGlyph(font, glyph) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

extern "C-unwind" {
    #[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
    #[deprecated = "renamed to `CTFont::bounding_rects_for_glyphs`"]
    pub fn CTFontGetBoundingRectsForGlyphs(
        font: &CTFont,
        orientation: CTFontOrientation,
        glyphs: NonNull<CGGlyph>,
        bounding_rects: *mut CGRect,
        count: CFIndex,
    ) -> CGRect;
}

extern "C-unwind" {
    #[cfg(feature = "objc2-core-graphics")]
    #[deprecated = "renamed to `CTFont::optical_bounds_for_glyphs`"]
    pub fn CTFontGetOpticalBoundsForGlyphs(
        font: &CTFont,
        glyphs: NonNull<CGGlyph>,
        bounding_rects: *mut CGRect,
        count: CFIndex,
        options: CFOptionFlags,
    ) -> CGRect;
}

extern "C-unwind" {
    #[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
    #[deprecated = "renamed to `CTFont::advances_for_glyphs`"]
    pub fn CTFontGetAdvancesForGlyphs(
        font: &CTFont,
        orientation: CTFontOrientation,
        glyphs: NonNull<CGGlyph>,
        advances: *mut CGSize,
        count: CFIndex,
    ) -> c_double;
}

extern "C-unwind" {
    #[cfg(feature = "objc2-core-graphics")]
    #[deprecated = "renamed to `CTFont::vertical_translations_for_glyphs`"]
    pub fn CTFontGetVerticalTranslationsForGlyphs(
        font: &CTFont,
        glyphs: NonNull<CGGlyph>,
        translations: NonNull<CGSize>,
        count: CFIndex,
    );
}

#[cfg(feature = "objc2-core-graphics")]
#[deprecated = "renamed to `CTFont::path_for_glyph`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCreatePathForGlyph(
    font: &CTFont,
    glyph: CGGlyph,
    matrix: *const CGAffineTransform,
) -> Option<CFRetained<CGPath>> {
    extern "C-unwind" {
        fn CTFontCreatePathForGlyph(
            font: &CTFont,
            glyph: CGGlyph,
            matrix: *const CGAffineTransform,
        ) -> Option<NonNull<CGPath>>;
    }
    let ret = unsafe { CTFontCreatePathForGlyph(font, glyph, matrix) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

#[deprecated = "renamed to `CTFont::variation_axes`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyVariationAxes(
    font: &CTFont,
) -> Option<CFRetained<CFArray>> {
    extern "C-unwind" {
        fn CTFontCopyVariationAxes(font: &CTFont) -> Option<NonNull<CFArray>>;
    }
    let ret = unsafe { CTFontCopyVariationAxes(font) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

#[deprecated = "renamed to `CTFont::variation`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyVariation(
    font: &CTFont,
) -> Option<CFRetained<CFDictionary>> {
    extern "C-unwind" {
        fn CTFontCopyVariation(font: &CTFont) -> Option<NonNull<CFDictionary>>;
    }
    let ret = unsafe { CTFontCopyVariation(font) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

#[deprecated = "renamed to `CTFont::features`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyFeatures(font: &CTFont) -> Option<CFRetained<CFArray>> {
    extern "C-unwind" {
        fn CTFontCopyFeatures(font: &CTFont) -> Option<NonNull<CFArray>>;
    }
    let ret = unsafe { CTFontCopyFeatures(font) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

#[deprecated = "renamed to `CTFont::feature_settings`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyFeatureSettings(
    font: &CTFont,
) -> Option<CFRetained<CFArray>> {
    extern "C-unwind" {
        fn CTFontCopyFeatureSettings(font: &CTFont) -> Option<NonNull<CFArray>>;
    }
    let ret = unsafe { CTFontCopyFeatureSettings(font) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

#[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
#[deprecated = "renamed to `CTFont::graphics_font`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyGraphicsFont(
    font: &CTFont,
    attributes: *mut *const CTFontDescriptor,
) -> CFRetained<CGFont> {
    extern "C-unwind" {
        fn CTFontCopyGraphicsFont(
            font: &CTFont,
            attributes: *mut *const CTFontDescriptor,
        ) -> Option<NonNull<CGFont>>;
    }
    let ret = unsafe { CTFontCopyGraphicsFont(font, attributes) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

#[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
#[deprecated = "renamed to `CTFont::with_graphics_font`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCreateWithGraphicsFont(
    graphics_font: &CGFont,
    size: CGFloat,
    matrix: *const CGAffineTransform,
    attributes: Option<&CTFontDescriptor>,
) -> CFRetained<CTFont> {
    extern "C-unwind" {
        fn CTFontCreateWithGraphicsFont(
            graphics_font: &CGFont,
            size: CGFloat,
            matrix: *const CGAffineTransform,
            attributes: Option<&CTFontDescriptor>,
        ) -> Option<NonNull<CTFont>>;
    }
    let ret = unsafe { CTFontCreateWithGraphicsFont(graphics_font, size, matrix, attributes) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

#[deprecated = "renamed to `CTFont::with_quickdraw_instance`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCreateWithQuickdrawInstance(
    name: ConstStr255Param,
    identifier: i16,
    style: u8,
    size: CGFloat,
) -> CFRetained<CTFont> {
    extern "C-unwind" {
        fn CTFontCreateWithQuickdrawInstance(
            name: ConstStr255Param,
            identifier: i16,
            style: u8,
            size: CGFloat,
        ) -> Option<NonNull<CTFont>>;
    }
    let ret = unsafe { CTFontCreateWithQuickdrawInstance(name, identifier, style, size) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

#[deprecated = "renamed to `CTFont::available_tables`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyAvailableTables(
    font: &CTFont,
    options: CTFontTableOptions,
) -> Option<CFRetained<CFArray>> {
    extern "C-unwind" {
        fn CTFontCopyAvailableTables(
            font: &CTFont,
            options: CTFontTableOptions,
        ) -> Option<NonNull<CFArray>>;
    }
    let ret = unsafe { CTFontCopyAvailableTables(font, options) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

extern "C-unwind" {
    #[deprecated = "renamed to `CTFont::has_table`"]
    pub fn CTFontHasTable(font: &CTFont, tag: CTFontTableTag) -> bool;
}

#[deprecated = "renamed to `CTFont::table`"]
#[inline]
pub unsafe extern "C-unwind" fn CTFontCopyTable(
    font: &CTFont,
    table: CTFontTableTag,
    options: CTFontTableOptions,
) -> Option<CFRetained<CFData>> {
    extern "C-unwind" {
        fn CTFontCopyTable(
            font: &CTFont,
            table: CTFontTableTag,
            options: CTFontTableOptions,
        ) -> Option<NonNull<CFData>>;
    }
    let ret = unsafe { CTFontCopyTable(font, table, options) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

extern "C-unwind" {
    #[cfg(feature = "objc2-core-graphics")]
    #[deprecated = "renamed to `CTFont::draw_glyphs`"]
    pub fn CTFontDrawGlyphs(
        font: &CTFont,
        glyphs: NonNull<CGGlyph>,
        positions: NonNull<CGPoint>,
        count: usize,
        context: &CGContext,
    );
}

extern "C-unwind" {
    #[cfg(feature = "objc2-core-graphics")]
    #[deprecated = "renamed to `CTFont::ligature_caret_positions`"]
    pub fn CTFontGetLigatureCaretPositions(
        font: &CTFont,
        glyph: CGGlyph,
        positions: *mut CGFloat,
        max_positions: CFIndex,
    ) -> CFIndex;
}

extern "C-unwind" {
    #[cfg(all(feature = "CTRunDelegate", feature = "objc2"))]
    #[deprecated = "renamed to `CTFont::typographic_bounds_for_adaptive_image_provider`"]
    pub fn CTFontGetTypographicBoundsForAdaptiveImageProvider(
        font: &CTFont,
        provider: Option<&ProtocolObject<dyn CTAdaptiveImageProviding>>,
    ) -> CGRect;
}

extern "C-unwind" {
    #[cfg(all(
        feature = "CTRunDelegate",
        feature = "objc2",
        feature = "objc2-core-graphics"
    ))]
    #[deprecated = "renamed to `CTFont::draw_image_from_adaptive_image_provider_at_point`"]
    pub fn CTFontDrawImageFromAdaptiveImageProviderAtPoint(
        font: &CTFont,
        provider: &ProtocolObject<dyn CTAdaptiveImageProviding>,
        point: CGPoint,
        context: &CGContext,
    );
}