Cache and list the font paths known to ``system_profiler SPFontsDataType``.
()
| 266 | |
| 267 | @cache |
| 268 | def _get_macos_fonts(): |
| 269 | """Cache and list the font paths known to ``system_profiler SPFontsDataType``.""" |
| 270 | try: |
| 271 | d, = plistlib.loads( |
| 272 | subprocess.check_output(["system_profiler", "-xml", "SPFontsDataType"])) |
| 273 | except (OSError, subprocess.CalledProcessError, plistlib.InvalidFileException): |
| 274 | return [] |
| 275 | return [Path(entry["path"]) for entry in d["_items"]] |
| 276 | |
| 277 | |
| 278 | def findSystemFonts(fontpaths=None, fontext='ttf'): |
no test coverage detected
searching dependent graphs…