core-foundation-rs icon indicating copy to clipboard operation
core-foundation-rs copied to clipboard

fix: new_from_descriptor lose font variations, such as font-weight

Open kaiwk opened this issue 4 years ago • 5 comments

If we create CTFont from font descriptor, we will lose font variations, and use new_from_name instead will fix it.

CTFontDescriptor is essentially a dictionary of font attributes.

kaiwk avatar Dec 15 '20 03:12 kaiwk

Can you add a test?

jrmuizel avatar Dec 15 '20 04:12 jrmuizel

@jrmuizel I have to add CTFontManagerCreateFontDescriptorsFromData, because it happens when loading font from 'otc/ttc'.

I encountered the issue when using font-kit, font-kit manually unpack 'otc/ttc', I suppose it won't make any difference here.

kaiwk avatar Dec 15 '20 06:12 kaiwk

The test failed on xcode 7.3/9.2 and passed others.

kaiwk avatar Dec 15 '20 06:12 kaiwk

I also add an api called new_from_arc_buffer, so maybe font-kit can benefit from it : )

kaiwk avatar May 18 '21 13:05 kaiwk

:umbrella: The latest upstream changes (presumably #485) made this pull request unmergeable. Please resolve the merge conflicts.

bors-servo avatar Dec 08 '21 22:12 bors-servo