@@ -788,9 +788,23 @@ fn out_of_range_variations() {
788
788
let var_desc = variation_font. copy_descriptor ( ) ;
789
789
let var_attrs = var_desc. attributes ( ) ;
790
790
dbg ! ( & var_attrs) ;
791
- // attributes greater than max are dropped
791
+ // attributes greater than max are dropped on macOS <= 11
792
+ // on macOS 12 they seem to be preserved as is.
792
793
let var_attrs = var_attrs. find ( variation_attribute) ;
793
- if macos_version ( ) >= ( 10 , 15 , 0 ) {
794
+ if macos_version ( ) >= ( 12 , 0 , 0 ) {
795
+ let var_attrs = var_attrs. unwrap ( ) . downcast :: < CFDictionary > ( ) . unwrap ( ) ;
796
+ assert ! ( !var_attrs. is_empty( ) ) ;
797
+ let var_attrs: CFDictionary < CFType , CFType > = unsafe { std:: mem:: transmute ( var_attrs) } ;
798
+ // attributes greater than max remain
799
+ for axis in axes. iter ( ) {
800
+ let tag = axis. find ( unsafe { kCTFontVariationAxisIdentifierKey } )
801
+ . unwrap ( ) ;
802
+ let max = axis. find ( unsafe { kCTFontVariationAxisMaximumValueKey } )
803
+ . unwrap ( ) . downcast :: < CFNumber > ( ) . unwrap ( ) . to_f64 ( ) . unwrap ( ) ;
804
+ let val = var_attrs. find ( tag. clone ( ) ) . unwrap ( ) . downcast :: < CFNumber > ( ) . unwrap ( ) . to_f64 ( ) . unwrap ( ) ;
805
+ assert_eq ! ( val, max + 1. ) ;
806
+ }
807
+ } else if macos_version ( ) >= ( 10 , 15 , 0 ) {
794
808
assert ! ( var_attrs. is_none( ) ) ;
795
809
} else {
796
810
let var_attrs = var_attrs. unwrap ( ) . downcast :: < CFDictionary > ( ) . unwrap ( ) ;
0 commit comments