Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
... instead of only relying on a fixed list of directories to check.Note that both previously and with this PR, we continue also queryingfontconfig.
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 thatsystem_profiler -xml SPFontsDataType
is quite a bit slower thanfc-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)
denis-bz commentedMay 17, 2024
@anntzer, on my macos 10.15.7 Catalina
💥
200-odd such lines. |
Uh oh!
There was an error while loading.Please reload this page.
... 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