Skip to content

Commit

Permalink
Handle downloadable fonts on macOS better.
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Apr 5, 2023
1 parent 46f34e3 commit a9ecf20
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,22 @@ impl Database {
{
self.load_fonts_dir("/Library/Fonts");
self.load_fonts_dir("/System/Library/Fonts");
self.load_fonts_dir("/System/Library/AssetsV2/com_apple_MobileAsset_Font6");
// Downloadable fonts, location varies on major macOS releases
if let Ok(dir) = std::fs::read_dir("/System/Library/AssetsV2") {
for entry in dir {
let entry = match entry {
Ok(entry) => entry,
Err(_) => continue,
};
if entry
.file_name()
.to_string_lossy()
.starts_with("com_apple_MobileAsset_Font")
{
self.load_fonts_dir(entry.path());
}
}
}
self.load_fonts_dir("/Network/Library/Fonts");

if let Ok(ref home) = std::env::var("HOME") {
Expand Down

0 comments on commit a9ecf20

Please sign in to comment.