@@ -757,7 +757,7 @@ fn variations_dict() {
757
757
let var_font = CGFont :: create_copy_from_variations ( & font, & vars) . unwrap ( ) ;
758
758
match macos_version ( ) {
759
759
( 10 , 11 , _) => {
760
- assert ! ( font. copy_variation_axis ( ) . is_none( ) ) ;
760
+ assert ! ( font. copy_variation_axes ( ) . is_none( ) ) ;
761
761
return ;
762
762
}
763
763
_ => { }
@@ -778,3 +778,27 @@ fn variations_dict() {
778
778
_ => assert ! ( var. find( CFNumber :: from( 0x77676874 ) ) . is_some( ) ) ,
779
779
}
780
780
}
781
+
782
+ #[ test]
783
+ fn variations_copy ( ) {
784
+ use std:: io:: Read ;
785
+ let mut f = std:: fs:: File :: open ( "variabletest_box.ttf" ) . unwrap ( ) ;
786
+ let mut buffer = Vec :: new ( ) ;
787
+ // read the whole file
788
+ f. read_to_end ( & mut buffer) . unwrap ( ) ;
789
+
790
+ let font = new_from_buffer ( & buffer) . unwrap ( ) ;
791
+ dbg ! ( & font) ;
792
+ let cg_font = font. copy_to_CGFont ( ) ;
793
+ dbg ! ( cg_font. copy_variation_axes( ) ) ;
794
+ let mut vals_str: Vec < ( CFString , CFNumber ) > = Vec :: new ( ) ;
795
+ vals_str. push ( ( CFString :: new ( "Optical Sizing" ) , ( 100. ) . into ( ) ) ) ;
796
+ vals_str. push ( ( CFString :: new ( "Upward" ) , ( 350 ) . into ( ) ) ) ;
797
+ let vars = CFDictionary :: from_CFType_pairs ( & vals_str) ;
798
+ let var_font = CGFont :: create_copy_from_variations ( & cg_font, & vars) . unwrap ( ) ;
799
+ let var_ct_font = new_from_CGFont ( & var_font, 19. ) ;
800
+ dbg ! ( & var_ct_font) ;
801
+ dbg ! ( var_ct_font. copy_descriptor( ) . attributes( ) . find( CFString :: from_static_string( "NSCTFontVariationAttribute" ) ) ) ;
802
+ dbg ! ( var_ct_font. copy_to_CGFont( ) . copy_variations( ) ) ;
803
+ assert ! ( false ) ;
804
+ }
0 commit comments