~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/maccore/src/CoreText/CTFont.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
// CTFont.cs: Implements the managed CTFont
3
3
//
4
4
// Authors: Mono Team
 
5
//          Marek Safar (marek.safar@gmail.com)
5
6
//     
6
7
// Copyright 2010 Novell, Inc
 
8
// Copyright 2011, 2012 Xamarin Inc
7
9
//
8
10
// Permission is hereby granted, free of charge, to any person obtaining
9
11
// a copy of this software and associated documentation files (the
121
123
                HorizontalStyle            = 0x68737479,  // 'Hsty'
122
124
                JustificationJust          = 0x6a757374,  // 'Just'
123
125
                Kerning                    = 0x6b65726e,  // 'Kern'
124
 
                ExtendedKerning            = 0x6b657278,  // 'Kerx'
 
126
                ExtendedKerning            = 0x6b657278,  // 'Kerx'
125
127
                LigatureCaret              = 0x6c636172,  // 'Lcar'
126
128
                IndexToLocation            = 0x6c6f6361,  // 'Loca'
127
129
                MaximumProfile             = 0x6d617870,  // 'Maxp'
137
139
                VerticalMetrics            = 0x766d7478,  // 'Vmtx'
138
140
                SBitmapData                = 0x73626974, // 'sbit'
139
141
                SExtendedBitmapData        = 0x73626978, // 'sbix'
 
142
                AnchorPoints               = 0x616e6b72, // 'ankr'
140
143
        }
141
144
 
142
145
        [Since (3,2)]
146
149
                ExcludeSynthetic  = (1 << 0),
147
150
        }
148
151
 
 
152
        public enum FontFeatureGroup
 
153
        {
 
154
                AllTypographicFeatures   = 0,
 
155
                Ligatures                = 1,
 
156
                CursiveConnection        = 2,
 
157
                [Obsolete ("Deprecated. Use LowerCase or UpperCase instead")]
 
158
                LetterCase               = 3,
 
159
                VerticalSubstitution     = 4,
 
160
                LinguisticRearrangement  = 5,
 
161
                NumberSpacing            = 6,
 
162
                SmartSwash               = 8,
 
163
                Diacritics               = 9,
 
164
                VerticalPosition         = 10,
 
165
                Fractions                = 11,
 
166
                OverlappingCharacters    = 13,
 
167
                TypographicExtras        = 14,
 
168
                MathematicalExtras       = 15,
 
169
                OrnamentSets             = 16,
 
170
                CharacterAlternatives    = 17,
 
171
                DesignComplexity         = 18,
 
172
                StyleOptions             = 19,
 
173
                CharacterShape           = 20,
 
174
                NumberCase               = 21,
 
175
                TextSpacing              = 22,
 
176
                Transliteration          = 23,
 
177
                Annotation               = 24,
 
178
                KanaSpacing              = 25,
 
179
                IdeographicSpacing       = 26,
 
180
                UnicodeDecomposition     = 27,
 
181
                RubyKana                 = 28,
 
182
                CJKSymbolAlternatives    = 29,
 
183
                IdeographicAlternatives  = 30,
 
184
                CJKVerticalRomanPlacement = 31,
 
185
                ItalicCJKRoman           = 32,
 
186
                CaseSensitiveLayout      = 33,
 
187
                AlternateKana            = 34,
 
188
                StylisticAlternatives    = 35,
 
189
                ContextualAlternates     = 36,
 
190
                LowerCase                = 37,
 
191
                UpperCase                = 38,
 
192
                CJKRomanSpacing          = 103
 
193
        }
 
194
 
149
195
        [Since (3,2)]
