Fix add application font on macOS

This commit is contained in:
Kovid Goyal 2024-06-30 13:36:22 +05:30
parent 98c85d2923
commit 89cf58ba2b
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -1108,9 +1108,8 @@ static CTFontRef nerd_font(CGFloat sz) {
const unsigned char *path = NULL; Py_ssize_t sz;
if (!PyArg_ParseTuple(args, "s#", &path, &sz)) return NULL;
RAII_CoreFoundation(CFURLRef, url, CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, path, sz, false));
RAII_CoreFoundation(CFArrayRef, descriptors, CTFontManagerCreateFontDescriptorsFromURL(url));
CTFontManagerEnableFontDescriptors(descriptors, true);
Py_RETURN_TRUE;
if (CTFontManagerRegisterFontsForURL(url, kCTFontManagerScopeProcess, NULL)) Py_RETURN_TRUE;
Py_RETURN_FALSE;
}
static PyMethodDef module_methods[] = {