Query macOS for available system fonts.#27230
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.
Is this output portable across different system languages?
There was a problem hiding this comment.
From a quick check, the answer appears to be yes.
greglucas
left a comment
There was a problem hiding this comment.
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.
dstansby
left a comment
There was a problem hiding this comment.
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