-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Query macOS for available system fonts. #27230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
... instead of only relying on a fixed list of directories to check. Note that both previously and with this PR, we continue also querying fontconfig.
I did not realize that |
def _get_macos_fonts(): | ||
"""Cache and list the font paths known to ``system_profiler SPFontsDataType``.""" | ||
d, = plistlib.loads( | ||
subprocess.check_output(["system_profiler", "-xml", "SPFontsDataType"])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this output portable across different system languages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a quick check, the answer appears to be yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll note that system_profiler -xml SPFontsDataType
is quite a bit slower than fc-list
for me. This does work as expected and is only adding extra time to the initial cache build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM; doesn't take that long to build the font cache on this PR for me (~seconds on an M2 MacBook Air), and more fonts are found (374 before, 497 after)
@anntzer, on my macos 10.15.7 Catalina
💥
200-odd such lines. |
... instead of only relying on a fixed list of directories to check. Note that both previously and with this PR, we continue also querying fontconfig.
See #10932. This should close the original issue (#10201); for #10932 I would suggest further dropping out the extra hard-coded directories (X11FontDirectories, OSXFontDirectories) that are searched.
PR summary
PR checklist