File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -757,7 +757,7 @@ fn variations_dict() {
757757 let var_font = CGFont :: create_copy_from_variations ( & font, & vars) . unwrap ( ) ;
758758 match macos_version ( ) {
759759 ( 10 , 11 , _) => {
760- assert ! ( font. copy_variation_axis ( ) . is_none( ) ) ;
760+ assert ! ( font. copy_variation_axes ( ) . is_none( ) ) ;
761761 return ;
762762 }
763763 _ => { }
@@ -778,3 +778,26 @@ fn variations_dict() {
778778 _ => assert ! ( var. find( CFNumber :: from( 0x77676874 ) ) . is_some( ) ) ,
779779 }
780780}
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+ assert ! ( false ) ;
803+ }
You can’t perform that action at this time.
0 commit comments