Here's some logging from a build without that patch: ``` ctfont descriptor: "<CTFontDescriptor: 0x11bf0ed60>{attributes = { NSFontNameAttribute = ".SFNS-Regular"; }>}" after create_copy_with_attributes: "<CTFontDescriptor: 0x11c20f580>{attributes = { NSCTFontFileURLAttribute = "file:///System/Library/Fonts/SFNS.ttf"; NSCTFontVariationAttribute = { 2003265652 = 200; 1869640570 = 17; }; }>}" ctfont descriptor: "<CTFontDescriptor: 0x11bf0e880>{attributes = { NSFontNameAttribute = ".SFNS-Regular"; }>}" after create_copy_with_attributes: "<CTFontDescriptor: 0x11bc6b340>{attributes = { NSCTFontFileURLAttribute = "file:///System/Library/Fonts/SFNS.ttf"; NSCTFontVariationAttribute = { 1869640570 = "31.10000038146973"; }; }>}" after create_copy_with_attributes: "<CTFontDescriptor: 0x11bc6b2e0>{attributes = { NSCTFontFileURLAttribute = "file:///System/Library/Fonts/SFNS.ttf"; NSCTFontVariationAttribute = { 1869640570 = "27.79999923706055"; }; }>}" ``` And here's logging from a build with the patch: ``` ctfont: "<CTFont: 0x132945000>{name = .SFNS-Regular, size = 12.000000, matrix = 0x0, descriptor = <CTFontDescriptor: 0x10b36c280>{attributes = { NSFontNameAttribute = ".SFNS-Regular"; }>}}" ctfont descriptor: "<CTFontDescriptor: 0x10b36c400>{attributes = { NSFontNameAttribute = ".SFNS-Regular"; NSFontSizeAttribute = 12; }>}" after create_copy_with_attributes: "<CTFontDescriptor: 0x10b10e220>{attributes = { NSCTFontFileURLAttribute = "file:///System/Library/Fonts/SFNS.ttf"; NSCTFontVariationAttribute = { 1869640570 = 20; }; NSFontSizeAttribute = 12; }>}" after create_copy_with_attributes: "<CTFontDescriptor: 0x10ac0d3a0>{attributes = { NSCTFontFileURLAttribute = "file:///System/Library/Fonts/SFNS.ttf"; NSCTFontVariationAttribute = { 2003265652 = 600; 1869640570 = 20; }; NSFontSizeAttribute = 12; }>}" after create_copy_with_attributes: "<CTFontDescriptor: 0x10b00d880>{attributes = { NSCTFontFileURLAttribute = "file:///System/Library/Fonts/SFNS.ttf"; NSCTFontVariationAttribute = { 1869640570 = 32; }; NSFontSizeAttribute = 12; }>}" after create_copy_with_attributes: "<CTFontDescriptor: 0x10af0f520>{attributes = { NSFontNameAttribute = ".SFNS-Regular"; NSFontSizeAttribute = 12; }>}" after create_copy_with_attributes: "<CTFontDescriptor: 0x133ed1820>{attributes = { NSCTFontFileURLAttribute = "file:///System/Library/Fonts/SFNS.ttf"; NSCTFontVariationAttribute = { 1869640570 = "35.59999847412109"; }; NSFontSizeAttribute = 12; }>}" after create_copy_with_attributes: "<CTFontDescriptor: 0x10ac2ad00>{attributes = { NSCTFontFileURLAttribute = "file:///System/Library/Fonts/SFNS.ttf"; NSCTFontVariationAttribute = { 1869640570 = "31.79999923706055"; }; NSFontSizeAttribute = 12; }>}" ``` The difference that stands out is that the CTFont from `core_text::font::new_from_CGFont` has an `NSFontSizeAttribute` entry in the attributes. My guess is that the presence of this attribute causes the font to ignore any variation attributes, but I haven't verified that. I tried to remove the attribute from the CTFontDescriptor but I couldn't figure out how. There is no API to remove attributes, you can only override attributes. Overriding the font size with zero did not help. ``` let attrs_dict = unsafe { CFDictionary::from_CFType_pairs(&[(CFString::wrap_under_get_rule(kCTFontSizeAttribute), CFNumber::from(0.0f32]) }; create_copy_with_attributes(&desc, attrs_dict.to_untyped()).unwrap() ``` I tried overriding with "null" but couldn't find a way to put a null value in the dictionary with our rust dictionary API.
Bug 1675185 Comment 2 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Here's some logging from a build without that patch: ``` ctfont descriptor: "<CTFontDescriptor: 0x11bf0ed60>{attributes = { NSFontNameAttribute = ".SFNS-Regular"; }>}" after create_copy_with_attributes: "<CTFontDescriptor: 0x11c20f580>{attributes = { NSCTFontFileURLAttribute = "file:///System/Library/Fonts/SFNS.ttf"; NSCTFontVariationAttribute = { 2003265652 = 200; 1869640570 = 17; }; }>}" ctfont descriptor: "<CTFontDescriptor: 0x11bf0e880>{attributes = { NSFontNameAttribute = ".SFNS-Regular"; }>}" after create_copy_with_attributes: "<CTFontDescriptor: 0x11bc6b340>{attributes = { NSCTFontFileURLAttribute = "file:///System/Library/Fonts/SFNS.ttf"; NSCTFontVariationAttribute = { 1869640570 = "31.10000038146973"; }; }>}" after create_copy_with_attributes: "<CTFontDescriptor: 0x11bc6b2e0>{attributes = { NSCTFontFileURLAttribute = "file:///System/Library/Fonts/SFNS.ttf"; NSCTFontVariationAttribute = { 1869640570 = "27.79999923706055"; }; }>}" ``` And here's logging from a build with the patch: ``` ctfont: "<CTFont: 0x132945000>{name = .SFNS-Regular, size = 12.000000, matrix = 0x0, descriptor = <CTFontDescriptor: 0x10b36c280>{attributes = { NSFontNameAttribute = ".SFNS-Regular"; }>}}" ctfont descriptor: "<CTFontDescriptor: 0x10b36c400>{attributes = { NSFontNameAttribute = ".SFNS-Regular"; NSFontSizeAttribute = 12; }>}" after create_copy_with_attributes: "<CTFontDescriptor: 0x10b10e220>{attributes = { NSCTFontFileURLAttribute = "file:///System/Library/Fonts/SFNS.ttf"; NSCTFontVariationAttribute = { 1869640570 = 20; }; NSFontSizeAttribute = 12; }>}" after create_copy_with_attributes: "<CTFontDescriptor: 0x10ac0d3a0>{attributes = { NSCTFontFileURLAttribute = "file:///System/Library/Fonts/SFNS.ttf"; NSCTFontVariationAttribute = { 2003265652 = 600; 1869640570 = 20; }; NSFontSizeAttribute = 12; }>}" after create_copy_with_attributes: "<CTFontDescriptor: 0x10b00d880>{attributes = { NSCTFontFileURLAttribute = "file:///System/Library/Fonts/SFNS.ttf"; NSCTFontVariationAttribute = { 1869640570 = 32; }; NSFontSizeAttribute = 12; }>}" after create_copy_with_attributes: "<CTFontDescriptor: 0x10af0f520>{attributes = { NSFontNameAttribute = ".SFNS-Regular"; NSFontSizeAttribute = 12; }>}" after create_copy_with_attributes: "<CTFontDescriptor: 0x133ed1820>{attributes = { NSCTFontFileURLAttribute = "file:///System/Library/Fonts/SFNS.ttf"; NSCTFontVariationAttribute = { 1869640570 = "35.59999847412109"; }; NSFontSizeAttribute = 12; }>}" after create_copy_with_attributes: "<CTFontDescriptor: 0x10ac2ad00>{attributes = { NSCTFontFileURLAttribute = "file:///System/Library/Fonts/SFNS.ttf"; NSCTFontVariationAttribute = { 1869640570 = "31.79999923706055"; }; NSFontSizeAttribute = 12; }>}" ``` The difference that stands out is that the CTFont from `core_text::font::new_from_CGFont` has an `NSFontSizeAttribute` entry in the attributes. My guess is that the presence of this attribute causes the font to ignore any variation attributes, but I haven't verified that. I tried to remove the attribute from the CTFontDescriptor but I couldn't figure out how. There is no API to remove attributes, you can only override attributes. Overriding the font size with zero did not help. ``` let attrs_dict = unsafe { CFDictionary::from_CFType_pairs(&[(CFString::wrap_under_get_rule(kCTFontSizeAttribute), CFNumber::from(0.0f32))]) }; create_copy_with_attributes(&desc, attrs_dict.to_untyped()).unwrap() ``` I tried overriding with "null" but couldn't find a way to put a null value in the dictionary with our rust dictionary API.