diff options
author | Oleg Oshmyan <chortos@inbox.lv> | 2022-11-15 22:13:20 +0200 |
---|---|---|
committer | Oleg Oshmyan <chortos@inbox.lv> | 2023-08-06 00:54:14 +0300 |
commit | 4eff3a78483f7c956d1109d17fc3e070d06b2820 (patch) | |
tree | ec82fadb659bb6ee4fd5bd105265dd6204c371be | |
parent | 1630dbeeef3b541e86af0c324a53a05a4f5a4b22 (diff) | |
download | libass-4eff3a78483f7c956d1109d17fc3e070d06b2820.tar.bz2 libass-4eff3a78483f7c956d1109d17fc3e070d06b2820.tar.xz |
coretext: retain only CharacterSet, not whole FontDescriptor
This partly reverts commit d0566318ee5035ca3a4d2d65d46a80a4e3d8244c
and complements the previous commit,
which removed other uses of the FontDescriptor.
By the way, I don't know why check_glyph returns true if !set.
It's been this way since the very first ass_coretext commit,
but no explanation is available, so I'm not sure this is correct.
-rw-r--r-- | libass/ass_coretext.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/libass/ass_coretext.c b/libass/ass_coretext.c index 88a320c..d2a837b 100644 --- a/libass/ass_coretext.c +++ b/libass/ass_coretext.c @@ -57,8 +57,8 @@ static char *cfstr2buf(CFStringRef string) static void destroy_font(void *priv) { - CTFontDescriptorRef fontd = priv; - CFRelease(fontd); + CFCharacterSetRef set = priv; + SAFE_CFRelease(set); } static bool check_glyph(void *priv, uint32_t code) @@ -66,16 +66,12 @@ static bool check_glyph(void *priv, uint32_t code) if (code == 0) return true; - CTFontDescriptorRef fontd = priv; - CFCharacterSetRef set = - CTFontDescriptorCopyAttribute(fontd, kCTFontCharacterSetAttribute); + CFCharacterSetRef set = priv; if (!set) return true; - bool result = CFCharacterSetIsLongCharacterMember(set, code); - CFRelease(set); - return result; + return CFCharacterSetIsLongCharacterMember(set, code); } static char *get_font_file(CTFontDescriptorRef fontd) @@ -139,8 +135,9 @@ static void process_descriptors(ASS_FontProvider *provider, CFArrayRef fontsd) char *path = NULL; if (get_font_info_ct(fontd, &path, &meta)) { - CFRetain(fontd); - ass_font_provider_add_font(provider, &meta, path, index, (void*)fontd); + CFCharacterSetRef set = + CTFontDescriptorCopyAttribute(fontd, kCTFontCharacterSetAttribute); + ass_font_provider_add_font(provider, &meta, path, index, (void*)set); } free(meta.postscript_name); |