150
196
        public class CTFontFeatureKey {
151
197
 
154
200
                public static readonly NSString Exclusive;
155
201
                public static readonly NSString Selectors;
156
202
 
 
203
                //static readonly NSString FeatureTypeNameID;
 
204
 
157
205
                static CTFontFeatureKey ()
158
206
                {
159
207
                        var handle = Dlfcn.dlopen (Constants.CoreTextLibrary, 0);
164
212
                                Name        = Dlfcn.GetStringConstant (handle, "kCTFontFeatureTypeNameKey");
165
213
                                Exclusive   = Dlfcn.GetStringConstant (handle, "kCTFontFeatureTypeExclusiveKey");
166
214
                                Selectors   = Dlfcn.GetStringConstant (handle, "kCTFontFeatureTypeSelectorsKey");
 
215
 
 
216
                                //
 
217
                                // iOS has some undocumented key
 
218
                                //
 
219
                                //FeatureTypeNameID = Dlfcn.GetStringConstant (handle, "kCTFontFeatureTypeNameIDKey");
167
220
                        }
168
221
                        finally {
169
222
                                Dlfcn.dlclose (handle);
188
241
 
189
242
                public NSDictionary Dictionary {get; private set;}
190
243
 
191
 
                // TODO: what kind of NSNumber?
 
244
                [Advice ("Use FeatureGroup property instead")]
192
245
                public NSNumber Identifier {
193
246
                        get {return (NSNumber) Dictionary [CTFontFeatureKey.Identifier];}
194
247
                        set {Adapter.SetValue (Dictionary, CTFontFeatureKey.Identifier, value);}
199
252
                        set {Adapter.SetValue (Dictionary, CTFontFeatureKey.Name, value);}
200
253
                }
201
254
 
 
255
                public FontFeatureGroup FeatureGroup {
 
256
                        get {
 
257
                                return (FontFeatureGroup) (int) (NSNumber) Dictionary [CTFontFeatureKey.Identifier];
 
258
                        }
 
259
                }
 
260
 
202
261
                public bool Exclusive {
203
262
                        get {
204
263
                                return CFDictionary.GetBooleanValue (Dictionary.Handle, 
214
273
                public IEnumerable<CTFontFeatureSelectors> Selectors {
215
274
                        get {
216
275
                                return Adapter.GetNativeArray (Dictionary, CTFontFeatureKey.Selectors,
217
 
                                                d => new CTFontFeatureSelectors ((NSDictionary) Runtime.GetNSObject (d)));
 
276
                                                d => CTFontFeatureSelectors.Create (FeatureGroup, (NSDictionary) Runtime.GetNSObject (d)));
218
277
                        }
219
278
                        set {
220
279
                                List<CTFontFeatureSelectors> v;
253
312
                }
254
313
        }
255
314
 
 
315
        // TODO: Should be abstract
256
316
        [Since (3,2)]
257
317
        public class CTFontFeatureSelectors {
258
318
 
268
328
                        Dictionary = dictionary;
269
329
                }
270
330
 
 
331
                internal static CTFontFeatureSelectors Create (FontFeatureGroup featureGroup, NSDictionary dictionary)
 
332
                {
 
333
                        switch (featureGroup) {
 
334
                        case FontFeatureGroup.AllTypographicFeatures:
 
335
                                return new CTFontFeatureAllTypographicFeatures (dictionary);
 
336
                        case FontFeatureGroup.Ligatures:
 
337
                                return new CTFontFeatureLigatures (dictionary);
 
338
                        case FontFeatureGroup.CursiveConnection:
 
339
                                return new CTFontFeatureCursiveConnection (dictionary);
 
340
#pragma warning disable 618
 
341
                        case FontFeatureGroup.LetterCase:
 
342
                                return new CTFontFeatureLetterCase (dictionary);
 
343
#pragma warning restore 618
 
344
                        case FontFeatureGroup.VerticalSubstitution:
 
345
                                return new CTFontFeatureVerticalSubstitutionConnection (dictionary);
 
346
                        case FontFeatureGroup.LinguisticRearrangement:
 
347
                                return new CTFontFeatureLinguisticRearrangementConnection (dictionary);
 
348
                        case FontFeatureGroup.NumberSpacing:
 
349
                                return new CTFontFeatureNumberSpacing (dictionary);
 
350
                        case FontFeatureGroup.SmartSwash:
 
351
                                return new CTFontFeatureSmartSwash (dictionary);
 
352
                        case FontFeatureGroup.Diacritics:
 
353
                                return new CTFontFeatureDiacritics (dictionary);
 
354
                        case FontFeatureGroup.VerticalPosition:
 
355
                                return new CTFontFeatureVerticalPosition (dictionary);
 
356
                        case FontFeatureGroup.Fractions:
 
357
                                return new CTFontFeatureFractions (dictionary);
 
358
                        case FontFeatureGroup.OverlappingCharacters:
 
359
                                return new CTFontFeatureOverlappingCharacters (dictionary);
 
360
                        case FontFeatureGroup.TypographicExtras:
 
361
                                return new CTFontFeatureTypographicExtras (dictionary);
 
362
                        case FontFeatureGroup.MathematicalExtras:
 
363
                                return new CTFontFeatureMathematicalExtras (dictionary);
 
364
                        case FontFeatureGroup.OrnamentSets:
 
365
                                return new CTFontFeatureOrnamentSets (dictionary);
 
366
                        case FontFeatureGroup.CharacterAlternatives:
 
367
                                return new CTFontFeatureCharacterAlternatives (dictionary);
 
368
                        case FontFeatureGroup.DesignComplexity:
 
369
                                return new CTFontFeatureDesignComplexity (dictionary);
 
370
                        case FontFeatureGroup.StyleOptions:
 
371
                                return new CTFontFeatureStyleOptions (dictionary);
 
372
                        case FontFeatureGroup.CharacterShape:
 
373
                                return new CTFontFeatureCharacterShape (dictionary);
 
374
                        case FontFeatureGroup.NumberCase:
 
375
                                return new CTFontFeatureNumberCase (dictionary);
 
376
                        case FontFeatureGroup.TextSpacing:
 
377
                                return new CTFontFeatureTextSpacing (dictionary);
 
378
                        case FontFeatureGroup.Transliteration:
 
379
                                return new CTFontFeatureTransliteration (dictionary);
 
380
                        case FontFeatureGroup.Annotation:
 
381
                                return new CTFontFeatureAnnotation (dictionary);
 
382
                        case FontFeatureGroup.KanaSpacing:
 
383
                                return new CTFontFeatureKanaSpacing (dictionary);
 
384
                        case FontFeatureGroup.IdeographicSpacing:
 
385
                                return new CTFontFeatureIdeographicSpacing (dictionary);
 
386
                        case FontFeatureGroup.UnicodeDecomposition:
 
387
                                return new CTFontFeatureUnicodeDecomposition (dictionary);
 
388
                        case FontFeatureGroup.RubyKana:
 
389
                                return new CTFontFeatureRubyKana (dictionary);
 
390
                        case FontFeatureGroup.CJKSymbolAlternatives:
 
391
                                return new CTFontFeatureCJKSymbolAlternatives (dictionary);
 
392
                        case FontFeatureGroup.IdeographicAlternatives:
 
393
                                return new CTFontFeatureIdeographicAlternatives (dictionary);
 
394
                        case FontFeatureGroup.CJKVerticalRomanPlacement:
 
395
                                return new CTFontFeatureCJKVerticalRomanPlacement (dictionary);
 
396
                        case FontFeatureGroup.ItalicCJKRoman:
 
397
                                return new CTFontFeatureItalicCJKRoman (dictionary);
 
398
                        case FontFeatureGroup.CaseSensitiveLayout:
 
399
                                return new CTFontFeatureCaseSensitiveLayout (dictionary);
 
400
                        case FontFeatureGroup.AlternateKana:
 
401
                                return new CTFontFeatureAlternateKana (dictionary);
 
402
                        case FontFeatureGroup.StylisticAlternatives:
 
403
                                return new CTFontFeatureStylisticAlternatives (dictionary);
 
404
                        case FontFeatureGroup.ContextualAlternates:
 
405
                                return new CTFontFeatureContextualAlternates (dictionary);
 
406
                        case FontFeatureGroup.LowerCase:
 
407
                                return new CTFontFeatureLowerCase (dictionary);
 
408
                        case FontFeatureGroup.UpperCase:
 
409
                                return new CTFontFeatureUpperCase (dictionary);
 
410
                        case FontFeatureGroup.CJKRomanSpacing:
 
411
                                return new CTFontFeatureCJKRomanSpacing (dictionary);
 
412
                        default:
 
413
                                return new CTFontFeatureSelectors (dictionary);
 
414
                        }
 
415
                }
 
416
 
271
417
                public NSDictionary Dictionary {get; private set;}
272
418
 
273
 
                // TODO: what kind of number?
 
419
                [Advice ("Use one of descendant classes")]
274
420
                public NSNumber Identifier {
275
421
                        get {return (NSNumber) Dictionary [CTFontFeatureSelectorKey.Identifier];}
276
422
                        set {Adapter.SetValue (Dictionary, CTFontFeatureSelectorKey.Identifier, value);}
277
423
                }
278
424
 
 
425
                protected int FeatureWeak {
 
426
                        get {
 
427
                                return (int) (NSNumber) Dictionary [CTFontFeatureSelectorKey.Identifier];
 
428
                        }
 
429
                }
 
430
 
279
431
                public string Name {
280
432
                        get {return Adapter.GetStringValue (Dictionary, CTFontFeatureSelectorKey.Name);}
281
433
                        set {Adapter.SetValue (Dictionary, CTFontFeatureSelectorKey.Name, value);}
306
458
                }
307
459
        }
308
460
 
 
461
        public class CTFontFeatureAllTypographicFeatures : CTFontFeatureSelectors
 
462
        {
 
463
                public enum Selector
 
464
                {
 
465
                        AllTypeFeaturesOn    = 0,
 
466
                        AllTypeFeaturesOff   = 1
 
467
                }
 
468
 
 
469
                public CTFontFeatureAllTypographicFeatures (NSDictionary dictionary)
 
470
                        : base (dictionary)
 
471
                {
 
472
                }
 
473
 
 
474
                public Selector Feature {
 
475
                        get {
 
476
                                return (Selector) FeatureWeak;
 
477
                        }
 
478
                }
 
479
        }
 
480
 
 
481
        public class CTFontFeatureLigatures : CTFontFeatureSelectors
 
482
        {
 
483
                public enum Selector
 
484
                {
 
485
                        RequiredLigaturesOn  = 0,
 
486
                        RequiredLigaturesOff = 1,
 
487
                        CommonLigaturesOn    = 2,
 
488
                        CommonLigaturesOff   = 3,
 
489
                        RareLigaturesOn      = 4,
 
490
                        RareLigaturesOff     = 5,
 
491
                        LogosOn              = 6,
 
492
                        LogosOff             = 7,
 
493
                        RebusPicturesOn      = 8,
 
494
                        RebusPicturesOff     = 9,
 
495
                        DiphthongLigaturesOn = 10,
 
496
                        DiphthongLigaturesOff = 11,
 
497
                        SquaredLigaturesOn   = 12,
 
498
                        SquaredLigaturesOff  = 13,
 
499
                        AbbrevSquaredLigaturesOn = 14,
 
500
                        AbbrevSquaredLigaturesOff = 15,
 
501
                        SymbolLigaturesOn    = 16,
 
502
                        SymbolLigaturesOff   = 17,
 
503
                        ContextualLigaturesOn = 18,
 
504
                        ContextualLigaturesOff = 19,
 
505
                        HistoricalLigaturesOn = 20,
 
506
                        HistoricalLigaturesOff = 21
 
507
                }
 
508
 
 
509
                public CTFontFeatureLigatures (NSDictionary dictionary)
 
510
                        : base (dictionary)
 
511
                {
 
512
                }
 
513
 
 
514
                public Selector Feature {
 
515
                        get {
 
516
                                return (Selector) FeatureWeak;
 
517
                        }
 
518
                }
 
519
        }
 
520
 
 
521
        [Obsolete ("Deprecated")]
 
522
        public class CTFontFeatureLetterCase : CTFontFeatureSelectors
 
523
        {
 
524
                public enum Selector
 
525
                {
 
526
                        UpperAndLowerCase    = 0,
 
527
                        AllCaps              = 1,
 
528
                        AllLowerCase         = 2,
 
529
                        SmallCaps            = 3,
 
530
                        InitialCaps          = 4,
 
531
                        InitialCapsAndSmallCaps = 5
 
532
                }
 
533
 
 
534
                public CTFontFeatureLetterCase (NSDictionary dictionary)
 
535
                        : base (dictionary)
 
536
                {
 
537
                }
 
538
 
 
539
                public Selector Feature {
 
540
                        get {
 
541
                                return (Selector) Feature;
 
542
                        }
 
543
                }
 
544
        }
 
545
 
 
546
        public class CTFontFeatureCursiveConnection : CTFontFeatureSelectors
 
547
        {
 
548
                public enum Selector
 
549
                {
 
550
                        Unconnected          = 0,
 
551
                        PartiallyConnected   = 1,
 
552
                        Cursive              = 2
 
553
                }
 
554
 
 
555
                public CTFontFeatureCursiveConnection (NSDictionary dictionary)
 
556
                        : base (dictionary)
 
557
                {
 
558
                }
 
559
 
 
560
                public Selector Feature {
 
561
                        get {
 
562
                                return (Selector) Feature;
 
563
                        }
 
564
                }
 
565
        }
 
566
 
 
567
        public class CTFontFeatureVerticalSubstitutionConnection : CTFontFeatureSelectors
 
568
        {
 
569
                public enum Selector
 
570
                {
 
571
                        SubstituteVerticalFormsOn = 0,
 
572
                        SubstituteVerticalFormsOff = 1
 
573
                }
 
574
 
 
575
                public CTFontFeatureVerticalSubstitutionConnection (NSDictionary dictionary)
 
576
                        : base (dictionary)
 
577
                {
 
578
                }
 
579
 
 
580
                public Selector Feature {
 
581
                        get {
 
582
                                return (Selector) Feature;
 
583
                        }
 
584
                }
 
585
        }
 
586
 
 
587
        public class CTFontFeatureLinguisticRearrangementConnection : CTFontFeatureSelectors
 
588
        {
 
589
                public enum Selector
 
590
                {
 
591
                        LinguisticRearrangementOn = 0,
 
592
                        LinguisticRearrangementOff = 1
 
593
                }
 
594
 
 
595
                public CTFontFeatureLinguisticRearrangementConnection (NSDictionary dictionary)
 
596
                        : base (dictionary)
 
597
                {
 
598
                }
 
599
 
 
600
                public Selector Feature {
 
601
                        get {
 
602
                                return (Selector) Feature;
 
603
                        }
 
604
                }
 
605
        }
 
606
 
 
607
        public class CTFontFeatureNumberSpacing : CTFontFeatureSelectors
 
608
        {
 
609
                public enum Selector
 
610
                {
 
611
                        MonospacedNumbers    = 0,
 
612
                        ProportionalNumbers  = 1,
 
613
                        ThirdWidthNumbers    = 2,
 
614
                        QuarterWidthNumbers  = 3
 
615
                }
 
616
 
 
617
                public CTFontFeatureNumberSpacing (NSDictionary dictionary)
 
618
                        : base (dictionary)
 
619
                {
 
620
                }
 
621
 
 
622
                public Selector Feature {
 
623
                        get {
 
624
                                return (Selector) Feature;
 
625
                        }
 
626
                }
 
627
        }
 
628
 
 
629
        public class CTFontFeatureSmartSwash : CTFontFeatureSelectors
 
630
        {
 
631
                public enum Selector
 
632
                {
 
633
                        WordInitialSwashesOn = 0,
 
634
                        WordInitialSwashesOff = 1,
 
635
                        WordFinalSwashesOn   = 2,
 
636
                        WordFinalSwashesOff  = 3,
 
637
                        LineInitialSwashesOn = 4,
 
638
                        LineInitialSwashesOff = 5,
 
639
                        LineFinalSwashesOn   = 6,
 
640
                        LineFinalSwashesOff  = 7,
 
641
                        NonFinalSwashesOn    = 8,
 
642
                        NonFinalSwashesOff   = 9
 
643
                }
 
644
 
 
645
                public CTFontFeatureSmartSwash (NSDictionary dictionary)
 
646
                        : base (dictionary)
 
647
                {
 
648
                }
 
649
 
 
650
                public Selector Feature {
 
651
                        get {
 
652
                                return (Selector) Feature;
 
653
                        }
 
654
                }
 
655
        }
 
656
 
 
657
        public class CTFontFeatureDiacritics : CTFontFeatureSelectors
 
658
        {
 
659
                public enum Selector
 
660
                {
 
661
                        ShowDiacritics       = 0,
 
662
                        HideDiacritics       = 1,
 
663
                        DecomposeDiacritics  = 2
 
664
                }
 
665
 
 
666
                public CTFontFeatureDiacritics (NSDictionary dictionary)
 
667
                        : base (dictionary)
 
668
                {
 
669
                }
 
670
 
 
671
                public Selector Feature {
 
672
                        get {
 
673
                                return (Selector) FeatureWeak;
 
674
                        }
 
675
                }
 
676
        }
 
677
 
 
678
        public class CTFontFeatureVerticalPosition : CTFontFeatureSelectors
 
679
        {
 
680
                public enum Selector
 
681
                {
 
682
                        NormalPosition       = 0,
 
683
                        Superiors            = 1,
 
684
                        Inferiors            = 2,
 
685
                        Ordinals             = 3,
 
686
                        ScientificInferiors  = 4
 
687
                }
 
688
 
 
689
                public CTFontFeatureVerticalPosition (NSDictionary dictionary)
 
690
                        : base (dictionary)
 
691
                {
 
692
                }
 
693
 
 
694
                public Selector Feature {
 
695
                        get {
 
696
                                return (Selector) FeatureWeak;
 
697
                        }
 
698
                }
 
699
        }
 
700
 
 
701
        public class CTFontFeatureFractions : CTFontFeatureSelectors
 
702
        {
 
703
                public enum Selector
 
704
                {
 
705
                        NoFractions          = 0,
 
706
                        VerticalFractions    = 1,
 
707
                        DiagonalFractions    = 2                        
 
708
                }
 
709
 
 
710
                public CTFontFeatureFractions (NSDictionary dictionary)
 
711
                        : base (dictionary)
 
712
                {
 
713
                }
 
714
 
 
715
                public Selector Feature {
 
716
                        get {
 
717
                                return (Selector) FeatureWeak;
 
718
                        }
 
719
                }
 
720
        }
 
721
 
 
722
        public class CTFontFeatureOverlappingCharacters : CTFontFeatureSelectors
 
723
        {
 
724
                public enum Selector
 
725
                {
 
726
                        PreventOverlapOn     = 0,
 
727
                        PreventOverlapOff    = 1
 
728
                }
 
729
 
 
730
                public CTFontFeatureOverlappingCharacters (NSDictionary dictionary)
 
731
                        : base (dictionary)
 
732
                {
 
733
                }
 
734
 
 
735
                public Selector Feature {
 
736
                        get {
 
737
                                return (Selector) FeatureWeak;
 
738
                        }
 
739
                }
 
740
        }
 
741
 
 
742
        public class CTFontFeatureTypographicExtras : CTFontFeatureSelectors
 
743
        {
 
744
                public enum Selector
 
745
                {
 
746
                        HyphensToEmDashOn    = 0,
 
747
                        HyphensToEmDashOff   = 1,
 
748
                        HyphenToEnDashOn     = 2,
 
749
                        HyphenToEnDashOff    = 3,
 
750
                        SlashedZeroOn        = 4,
 
751
                        SlashedZeroOff       = 5,
 
752
                        FormInterrobangOn    = 6,
 
753
                        FormInterrobangOff   = 7,
 
754
                        SmartQuotesOn        = 8,
 
755
                        SmartQuotesOff       = 9,
 
756
                        PeriodsToEllipsisOn  = 10,
 
757
                        PeriodsToEllipsisOff = 11
 
758
                }
 
759
 
 
760
                public CTFontFeatureTypographicExtras (NSDictionary dictionary)
 
761
                        : base (dictionary)
 
762
                {
 
763
                }
 
764
 
 
765
                public Selector Feature {
 
766
                        get {
 
767
                                return (Selector) FeatureWeak;
 
768
                        }
 
769
                }
 
770
        }
 
771
 
 
772
        public class CTFontFeatureMathematicalExtras : CTFontFeatureSelectors
 
773
        {
 
774
                public enum Selector
 
775
                {
 
776
                        HyphenToMinusOn      = 0,
 
777
                        HyphenToMinusOff     = 1,
 
778
                        AsteriskToMultiplyOn = 2,
 
779
                        AsteriskToMultiplyOff = 3,
 
780
                        SlashToDivideOn      = 4,
 
781
                        SlashToDivideOff     = 5,
 
782
                        InequalityLigaturesOn = 6,
 
783
                        InequalityLigaturesOff = 7,
 
784
                        ExponentsOn          = 8,
 
785
                        ExponentsOff         = 9,
 
786
                        MathematicalGreekOn  = 10,
 
787
                        MathematicalGreekOff = 11
 
788
                }
 
789
 
 
790
                public CTFontFeatureMathematicalExtras (NSDictionary dictionary)
 
791
                        : base (dictionary)
 
792
                {
 
793
                }
 
794
 
 
795
                public Selector Feature {
 
796
                        get {
 
797
                                return (Selector) FeatureWeak;
 
798
                        }
 
799
                }
 
800
        }
 
801
 
 
802
        public class CTFontFeatureOrnamentSets : CTFontFeatureSelectors
 
803
        {
 
804
                public enum Selector
 
805
                {
 
806
                        NoOrnaments          = 0,
 
807
                        Dingbats             = 1,
 
808
                        PiCharacters         = 2,
 
809
                        Fleurons             = 3,
 
810
                        DecorativeBorders    = 4,
 
811
                        InternationalSymbols = 5,
 
812
                        MathSymbols          = 6
 
813
                }
 
814
 
 
815
                public CTFontFeatureOrnamentSets (NSDictionary dictionary)
 
816
                        : base (dictionary)
 
817
                {
 
818
                }
 
819
 
 
820
                public Selector Feature {
 
821
                        get {
 
822
                                return (Selector) FeatureWeak;
 
823
                        }
 
824
                }
 
825
        }
 
826
 
 
827
        public class CTFontFeatureCharacterAlternatives : CTFontFeatureSelectors
 
828
        {
 
829
                public enum Selector
 
830
                {
 
831
                        NoAlternates          = 0,
 
832
                }
 
833
 
 
834
                public CTFontFeatureCharacterAlternatives (NSDictionary dictionary)
 
835
                        : base (dictionary)
 
836
                {
 
837
                }
 
838
 
 
839
                public Selector Feature {
 
840
                        get {
 
841
                                return (Selector) FeatureWeak;
 
842
                        }
 
843
                }
 
844
        }
 
845
 
 
846
        public class CTFontFeatureDesignComplexity : CTFontFeatureSelectors
 
847
        {
 
848
                public enum Selector
 
849
                {
 
850
                        DesignLevel1         = 0,
 
851
                        DesignLevel2         = 1,
 
852
                        DesignLevel3         = 2,
 
853
                        DesignLevel4         = 3,
 
854
                        DesignLevel5         = 4
 
855
                }
 
856
 
 
857
                public CTFontFeatureDesignComplexity (NSDictionary dictionary)
 
858
                        : base (dictionary)
 
859
                {
 
860
                }
 
861
 
 
862
                public Selector Feature {
 
863
                        get {
 
864
                                return (Selector) FeatureWeak;
 
865
                        }
 
866
                }
 
867
        }
 
868
 
 
869
        public class CTFontFeatureStyleOptions : CTFontFeatureSelectors
 
870
        {
 
871
                public enum Selector
 
872
                {
 
873
                        NoStyleOptions       = 0,
 
874
                        DisplayText          = 1,
 
875
                        EngravedText         = 2,
 
876
                        IlluminatedCaps      = 3,
 
877
                        TitlingCaps          = 4,
 
878
                        TallCaps             = 5
 
879
                }
 
880
 
 
881
                public CTFontFeatureStyleOptions (NSDictionary dictionary)
 
882
                        : base (dictionary)
 
883
                {
 
884
                }
 
885
 
 
886
                public Selector Feature {
 
887
                        get {
 
888
                                return (Selector) FeatureWeak;
 
889
                        }
 
890
                }
 
891
        }
 
892
 
 
893
        public class CTFontFeatureCharacterShape : CTFontFeatureSelectors
 
894
        {
 
895
                public enum Selector
 
896
                {
 
897
                        TraditionalCharacters = 0,
 
898
                        SimplifiedCharacters = 1,
 
899
                        JIS1978Characters    = 2,
 
900
                        JIS1983Characters    = 3,
 
901
                        JIS1990Characters    = 4,
 
902
                        TraditionalAltOne    = 5,
 
903
                        TraditionalAltTwo    = 6,
 
904
                        TraditionalAltThree  = 7,
 
905
                        TraditionalAltFour   = 8,
 
906
                        TraditionalAltFive   = 9,
 
907
                        ExpertCharacters     = 10,
 
908
                        JIS2004Characters    = 11,
 
909
                        HojoCharacters       = 12,
 
910
                        NLCCharacters        = 13,
 
911
                        TraditionalNamesCharacters = 14
 
912
                }
 
913
 
 
914
                public CTFontFeatureCharacterShape (NSDictionary dictionary)
 
915
                        : base (dictionary)
 
916
                {
 
917
                }
 
918
 
 
919
                public Selector Feature {
 
920
                        get {
 
921
                                return (Selector) FeatureWeak;
 
922
                        }
 
923
                }
 
924
        }
 
925
 
 
926
        public class CTFontFeatureNumberCase : CTFontFeatureSelectors
 
927
        {
 
928
                public enum Selector
 
929
                {
 
930
                        LowerCaseNumbers     = 0,
 
931
                        UpperCaseNumbers     = 1
 
932
                }
 
933
 
 
934
                public CTFontFeatureNumberCase (NSDictionary dictionary)
 
935
                        : base (dictionary)
 
936
                {
 
937
                }
 
938
 
 
939
                public Selector Feature {
 
940
                        get {
 
941
                                return (Selector) FeatureWeak;
 
942
                        }
 
943
                }
 
944
        }
 
945
 
 
946
        public class CTFontFeatureTextSpacing : CTFontFeatureSelectors
 
947
        {
 
948
                public enum Selector
 
949
                {
 
950
                        ProportionalText     = 0,
 
951
                        MonospacedText       = 1,
 
952
                        HalfWidthText        = 2,
 
953
                        ThirdWidthText       = 3,
 
954
                        QuarterWidthText     = 4,
 
955
                        AltProportionalText  = 5,
 
956
                        AltHalfWidthText     = 6
 
957
                }
 
958
 
 
959
                public CTFontFeatureTextSpacing (NSDictionary dictionary)
 
960
                        : base (dictionary)
 
961
                {
 
962
                }
 
963
 
 
964
                public Selector Feature {
 
965
                        get {
 
966
                                return (Selector) FeatureWeak;
 
967
                        }
 
968
                }
 
969
        }
 
970
 
 
971
        public class CTFontFeatureTransliteration : CTFontFeatureSelectors
 
972
        {
 
973
                public enum Selector
 
974
                {
 
975
                        NoTransliteration    = 0,
 
976
                        HanjaToHangul        = 1,
 
977
                        HiraganaToKatakana   = 2,
 
978
                        KatakanaToHiragana   = 3,
 
979
                        KanaToRomanization   = 4,
 
980
                        RomanizationToHiragana = 5,
 
981
                        RomanizationToKatakana = 6,
 
982
                        HanjaToHangulAltOne  = 7,
 
983
                        HanjaToHangulAltTwo  = 8,
 
984
                        HanjaToHangulAltThree = 9
 
985
                }
 
986
 
 
987
                public CTFontFeatureTransliteration (NSDictionary dictionary)
 
988
                        : base (dictionary)
 
989
                {
 
990
                }
 
991
 
 
992
                public Selector Feature {
 
993
                        get {
 
994
                                return (Selector) FeatureWeak;
 
995
                        }
 
996
                }
 
997
        }
 
998
 
 
999
        public class CTFontFeatureAnnotation : CTFontFeatureSelectors
 
1000
        {
 
1001
                public enum Selector
 
1002
                {
 
1003
                        NoAnnotation         = 0,
 
1004
                        BoxAnnotation        = 1,
 
1005
                        RoundedBoxAnnotation = 2,
 
1006
                        CircleAnnotation     = 3,
 
1007
                        InvertedCircleAnnotation = 4,
 
1008
                        ParenthesisAnnotation = 5,
 
1009
                        PeriodAnnotation     = 6,
 
1010
                        RomanNumeralAnnotation = 7,
 
1011
                        DiamondAnnotation    = 8,
 
1012
                        InvertedBoxAnnotation = 9,
 
1013
                        InvertedRoundedBoxAnnotation = 10
 
1014
                }
 
1015
 
 
1016
                public CTFontFeatureAnnotation (NSDictionary dictionary)
 
1017
                        : base (dictionary)
 
1018
                {
 
1019
                }
 
1020
 
 
1021
                public Selector Feature {
 
1022
                        get {
 
1023
                                return (Selector) FeatureWeak;
 
1024
                        }
 
1025
                }
 
1026
        }
 
1027
 
 
1028
        public class CTFontFeatureKanaSpacing : CTFontFeatureSelectors
 
1029
        {
 
1030
                public enum Selector
 
1031
                {
 
1032
                        FullWidthKana        = 0,
 
1033
                        ProportionalKana     = 1
 
1034
                }
 
1035
 
 
1036
                public CTFontFeatureKanaSpacing (NSDictionary dictionary)
 
1037
                        : base (dictionary)
 
1038
                {
 
1039
                }
 
1040
 
 
1041
                public Selector Feature {
 
1042
                        get {
 
1043
                                return (Selector) FeatureWeak;
 
1044
                        }
 
1045
                }
 
1046
        }
 
1047
 
 
1048
        public class CTFontFeatureIdeographicSpacing : CTFontFeatureSelectors
 
1049
        {
 
1050
                public enum Selector
 
1051
                {
 
1052
                        FullWidthIdeographs  = 0,
 
1053
                        ProportionalIdeographs = 1,
 
1054
                        HalfWidthIdeographs  = 2
 
1055
                }
 
1056
 
 
1057
                public CTFontFeatureIdeographicSpacing (NSDictionary dictionary)
 
1058
                        : base (dictionary)
 
1059
                {
 
1060
                }
 
1061
 
 
1062
                public Selector Feature {
 
1063
                        get {
 
1064
                                return (Selector) FeatureWeak;
 
1065
                        }
 
1066
                }
 
1067
        }
 
1068
 
 
1069
        public class CTFontFeatureUnicodeDecomposition : CTFontFeatureSelectors
 
1070
        {
 
1071
                public enum Selector
 
1072
                {
 
1073
                        CanonicalCompositionOn = 0,
 
1074
                        CanonicalCompositionOff = 1,
 
1075
                        CompatibilityCompositionOn = 2,
 
1076
                        CompatibilityCompositionOff = 3,
 
1077
                        TranscodingCompositionOn = 4,
 
1078
                        TranscodingCompositionOff = 5
 
1079
                }
 
1080
 
 
1081
                public CTFontFeatureUnicodeDecomposition (NSDictionary dictionary)
 
1082
                        : base (dictionary)
 
1083
                {
 
1084
                }
 
1085
 
 
1086
                public Selector Feature {
 
1087
                        get {
 
1088
                                return (Selector) FeatureWeak;
 
1089
                        }
 
1090
                }
 
1091
        }
 
1092
 
 
1093
        public class CTFontFeatureRubyKana : CTFontFeatureSelectors
 
1094
        {
 
1095
                public enum Selector
 
1096
                {
 
1097
                        [Obsolete ("Deprecated. Use RubyKanaOn instead")]
 
1098
                        NoRubyKana           = 0,
 
1099
                        [Obsolete ("Deprecated. Use RubyKanaOff instead")]
 
1100
                        RubyKana             = 1,
 
1101
                        RubyKanaOn           = 2,
 
1102
                        RubyKanaOff          = 3
 
1103
                }
 
1104
 
 
1105
                public CTFontFeatureRubyKana (NSDictionary dictionary)
 
1106
                        : base (dictionary)
 
1107
                {
 
1108
                }
 
1109
 
 
1110
                public Selector Feature {
 
1111
                        get {
 
1112
                                return (Selector) FeatureWeak;
 
1113
                        }
 
1114
                }
 
1115
        }
 
1116
 
 
1117
        public class CTFontFeatureCJKSymbolAlternatives : CTFontFeatureSelectors
 
1118
        {
 
1119
                public enum Selector
 
1120
                {
 
1121
                        NoCJKSymbolAlternatives = 0,
 
1122
                        CJKSymbolAltOne      = 1,
 
1123
                        CJKSymbolAltTwo      = 2,
 
1124
                        CJKSymbolAltThree    = 3,
 
1125
                        CJKSymbolAltFour     = 4,
 
1126
                        CJKSymbolAltFive     = 5
 
1127
                }
 
1128
 
 
1129
                public CTFontFeatureCJKSymbolAlternatives (NSDictionary dictionary)
 
1130
                        : base (dictionary)
 
1131
                {
 
1132
                }
 
1133
 
 
1134
                public Selector Feature {
 
1135
                        get {
 
1136
                                return (Selector) FeatureWeak;
 
1137
                        }
 
1138
                }
 
1139
        }
 
1140
 
 
1141
        public class CTFontFeatureIdeographicAlternatives : CTFontFeatureSelectors
 
1142
        {
 
1143
                public enum Selector
 
1144
                {
 
1145
                        NoIdeographicAlternatives = 0,
 
1146
                        IdeographicAltOne    = 1,
 
1147
                        IdeographicAltTwo    = 2,
 
1148
                        IdeographicAltThree  = 3,
 
1149
                        IdeographicAltFour   = 4,
 
1150
                        IdeographicAltFive   = 5
 
1151
                }
 
1152
 
 
1153
                public CTFontFeatureIdeographicAlternatives (NSDictionary dictionary)
 
1154
                        : base (dictionary)
 
1155
                {
 
1156
                }
 
1157
 
 
1158
                public Selector Feature {
 
1159
                        get {
 
1160
                                return (Selector) FeatureWeak;
 
1161
                        }
 
1162
                }
 
1163
        }
 
1164
 
 
1165
        public class CTFontFeatureCJKVerticalRomanPlacement : CTFontFeatureSelectors
 
1166
        {
 
1167
                public enum Selector
 
1168
                {
 
1169
                        CJKVerticalRomanCentered = 0,
 
1170
                        CJKVerticalRomanHBaseline = 1
 
1171
                }
 
1172
 
 
1173
                public CTFontFeatureCJKVerticalRomanPlacement (NSDictionary dictionary)
 
1174
                        : base (dictionary)
 
1175
                {
 
1176
                }
 
1177
 
 
1178
                public Selector Feature {
 
1179
                        get {
 
1180
                                return (Selector) FeatureWeak;
 
1181
                        }
 
1182
                }
 
1183
        }
 
1184
 
 
1185
        public class CTFontFeatureItalicCJKRoman : CTFontFeatureSelectors
 
1186
        {
 
1187
                public enum Selector
 
1188
                {
 
1189
                        [Obsolete ("Deprecated. Use CJKItalicRomanOff instead")]
 
1190
                        NoCJKItalicRoman     = 0,
 
1191
                        [Obsolete ("Deprecated. Use CJKItalicRomanOn instead")]
 
1192
                        CJKItalicRoman       = 1,
 
1193
                        CJKItalicRomanOn     = 2,
 
1194
                        CJKItalicRomanOff    = 3
 
1195
                }
 
1196
 
 
1197
                public CTFontFeatureItalicCJKRoman (NSDictionary dictionary)
 
1198
                        : base (dictionary)
 
1199
                {
 
1200
                }
 
1201
 
 
1202
                public Selector Feature {
 
1203
                        get {
 
1204
                                return (Selector) FeatureWeak;
 
1205
                        }
 
1206
                }
 
1207
        }
 
1208
 
 
1209
        public class CTFontFeatureCaseSensitiveLayout : CTFontFeatureSelectors
 
1210
        {
 
1211
                public enum Selector
 
1212
                {
 
1213
                        CaseSensitiveLayoutOn = 0,
 
1214
                        CaseSensitiveLayoutOff = 1,
 
1215
                        CaseSensitiveSpacingOn = 2,
 
1216
                        CaseSensitiveSpacingOff = 3
 
1217
                }
 
1218
 
 
1219
                public CTFontFeatureCaseSensitiveLayout (NSDictionary dictionary)
 
1220
                        : base (dictionary)
 
1221
                {
 
1222
                }
 
1223
 
 
1224
                public Selector Feature {
 
1225
                        get {
 
1226
                                return (Selector) FeatureWeak;
 
1227
                        }
 
1228
                }
 
1229
        }
 
1230
 
 
1231
        public class CTFontFeatureAlternateKana : CTFontFeatureSelectors
 
1232
        {
 
1233
                public enum Selector
 
1234
                {
 
1235
                        AlternateHorizKanaOn = 0,
 
1236
                        AlternateHorizKanaOff = 1,
 
1237
                        AlternateVertKanaOn  = 2,
 
1238
                        AlternateVertKanaOff = 3
 
1239
                }
 
1240
 
 
1241
                public CTFontFeatureAlternateKana (NSDictionary dictionary)
 
1242
                        : base (dictionary)
 
1243
                {
 
1244
                }
 
1245
 
 
1246
                public Selector Feature {
 
1247
                        get {
 
1248
                                return (Selector) FeatureWeak;
 
1249
                        }
 
1250
                }
 
1251
        }
 
1252
 
 
1253
        public class CTFontFeatureStylisticAlternatives : CTFontFeatureSelectors
 
1254
        {
 
1255
                public enum Selector
 
1256
                {
 
1257
                        NoStylisticAlternates = 0,
 
1258
                        StylisticAltOneOn    = 2,
 
1259
                        StylisticAltOneOff   = 3,
 
1260
                        StylisticAltTwoOn    = 4,
 
1261
                        StylisticAltTwoOff   = 5,
 
1262
                        StylisticAltThreeOn  = 6,
 
1263
                        StylisticAltThreeOff = 7,
 
1264
                        StylisticAltFourOn   = 8,
 
1265
                        StylisticAltFourOff  = 9,
 
1266
                        StylisticAltFiveOn   = 10,
 
1267
                        StylisticAltFiveOff  = 11,
 
1268
                        StylisticAltSixOn    = 12,
 
1269
                        StylisticAltSixOff   = 13,
 
1270
                        StylisticAltSevenOn  = 14,
 
1271
                        StylisticAltSevenOff = 15,
 
1272
                        StylisticAltEightOn  = 16,
 
1273
                        StylisticAltEightOff = 17,
 
1274
                        StylisticAltNineOn   = 18,
 
1275
                        StylisticAltNineOff  = 19,
 
1276
                        StylisticAltTenOn    = 20,
 
1277
                        StylisticAltTenOff   = 21,
 
1278
                        StylisticAltElevenOn = 22,
 
1279
                        StylisticAltElevenOff = 23,
 
1280
                        StylisticAltTwelveOn = 24,
 
1281
                        StylisticAltTwelveOff = 25,
 
1282
                        StylisticAltThirteenOn = 26,
 
1283
                        StylisticAltThirteenOff = 27,
 
1284
                        StylisticAltFourteenOn = 28,
 
1285
                        StylisticAltFourteenOff = 29,
 
1286
                        StylisticAltFifteenOn = 30,
 
1287
                        StylisticAltFifteenOff = 31,
 
1288
                        StylisticAltSixteenOn = 32,
 
1289
                        StylisticAltSixteenOff = 33,
 
1290
                        StylisticAltSeventeenOn = 34,
 
1291
                        StylisticAltSeventeenOff = 35,
 
1292
                        StylisticAltEighteenOn = 36,
 
1293
                        StylisticAltEighteenOff = 37,
 
1294
                        StylisticAltNineteenOn = 38,
 
1295
                        StylisticAltNineteenOff = 39,
 
1296
                        StylisticAltTwentyOn = 40,
 
1297
                        StylisticAltTwentyOff = 41
 
1298
                }
 
1299
 
 
1300
                public CTFontFeatureStylisticAlternatives (NSDictionary dictionary)
 
1301
                        : base (dictionary)
 
1302
                {
 
1303
                }
 
1304
 
 
1305
                public Selector Feature {
 
1306
                        get {
 
1307
                                return (Selector) FeatureWeak;
 
1308
                        }
 
1309
                }
 
1310
        }
 
1311
 
 
1312
        public class CTFontFeatureContextualAlternates : CTFontFeatureSelectors
 
1313
        {
 
1314
                public enum Selector
 
1315
                {
 
1316
                        ContextualAlternatesOn = 0,
 
1317
                        ContextualAlternatesOff = 1,
 
1318
                        SwashAlternatesOn    = 2,
 
1319
                        SwashAlternatesOff   = 3,
 
1320
                        ContextualSwashAlternatesOn = 4,
 
1321
                        ContextualSwashAlternatesOff = 5
 
1322
                }
 
1323
 
 
1324
                public CTFontFeatureContextualAlternates (NSDictionary dictionary)
 
1325
                        : base (dictionary)
 
1326
                {
 
1327
                }
 
1328
 
 
1329
                public Selector Feature {
 
1330
                        get {
 
1331
                                return (Selector) FeatureWeak;
 
1332
                        }
 
1333
                }
 
1334
        }
 
1335
 
 
1336
        public class CTFontFeatureLowerCase : CTFontFeatureSelectors
 
1337
        {
 
1338
                public enum Selector
 
1339
                {
 
1340
                        DefaultLowerCase     = 0,
 
1341
                        LowerCaseSmallCaps   = 1,
 
1342
                        LowerCasePetiteCaps  = 2
 
1343
                }
 
1344
 
 
1345
                public CTFontFeatureLowerCase (NSDictionary dictionary)
 
1346
                        : base (dictionary)
 
1347
                {
 
1348
                }
 
1349
 
 
1350
                public Selector Feature {
 
1351
                        get {
 
1352
                                return (Selector) FeatureWeak;
 
1353
                        }
 
1354
                }
 
1355
        }
 
1356
 
 
1357
        public class CTFontFeatureUpperCase : CTFontFeatureSelectors
 
1358
        {
 
1359
                public enum Selector
 
1360
                {
 
1361
                        DefaultUpperCase     = 0,
 
1362
                        UpperCaseSmallCaps   = 1,
 
1363
                        UpperCasePetiteCaps  = 2
 
1364
                }
 
1365
 
 
1366
                public CTFontFeatureUpperCase (NSDictionary dictionary)
 
1367
                        : base (dictionary)
 
1368
                {
 
1369
                }
 
1370
 
 
1371
                public Selector Feature {
 
1372
                        get {
 
1373
                                return (Selector) FeatureWeak;
 
1374
                        }
 
1375
                }
 
1376
        }
 
1377
 
 
1378
        public class CTFontFeatureCJKRomanSpacing : CTFontFeatureSelectors
 
1379
        {
 
1380
                public enum Selector
 
1381
                {
 
1382
                        HalfWidthCJKRoman    = 0,
 
1383
                        ProportionalCJKRoman = 1,
 
1384
                        DefaultCJKRoman      = 2,
 
1385
                        FullWidthCJKRoman    = 3
 
1386
                }
 
1387
 
 
1388
                public CTFontFeatureCJKRomanSpacing (NSDictionary dictionary)
 
1389
                        : base (dictionary)
 
1390
                {
 
1391
                }
 
1392
 
 
1393
                public Selector Feature {
 
1394
                        get {
 
1395
                                return (Selector) FeatureWeak;
 
1396
                        }
 
1397
                }
 
1398
        }
 
1399
 
309
1400
        [Since (3,2)]
310
1401
        public class CTFontFeatureSettings {
311
1402
 
312
 
                public CTFontFeatureSettings ()
313
 
                        : this (new NSMutableDictionary ())
314
 
                {
315
 
                }
316
 
 
 
1403
                // It should be internal
317
1404
                public CTFontFeatureSettings (NSDictionary dictionary)
318
1405
                {
319
1406
                        if (dictionary == null)
323
1410
 
324
1411
                public NSDictionary Dictionary {get; private set;}
325
1412
 
326
 
                // TODO: what kind of number?
 
1413
                [Advice ("Use FeatureGroup property instead")]
327
1414
                public NSNumber TypeIdentifier {
328
1415
                        get {return (NSNumber) Dictionary [CTFontFeatureKey.Identifier];}
329
1416
                        set {Adapter.SetValue (Dictionary, CTFontFeatureKey.Identifier, value);}
330
1417
                }
331
1418
 
332
 
                // TODO: what kind of number?
 
1419
                public FontFeatureGroup FeatureGroup {
 
1420
                        get {
 
1421
                                return (FontFeatureGroup) (int) (NSNumber) Dictionary [CTFontFeatureKey.Identifier];
 
1422
                        }
 
1423
                }
 
1424
 
 
1425
                [Advice ("Use FeatureWeak or FeatureGroup instead")]
333
1426
                public NSNumber SelectorIdentifier {
334
1427
                        get {return (NSNumber) Dictionary [CTFontFeatureSelectorKey.Identifier];}
335
1428
                        set {Adapter.SetValue (Dictionary, CTFontFeatureSelectorKey.Identifier, value);}
336
1429
                }
 
1430
 
 
1431
                public int FeatureWeak {
 
1432
                        get {
 
1433
                                return (int) (NSNumber) Dictionary [CTFontFeatureSelectorKey.Identifier];
 
1434
                        }
 
1435
                }
337
1436
        }
338
1437
 
339
1438
        [Since (3,2)]
907
2006
                        return CTFontGetBoundingRectsForGlyphs (handle, orientation, glyphs, boundingRects, count);
908
2007
                }
909
2008
 
 
2009
                [DllImport (Constants.CoreTextLibrary)]
 
2010
                static extern RectangleF CTFontGetOpticalBoundsForGlyphs (IntPtr font, [In] CGGlyph[] glyphs, [Out] RectangleF[] boundingRects, int count, CTFontOptions options);
 
2011
                [Since (6,0)]
 
2012
                public RectangleF GetOpticalBounds (CGGlyph[] glyphs, RectangleF[] boundingRects, int count, CTFontOptions options = 0)
 
2013
                {
 
2014
                        AssertCount (count);
 
2015
                        AssertLength ("glyphs",         glyphs, count);
 
2016
                        AssertLength ("boundingRects",  boundingRects, count, true);
 
2017
 
 
2018
                        return CTFontGetOpticalBoundsForGlyphs (handle, glyphs, boundingRects, count, 0);
 
2019
                }
 
2020
 
910
2021
                public RectangleF GetBoundingRects (CTFontOrientation orientation, CGGlyph[] glyphs)
911
2022
                {
912
2023
                        if (glyphs == null)
1021
2132
#region Font Features
1022
2133
                [DllImport (Constants.CoreTextLibrary)]
1023
2134
                static extern IntPtr CTFontCopyFeatures (IntPtr font);
 
2135
 
 
2136
                // Always returns only default features
1024
2137
                public CTFontFeatures[] GetFeatures ()
1025
2138
                {
1026
2139
                        var cfArrayRef = CTFontCopyFeatures (handle);
1034
2147
 
1035
2148
                [DllImport (Constants.CoreTextLibrary)]
1036
2149
                static extern IntPtr CTFontCopyFeatureSettings (IntPtr font);
 
2150
 
1037
2151
                public CTFontFeatureSettings[] GetFeatureSettings ()
1038
2152
                {
1039
2153
                        var cfArrayRef = CTFontCopyFeatureSettings (handle);
1091
2205
                }
1092
2206
#endregion
1093
2207
 
 
2208
#region
 
2209
                [DllImport (Constants.CoreTextLibrary, EntryPoint="CTFontGetTypeID")]
 
2210
                extern static IntPtr CTFontCopyDefaultCascadeListForLanguages (IntPtr font, IntPtr languagePrefList);
 
2211
 
 
2212
                [Since (6,0)]
 
2213
                public CTFontDescriptor [] GetDefaultCascadeList (string [] languages)
 
2214
                {
 
2215
                        if (languages == null)
 
2216
                                throw new ArgumentNullException ("languages");
 
2217
                        using (var arr = NSArray.FromStrings (languages)){
 
2218
                                using (var retArray = new CFArray (CTFontCopyDefaultCascadeListForLanguages (handle, arr.Handle), true)){
 
2219
                                        int n = retArray.Count;
 
2220
 
 
2221
                                        var ret = new CTFontDescriptor [n];
 
2222
                                        for (int i = 0; i < n; i++)
 
2223
                                                ret [i] = new CTFontDescriptor (retArray.GetValue (i), true);
 
2224
 
 
2225
                                        return ret;
 
2226
                                }
 
2227
                        }
 
2228
                }
 
2229
 
 
2230
#endregion
1094
2231
                public override string ToString ()
1095
2232
                {
1096
2233
                        return FullName;