-
Notifications
You must be signed in to change notification settings - Fork 559
Expand file tree
/
Copy pathCTFont.cs
More file actions
3695 lines (3395 loc) · 128 KB
/
CTFont.cs
File metadata and controls
3695 lines (3395 loc) · 128 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//
// CTFont.cs: Implements the managed CTFont
//
// Authors: Mono Team
// Marek Safar (marek.safar@gmail.com)
// Rolf Bjarne Kvinge <rolf@xamarin.com>
//
// Copyright 2010 Novell, Inc
// Copyright 2011 - 2014 Xamarin Inc
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#nullable enable
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using CoreFoundation;
using CoreGraphics;
using CGGlyph = System.UInt16;
namespace CoreText {
/// <summary>Options used when creating new instances of the <see cref="CoreText.CTFont" /> class.</summary>
/// <remarks>
/// </remarks>
[Flags]
[Native]
// defined as CFOptionFlags (unsigned long [long] = nuint) - /System/Library/Frameworks/CoreText.framework/Headers/CTFont.h
public enum CTFontOptions : ulong {
/// <summary>Use default options.</summary>
Default = 0,
/// <summary>Prevents font activation.</summary>
PreventAutoActivation = 1 << 0,
[SupportedOSPlatform ("tvos16.0")]
[SupportedOSPlatform ("macos13.0")]
[SupportedOSPlatform ("ios16.0")]
[SupportedOSPlatform ("maccatalyst16.0")]
PreventAutoDownload = 1 << 1,
/// <summary>Give preferences to Apple/System fonts.</summary>
PreferSystemFont = 1 << 2,
}
// defined as uint32_t - /System/Library/Frameworks/CoreText.framework/Headers/CTFont.h
/// <summary>An enumeration whose values specify the intended use of a font. Used with <see cref="CTFont.CTFont(CTFontUIFontType, nfloat, System.String)" /></summary>
/// <remarks>To be added.</remarks>
public enum CTFontUIFontType : uint {
/// <summary>To be added.</summary>
None = unchecked((uint) (-1)),
/// <summary>To be added.</summary>
User = 0,
/// <summary>To be added.</summary>
UserFixedPitch = 1,
/// <summary>To be added.</summary>
System = 2,
/// <summary>To be added.</summary>
EmphasizedSystem = 3,
/// <summary>To be added.</summary>
SmallSystem = 4,
/// <summary>To be added.</summary>
SmallEmphasizedSystem = 5,
/// <summary>To be added.</summary>
MiniSystem = 6,
/// <summary>To be added.</summary>
MiniEmphasizedSystem = 7,
/// <summary>To be added.</summary>
Views = 8,
/// <summary>To be added.</summary>
Application = 9,
/// <summary>To be added.</summary>
Label = 10,
/// <summary>To be added.</summary>
MenuTitle = 11,
/// <summary>To be added.</summary>
MenuItem = 12,
/// <summary>To be added.</summary>
MenuItemMark = 13,
/// <summary>To be added.</summary>
MenuItemCmdKey = 14,
/// <summary>To be added.</summary>
WindowTitle = 15,
/// <summary>To be added.</summary>
PushButton = 16,
/// <summary>To be added.</summary>
UtilityWindowTitle = 17,
/// <summary>To be added.</summary>
AlertHeader = 18,
/// <summary>To be added.</summary>
SystemDetail = 19,
/// <summary>To be added.</summary>
EmphasizedSystemDetail = 20,
/// <summary>To be added.</summary>
Toolbar = 21,
/// <summary>To be added.</summary>
SmallToolbar = 22,
/// <summary>To be added.</summary>
Message = 23,
/// <summary>To be added.</summary>
Palette = 24,
/// <summary>To be added.</summary>
ToolTip = 25,
/// <summary>To be added.</summary>
ControlContent = 26,
}
// defined as uint32_t - /System/Library/Frameworks/CoreText.framework/Headers/CTFont.h
/// <summary>An enumeration whose values represent tags for accessing font-table data.</summary>
/// <remarks>To be added.</remarks>
public enum CTFontTable : uint {
/// <summary>To be added.</summary>
BaselineBASE = 0x42415345, // 'BASE'
/// <summary>To be added.</summary>
ColorBitmapData = 0x43424454, // 'CBDT'
/// <summary>To be added.</summary>
ColorBitmapLocationData = 0x43424c43, // 'CBLC'
/// <summary>To be added.</summary>
PostscriptFontProgram = 0x43464620, // 'CFF '
/// <summary>To be added.</summary>
CompactFontFormat2 = 0x43464632, // 'CFF2'
/// <summary>To be added.</summary>
ColorTable = 0x434f4c52, // 'COLR'
/// <summary>To be added.</summary>
ColorPaletteTable = 0x4350414c, // 'CPAL'
/// <summary>To be added.</summary>
DigitalSignature = 0x44534947, // 'DSIG'
/// <summary>To be added.</summary>
EmbeddedBitmap = 0x45424454, // 'EBDT'
/// <summary>To be added.</summary>
EmbeddedBitmapLocation = 0x45424c43, // 'EBLC'
/// <summary>To be added.</summary>
EmbeddedBitmapScaling = 0x45425343, // 'EBSC'
/// <summary>To be added.</summary>
GlyphDefinition = 0x47444546, // 'GDEF'
/// <summary>To be added.</summary>
GlyphPositioning = 0x47504f53, // 'GPOS'
/// <summary>To be added.</summary>
GlyphSubstitution = 0x47535542, // 'GSUB'
/// <summary>To be added.</summary>
HorizontalMetricsVariations = 0x48564152, // 'HVAR'
/// <summary>To be added.</summary>
JustificationJSTF = 0x4a535446, // 'JSTF'
/// <summary>To be added.</summary>
LinearThreshold = 0x4c545348, // 'LTSH'
/// <summary>To be added.</summary>
MathLayoutData = 0x4d415448, // 'MATH'
/// <summary>To be added.</summary>
Merge = 0x4d455247, // 'MERG'
/// <summary>To be added.</summary>
MetricsVariations = 0x4d564152, // 'MVAR'
/// <summary>To be added.</summary>
WindowsSpecificMetrics = 0x4f532f32, // 'OS2 '
/// <summary>To be added.</summary>
Pcl5Data = 0x50434c54, // 'PCLT'
/// <summary>To be added.</summary>
VerticalDeviceMetrics = 0x56444d58, // 'VDMX'
/// <summary>To be added.</summary>
StyleAttributes = 0x53544154, // 'STAT'
/// <summary>To be added.</summary>
ScalableVectorGraphics = 0x53564720, // 'SVG '
/// <summary>To be added.</summary>
VerticalOrigin = 0x564f5247, // 'VORG'
/// <summary>To be added.</summary>
VerticalMetricsVariations = 0x56564152, // 'VVAR'
/// <summary>To be added.</summary>
GlyphReference = 0x5a617066, // 'Zapf'
/// <summary>To be added.</summary>
AccentAttachment = 0x61636e74, // 'Acnt'
/// <summary>To be added.</summary>
AnchorPoints = 0x616e6b72, // 'ankr'
/// <summary>To be added.</summary>
AxisVariation = 0x61766172, // 'Avar'
/// <summary>To be added.</summary>
BitmapData = 0x62646174, // 'Bdat'
/// <summary>To be added.</summary>
BitmapFontHeader = 0x62686564, // 'Bhed'
/// <summary>To be added.</summary>
BitmapLocation = 0x626c6f63, // 'Bloc'
/// <summary>To be added.</summary>
BaselineBsln = 0x62736c6e, // 'Bsln'
/// <summary>To be added.</summary>
CharacterToGlyphMapping = 0x636d6170, // 'Cmap'
/// <summary>To be added.</summary>
ControlValueTableVariation = 0x63766172, // 'Cvar'
/// <summary>To be added.</summary>
ControlValueTable = 0x63767420, // 'Cvt '
/// <summary>To be added.</summary>
FontDescriptor = 0x66647363, // 'Fdsc'
/// <summary>To be added.</summary>
LayoutFeature = 0x66656174, // 'Feat'
/// <summary>To be added.</summary>
FontMetrics = 0x666d7478, // 'Fmtx'
/// <summary>To be added.</summary>
FondAndNfntData = 0x666f6e64, // 'fond'
/// <summary>To be added.</summary>
FontProgram = 0x6670676d, // 'Fpgm'
/// <summary>To be added.</summary>
FontVariation = 0x66766172, // 'Fvar'
/// <summary>To be added.</summary>
GridFitting = 0x67617370, // 'Gasp'
/// <summary>To be added.</summary>
GlyphData = 0x676c7966, // 'Glyf'
/// <summary>To be added.</summary>
GlyphVariation = 0x67766172, // 'Gvar'
/// <summary>To be added.</summary>
HorizontalDeviceMetrics = 0x68646d78, // 'Hdmx'
/// <summary>To be added.</summary>
FontHeader = 0x68656164, // 'Head'
/// <summary>To be added.</summary>
HorizontalHeader = 0x68686561, // 'Hhea'
/// <summary>To be added.</summary>
HorizontalMetrics = 0x686d7478, // 'Hmtx'
/// <summary>To be added.</summary>
HorizontalStyle = 0x68737479, // 'Hsty'
/// <summary>To be added.</summary>
JustificationJust = 0x6a757374, // 'Just'
/// <summary>To be added.</summary>
Kerning = 0x6b65726e, // 'Kern'
/// <summary>To be added.</summary>
ExtendedKerning = 0x6b657278, // 'Kerx'
/// <summary>To be added.</summary>
LigatureCaret = 0x6c636172, // 'Lcar'
/// <summary>To be added.</summary>
IndexToLocation = 0x6c6f6361, // 'Loca'
/// <summary>To be added.</summary>
LanguageTags = 0x6c746167, // 'ltag'
/// <summary>To be added.</summary>
MaximumProfile = 0x6d617870, // 'Maxp'
/// <summary>To be added.</summary>
Metadata = 0x6d657461, // 'meta'
/// <summary>To be added.</summary>
Morph = 0x6d6f7274, // 'Mort'
/// <summary>To be added.</summary>
ExtendedMorph = 0x6d6f7278, // 'Morx'
/// <summary>To be added.</summary>
Name = 0x6e616d65, // 'Name'
/// <summary>To be added.</summary>
OpticalBounds = 0x6f706264, // 'Opbd'
/// <summary>To be added.</summary>
PostScriptInformation = 0x706f7374, // 'Post'
/// <summary>To be added.</summary>
ControlValueTableProgram = 0x70726570, // 'Prep'
/// <summary>To be added.</summary>
Properties = 0x70726f70, // 'Prop'
/// <summary>To be added.</summary>
SBitmapData = 0x73626974, // 'sbit'
/// <summary>To be added.</summary>
SExtendedBitmapData = 0x73626978, // 'sbix'
/// <summary>To be added.</summary>
Tracking = 0x7472616b, // 'Trak'
/// <summary>To be added.</summary>
VerticalHeader = 0x76686561, // 'Vhea'
/// <summary>To be added.</summary>
VerticalMetrics = 0x766d7478, // 'Vmtx'
/// <summary>To be added.</summary>
CrossReference = 0x78726566, // 'xref'
}
/// <summary>An enumeration whose values can be used as flags for options relating to font tables.</summary>
/// <remarks>To be added.</remarks>
[Flags]
// defined as uint32_t - /System/Library/Frameworks/CoreText.framework/Headers/CTFont.h
public enum CTFontTableOptions : uint {
/// <summary>To be added.</summary>
None = 0,
/// <summary>To be added.</summary>
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[ObsoletedOSPlatform ("ios6.0")]
[ObsoletedOSPlatform ("maccatalyst13.1")]
[ObsoletedOSPlatform ("macos10.8")]
[UnsupportedOSPlatform ("tvos")]
ExcludeSynthetic = (1 << 0),
}
// anonymous and typeless native enum - /System/Library/Frameworks/CoreText.framework/Headers/SFNTLayoutTypes.h
/// <summary>An enumeration whose values specify various types of font features.</summary>
/// <remarks>To be added.</remarks>
/// <altmember cref="CoreText.CTFontFeatures.FeatureGroup" />
/// <altmember cref="CoreText.CTFontFeatureSettings.FeatureGroup" />
public enum FontFeatureGroup {
/// <summary>To be added.</summary>
AllTypographicFeatures = 0,
/// <summary>To be added.</summary>
Ligatures = 1,
/// <summary>To be added.</summary>
CursiveConnection = 2,
/// <summary>Developers should not use this deprecated field. </summary>
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
[ObsoletedOSPlatform ("macos10.7")]
[ObsoletedOSPlatform ("ios6.0")]
[ObsoletedOSPlatform ("tvos")]
[ObsoletedOSPlatform ("maccatalyst")]
LetterCase = 3,
/// <summary>To be added.</summary>
VerticalSubstitution = 4,
/// <summary>To be added.</summary>
LinguisticRearrangement = 5,
/// <summary>To be added.</summary>
NumberSpacing = 6,
/// <summary>To be added.</summary>
SmartSwash = 8,
/// <summary>To be added.</summary>
Diacritics = 9,
/// <summary>To be added.</summary>
VerticalPosition = 10,
/// <summary>To be added.</summary>
Fractions = 11,
/// <summary>To be added.</summary>
OverlappingCharacters = 13,
/// <summary>To be added.</summary>
TypographicExtras = 14,
/// <summary>To be added.</summary>
MathematicalExtras = 15,
/// <summary>To be added.</summary>
OrnamentSets = 16,
/// <summary>To be added.</summary>
CharacterAlternatives = 17,
/// <summary>To be added.</summary>
DesignComplexity = 18,
/// <summary>To be added.</summary>
StyleOptions = 19,
/// <summary>To be added.</summary>
CharacterShape = 20,
/// <summary>To be added.</summary>
NumberCase = 21,
/// <summary>To be added.</summary>
TextSpacing = 22,
/// <summary>To be added.</summary>
Transliteration = 23,
/// <summary>To be added.</summary>
Annotation = 24,
/// <summary>To be added.</summary>
KanaSpacing = 25,
/// <summary>To be added.</summary>
IdeographicSpacing = 26,
/// <summary>To be added.</summary>
UnicodeDecomposition = 27,
/// <summary>To be added.</summary>
RubyKana = 28,
/// <summary>To be added.</summary>
CJKSymbolAlternatives = 29,
/// <summary>To be added.</summary>
IdeographicAlternatives = 30,
/// <summary>To be added.</summary>
CJKVerticalRomanPlacement = 31,
/// <summary>To be added.</summary>
ItalicCJKRoman = 32,
/// <summary>To be added.</summary>
CaseSensitiveLayout = 33,
/// <summary>To be added.</summary>
AlternateKana = 34,
/// <summary>To be added.</summary>
StylisticAlternatives = 35,
/// <summary>To be added.</summary>
ContextualAlternates = 36,
/// <summary>To be added.</summary>
LowerCase = 37,
/// <summary>To be added.</summary>
UpperCase = 38,
/// <summary>To be added.</summary>
CJKRomanSpacing = 103,
}
/// <summary>Encapsulates the features of a <see cref="CoreText.CTFont" />.</summary>
/// <remarks>To be added.</remarks>
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
public class CTFontFeatures {
/// <summary>To be added.</summary>
/// <remarks>To be added.</remarks>
public CTFontFeatures ()
: this (new NSMutableDictionary ())
{
}
/// <param name="dictionary">To be added.</param>
/// <summary>To be added.</summary>
/// <remarks>To be added.</remarks>
public CTFontFeatures (NSDictionary dictionary)
{
if (dictionary is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (dictionary));
Dictionary = dictionary;
}
/// <summary>The NSDictionary that reflects the current values in the strongly typed CTFontFeatures.</summary>
/// <value>
/// </value>
/// <remarks>
/// </remarks>
public NSDictionary Dictionary { get; private set; }
/// <summary>To be added.</summary>
/// <value>To be added.</value>
/// <remarks>To be added.</remarks>
public string? Name {
get { return Adapter.GetStringValue (Dictionary, CTFontFeatureKey.Name); }
set { Adapter.SetValue (Dictionary, CTFontFeatureKey.Name, value); }
}
/// <summary>To be added.</summary>
/// <value>To be added.</value>
/// <remarks>To be added.</remarks>
public FontFeatureGroup FeatureGroup {
get {
var number = (NSNumber?) Dictionary [CTFontFeatureKey.Identifier];
if (number is null)
return default;
return (FontFeatureGroup) (int) number;
}
}
/// <summary>To be added.</summary>
/// <value>To be added.</value>
/// <remarks>To be added.</remarks>
public bool Exclusive {
get {
return CFDictionary.GetBooleanValue (Dictionary.Handle,
CTFontFeatureKey.Exclusive.Handle);
}
set {
CFMutableDictionary.SetValue (Dictionary.Handle,
CTFontFeatureKey.Exclusive.Handle,
value);
}
}
/// <summary>To be added.</summary>
/// <value>To be added.</value>
/// <remarks>To be added.</remarks>
public IEnumerable<CTFontFeatureSelectors>? Selectors {
get {
return Adapter.GetNativeArray (Dictionary, CTFontFeatureKey.Selectors,
d => CTFontFeatureSelectors.Create (FeatureGroup, Runtime.GetNSObject<NSDictionary> (d)!));
}
set {
List<CTFontFeatureSelectors> v;
if (value is null || (v = new List<CTFontFeatureSelectors> (value)).Count == 0) {
Adapter.SetValue (Dictionary, CTFontFeatureKey.Selectors, (NSObject?) null);
return;
}
Adapter.SetValue (Dictionary, CTFontFeatureKey.Selectors,
NSArray.FromNSObjects ((IList<NSObject>) v.ConvertAll (e => (NSObject) e.Dictionary)));
}
}
}
/// <summary>Encapsulates a font feature-dictionary. </summary>
/// <remarks>To be added.</remarks>
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
public class CTFontFeatureSelectors {
/// <summary>To be added.</summary>
/// <remarks>To be added.</remarks>
public CTFontFeatureSelectors ()
: this (new NSMutableDictionary ())
{
}
/// <param name="dictionary">To be added.</param>
/// <summary>To be added.</summary>
/// <remarks>To be added.</remarks>
public CTFontFeatureSelectors (NSDictionary dictionary)
{
if (dictionary is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (dictionary));
Dictionary = dictionary;
}
internal static CTFontFeatureSelectors Create (FontFeatureGroup featureGroup, NSDictionary dictionary)
{
switch (featureGroup) {
case FontFeatureGroup.AllTypographicFeatures:
return new CTFontFeatureAllTypographicFeatures (dictionary);
case FontFeatureGroup.Ligatures:
return new CTFontFeatureLigatures (dictionary);
case FontFeatureGroup.CursiveConnection:
return new CTFontFeatureCursiveConnection (dictionary);
#pragma warning disable 618
#pragma warning disable CA1422 // This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'CTFontFeatureLetterCase' is obsoleted on: 'ios' 6.0 and later, 'maccatalyst' 6.0 and later, 'macOS/OSX' 10.7 and later.
case FontFeatureGroup.LetterCase:
return new CTFontFeatureLetterCase (dictionary);
#pragma warning restore CA1422
#pragma warning restore 618
case FontFeatureGroup.VerticalSubstitution:
return new CTFontFeatureVerticalSubstitutionConnection (dictionary);
case FontFeatureGroup.LinguisticRearrangement:
return new CTFontFeatureLinguisticRearrangementConnection (dictionary);
case FontFeatureGroup.NumberSpacing:
return new CTFontFeatureNumberSpacing (dictionary);
case FontFeatureGroup.SmartSwash:
return new CTFontFeatureSmartSwash (dictionary);
case FontFeatureGroup.Diacritics:
return new CTFontFeatureDiacritics (dictionary);
case FontFeatureGroup.VerticalPosition:
return new CTFontFeatureVerticalPosition (dictionary);
case FontFeatureGroup.Fractions:
return new CTFontFeatureFractions (dictionary);
case FontFeatureGroup.OverlappingCharacters:
return new CTFontFeatureOverlappingCharacters (dictionary);
case FontFeatureGroup.TypographicExtras:
return new CTFontFeatureTypographicExtras (dictionary);
case FontFeatureGroup.MathematicalExtras:
return new CTFontFeatureMathematicalExtras (dictionary);
case FontFeatureGroup.OrnamentSets:
return new CTFontFeatureOrnamentSets (dictionary);
case FontFeatureGroup.CharacterAlternatives:
return new CTFontFeatureCharacterAlternatives (dictionary);
case FontFeatureGroup.DesignComplexity:
return new CTFontFeatureDesignComplexity (dictionary);
case FontFeatureGroup.StyleOptions:
return new CTFontFeatureStyleOptions (dictionary);
case FontFeatureGroup.CharacterShape:
return new CTFontFeatureCharacterShape (dictionary);
case FontFeatureGroup.NumberCase:
return new CTFontFeatureNumberCase (dictionary);
case FontFeatureGroup.TextSpacing:
return new CTFontFeatureTextSpacing (dictionary);
case FontFeatureGroup.Transliteration:
return new CTFontFeatureTransliteration (dictionary);
case FontFeatureGroup.Annotation:
return new CTFontFeatureAnnotation (dictionary);
case FontFeatureGroup.KanaSpacing:
return new CTFontFeatureKanaSpacing (dictionary);
case FontFeatureGroup.IdeographicSpacing:
return new CTFontFeatureIdeographicSpacing (dictionary);
case FontFeatureGroup.UnicodeDecomposition:
return new CTFontFeatureUnicodeDecomposition (dictionary);
case FontFeatureGroup.RubyKana:
return new CTFontFeatureRubyKana (dictionary);
case FontFeatureGroup.CJKSymbolAlternatives:
return new CTFontFeatureCJKSymbolAlternatives (dictionary);
case FontFeatureGroup.IdeographicAlternatives:
return new CTFontFeatureIdeographicAlternatives (dictionary);
case FontFeatureGroup.CJKVerticalRomanPlacement:
return new CTFontFeatureCJKVerticalRomanPlacement (dictionary);
case FontFeatureGroup.ItalicCJKRoman:
return new CTFontFeatureItalicCJKRoman (dictionary);
case FontFeatureGroup.CaseSensitiveLayout:
return new CTFontFeatureCaseSensitiveLayout (dictionary);
case FontFeatureGroup.AlternateKana:
return new CTFontFeatureAlternateKana (dictionary);
case FontFeatureGroup.StylisticAlternatives:
return new CTFontFeatureStylisticAlternatives (dictionary);
case FontFeatureGroup.ContextualAlternates:
return new CTFontFeatureContextualAlternates (dictionary);
case FontFeatureGroup.LowerCase:
return new CTFontFeatureLowerCase (dictionary);
case FontFeatureGroup.UpperCase:
return new CTFontFeatureUpperCase (dictionary);
case FontFeatureGroup.CJKRomanSpacing:
return new CTFontFeatureCJKRomanSpacing (dictionary);
default:
return new CTFontFeatureSelectors (dictionary);
}
}
/// <summary>To be added.</summary>
/// <value>To be added.</value>
/// <remarks>To be added.</remarks>
public NSDictionary Dictionary { get; private set; }
/// <summary>To be added.</summary>
/// <value>To be added.</value>
/// <remarks>To be added.</remarks>
protected int FeatureWeak {
get {
var number = (NSNumber?) Dictionary [CTFontFeatureSelectorKey.Identifier];
if (number is null)
return default;
return (int) number;
}
}
/// <summary>To be added.</summary>
/// <value>To be added.</value>
/// <remarks>To be added.</remarks>
public string? Name {
get { return Adapter.GetStringValue (Dictionary, CTFontFeatureSelectorKey.Name); }
set { Adapter.SetValue (Dictionary, CTFontFeatureSelectorKey.Name, value); }
}
/// <summary>To be added.</summary>
/// <value>To be added.</value>
/// <remarks>To be added.</remarks>
public bool Default {
get {
return CFDictionary.GetBooleanValue (Dictionary.Handle,
CTFontFeatureSelectorKey.Default.Handle);
}
set {
CFMutableDictionary.SetValue (Dictionary.Handle,
CTFontFeatureSelectorKey.Default.Handle,
value);
}
}
/// <summary>To be added.</summary>
/// <value>To be added.</value>
/// <remarks>To be added.</remarks>
public bool Setting {
get {
return CFDictionary.GetBooleanValue (Dictionary.Handle,
CTFontFeatureSelectorKey.Setting.Handle);
}
set {
CFMutableDictionary.SetValue (Dictionary.Handle,
CTFontFeatureSelectorKey.Setting.Handle,
value);
}
}
}
/// <summary>A <see cref="CoreText.CTFontFeatureSelectors" /> that represents all type features.</summary>
/// <remarks>To be added.</remarks>
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
public class CTFontFeatureAllTypographicFeatures : CTFontFeatureSelectors {
/// <summary>An enumeration whose values can be used as arguments for <see cref="CoreText.CTFontDescriptor.WithFeature(CoreText.CTFontFeatureVerticalSubstitutionConnection.Selector)" />.</summary>
/// <remarks>To be added.</remarks>
public enum Selector {
/// <summary>To be added.</summary>
AllTypeFeaturesOn = 0,
/// <summary>To be added.</summary>
AllTypeFeaturesOff = 1,
}
/// <param name="dictionary">To be added.</param>
/// <summary>To be added.</summary>
/// <remarks>To be added.</remarks>
public CTFontFeatureAllTypographicFeatures (NSDictionary dictionary)
: base (dictionary)
{
}
/// <summary>To be added.</summary>
/// <value>To be added.</value>
/// <remarks>To be added.</remarks>
public Selector Feature {
get {
return (Selector) FeatureWeak;
}
}
}
/// <summary>A <see cref="CoreText.CTFontFeatureSelectors" /> that describe whether ligature features are on or off.</summary>
/// <remarks>To be added.</remarks>
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
public class CTFontFeatureLigatures : CTFontFeatureSelectors {
/// <summary>An enumeration whose values are returned by <see cref="CoreText.CTFontFeatureLigatures.Feature" />.</summary>
/// <remarks>To be added.</remarks>
public enum Selector {
/// <summary>To be added.</summary>
RequiredLigaturesOn = 0,
/// <summary>To be added.</summary>
RequiredLigaturesOff = 1,
/// <summary>To be added.</summary>
CommonLigaturesOn = 2,
/// <summary>To be added.</summary>
CommonLigaturesOff = 3,
/// <summary>To be added.</summary>
RareLigaturesOn = 4,
/// <summary>To be added.</summary>
RareLigaturesOff = 5,
/// <summary>To be added.</summary>
LogosOn = 6,
/// <summary>To be added.</summary>
LogosOff = 7,
/// <summary>To be added.</summary>
RebusPicturesOn = 8,
/// <summary>To be added.</summary>
RebusPicturesOff = 9,
/// <summary>To be added.</summary>
DiphthongLigaturesOn = 10,
/// <summary>To be added.</summary>
DiphthongLigaturesOff = 11,
/// <summary>To be added.</summary>
SquaredLigaturesOn = 12,
/// <summary>To be added.</summary>
SquaredLigaturesOff = 13,
/// <summary>To be added.</summary>
AbbrevSquaredLigaturesOn = 14,
/// <summary>To be added.</summary>
AbbrevSquaredLigaturesOff = 15,
/// <summary>To be added.</summary>
SymbolLigaturesOn = 16,
/// <summary>To be added.</summary>
SymbolLigaturesOff = 17,
/// <summary>To be added.</summary>
ContextualLigaturesOn = 18,
/// <summary>To be added.</summary>
ContextualLigaturesOff = 19,
/// <summary>To be added.</summary>
HistoricalLigaturesOn = 20,
/// <summary>To be added.</summary>
HistoricalLigaturesOff = 21,
}
/// <param name="dictionary">To be added.</param>
/// <summary>To be added.</summary>
/// <remarks>To be added.</remarks>
public CTFontFeatureLigatures (NSDictionary dictionary)
: base (dictionary)
{
}
/// <summary>To be added.</summary>
/// <value>To be added.</value>
/// <remarks>To be added.</remarks>
public Selector Feature {
get {
return (Selector) FeatureWeak;
}
}
}
/// <summary>A <see cref="CoreText.CTFontFeatureSelectors" /> that describe features related to capitalization options such as initial capitalization.</summary>
/// <remarks>To be added.</remarks>
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
[ObsoletedOSPlatform ("macos10.7")]
[ObsoletedOSPlatform ("ios6.0")]
[ObsoletedOSPlatform ("tvos")]
[ObsoletedOSPlatform ("maccatalyst")]
public class CTFontFeatureLetterCase : CTFontFeatureSelectors {
/// <summary>An enumeration whose values are returned by <see cref="CoreText.CTFontFeatureLetterCase.Feature" />.</summary>
/// <remarks>To be added.</remarks>
public enum Selector {
/// <summary>To be added.</summary>
UpperAndLowerCase = 0,
/// <summary>To be added.</summary>
AllCaps = 1,
/// <summary>To be added.</summary>
AllLowerCase = 2,
/// <summary>To be added.</summary>
SmallCaps = 3,
/// <summary>To be added.</summary>
InitialCaps = 4,
/// <summary>To be added.</summary>
InitialCapsAndSmallCaps = 5,
}
/// <param name="dictionary">To be added.</param>
/// <summary>To be added.</summary>
/// <remarks>To be added.</remarks>
public CTFontFeatureLetterCase (NSDictionary dictionary)
: base (dictionary)
{
}
/// <summary>To be added.</summary>
/// <value>To be added.</value>
/// <remarks>To be added.</remarks>
public Selector Feature {
get {
return (Selector) FeatureWeak;
}
}
}
/// <summary>A <see cref="CoreText.CTFontFeatureSelectors" /> that describe features related to the connection of cursive letters.</summary>
/// <remarks>To be added.</remarks>
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
public class CTFontFeatureCursiveConnection : CTFontFeatureSelectors {
/// <summary>An enumeration whose values are returned by <see cref="CoreText.CTFontFeatureCursiveConnection.Feature" />.</summary>
/// <remarks>To be added.</remarks>
public enum Selector {
/// <summary>To be added.</summary>
Unconnected = 0,
/// <summary>To be added.</summary>
PartiallyConnected = 1,
/// <summary>To be added.</summary>
Cursive = 2,
}
/// <param name="dictionary">To be added.</param>
/// <summary>To be added.</summary>
/// <remarks>To be added.</remarks>
public CTFontFeatureCursiveConnection (NSDictionary dictionary)
: base (dictionary)
{
}
/// <summary>To be added.</summary>
/// <value>To be added.</value>
/// <remarks>To be added.</remarks>
public Selector Feature {
get {
return (Selector) FeatureWeak;
}
}
}
/// <summary>A <see cref="CoreText.CTFontFeatureSelectors" /> that describe features related to vertical substitution.</summary>
/// <remarks>To be added.</remarks>
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
public class CTFontFeatureVerticalSubstitutionConnection : CTFontFeatureSelectors {
/// <summary>An enumeration whose values are returned by <see cref="CoreText.CTFontFeatureVerticalSubstitutionConnection.Feature" />.</summary>
/// <remarks>To be added.</remarks>
public enum Selector {
/// <summary>To be added.</summary>
SubstituteVerticalFormsOn = 0,
/// <summary>To be added.</summary>
SubstituteVerticalFormsOff = 1,
}
/// <param name="dictionary">To be added.</param>
/// <summary>To be added.</summary>
/// <remarks>To be added.</remarks>
public CTFontFeatureVerticalSubstitutionConnection (NSDictionary dictionary)
: base (dictionary)
{
}
/// <summary>To be added.</summary>
/// <value>To be added.</value>
/// <remarks>To be added.</remarks>
public Selector Feature {
get {
return (Selector) FeatureWeak;
}
}
}
/// <summary>A <see cref="CoreText.CTFontFeatureSelectors" /> that describe whether linguistic rearrangement is on or off.</summary>
/// <remarks>To be added.</remarks>
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
public class CTFontFeatureLinguisticRearrangementConnection : CTFontFeatureSelectors {
/// <summary>An enumeration whose values are returned by <see cref="CoreText.CTFontFeatureLinguisticRearrangementConnection.Feature" />.</summary>
/// <remarks>To be added.</remarks>
public enum Selector {
/// <summary>To be added.</summary>
LinguisticRearrangementOn = 0,
/// <summary>To be added.</summary>
LinguisticRearrangementOff = 1,
}
/// <param name="dictionary">To be added.</param>
/// <summary>To be added.</summary>
/// <remarks>To be added.</remarks>
public CTFontFeatureLinguisticRearrangementConnection (NSDictionary dictionary)
: base (dictionary)
{
}
/// <summary>To be added.</summary>
/// <value>To be added.</value>
/// <remarks>To be added.</remarks>
public Selector Feature {
get {
return (Selector) FeatureWeak;
}
}
}
/// <summary>A <see cref="CoreText.CTFontFeatureSelectors" /> that describe features related to spacing of numbers.</summary>
/// <remarks>To be added.</remarks>
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
public class CTFontFeatureNumberSpacing : CTFontFeatureSelectors {
/// <summary>An enumeration whose values are returned by <see cref="CoreText.CTFontFeatureNumberSpacing.Feature" />.</summary>
/// <remarks>To be added.</remarks>
public enum Selector {
/// <summary>To be added.</summary>
MonospacedNumbers = 0,
/// <summary>To be added.</summary>
ProportionalNumbers = 1,
/// <summary>To be added.</summary>
ThirdWidthNumbers = 2,
/// <summary>To be added.</summary>
QuarterWidthNumbers = 3,
}
/// <param name="dictionary">To be added.</param>
/// <summary>To be added.</summary>
/// <remarks>To be added.</remarks>
public CTFontFeatureNumberSpacing (NSDictionary dictionary)
: base (dictionary)
{
}
/// <summary>To be added.</summary>
/// <value>To be added.</value>
/// <remarks>To be added.</remarks>
public Selector Feature {
get {
return (Selector) FeatureWeak;
}
}
}
/// <summary>A <see cref="CoreText.CTFontFeatureSelectors" /> that describe features related to smart swashes.</summary>
/// <remarks>To be added.</remarks>
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
public class CTFontFeatureSmartSwash : CTFontFeatureSelectors {
/// <summary>An enumeration whose values are returned by <see cref="CoreText.CTFontFeatureSmartSwash.Feature" />.</summary>
/// <remarks>To be added.</remarks>
public enum Selector {
/// <summary>To be added.</summary>
WordInitialSwashesOn = 0,
/// <summary>To be added.</summary>
WordInitialSwashesOff = 1,
/// <summary>To be added.</summary>
WordFinalSwashesOn = 2,
/// <summary>To be added.</summary>
WordFinalSwashesOff = 3,
/// <summary>To be added.</summary>
LineInitialSwashesOn = 4,
/// <summary>To be added.</summary>
LineInitialSwashesOff = 5,
/// <summary>To be added.</summary>
LineFinalSwashesOn = 6,
/// <summary>To be added.</summary>
LineFinalSwashesOff = 7,
/// <summary>To be added.</summary>
NonFinalSwashesOn = 8,
/// <summary>To be added.</summary>
NonFinalSwashesOff = 9,
}
/// <param name="dictionary">To be added.</param>
/// <summary>To be added.</summary>
/// <remarks>To be added.</remarks>
public CTFontFeatureSmartSwash (NSDictionary dictionary)
: base (dictionary)
{
}
/// <summary>To be added.</summary>
/// <value>To be added.</value>
/// <remarks>To be added.</remarks>
public Selector Feature {
get {
return (Selector) FeatureWeak;
}
}
}
/// <summary>A <see cref="CoreText.CTFontFeatureSelectors" /> that describe features related to the visibility and composition of diacritical marks.</summary>
/// <remarks>To be added.</remarks>
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
public class CTFontFeatureDiacritics : CTFontFeatureSelectors {
/// <summary>An enumeration whose values are returned by <see cref="CoreText.CTFontFeatureDiacritics.Feature" />.</summary>
/// <remarks>To be added.</remarks>
public enum Selector {
/// <summary>To be added.</summary>
ShowDiacritics = 0,