xdg-rs / dirs

a low-level library that provides config/cache/data paths, following the respective conventions on Linux, macOS and Windows
186 stars 23 forks source link

directories-next: Add system font directory #52

Open ghost opened 3 years ago

ghost commented 3 years ago

There is currently the user writeable font directory, accessible through UserDirs::font_dir, however, I can't seem to find one in BaseDirs. For reliably getting font file paths on the major platforms to use them for example in SDL, it's needed to get the paths to the system font directories as well.

As I see, the locations for fonts on the major platforms are:

It might be appropiate to return them as a Vec<&Path>, as on Linux and Mac OS X, there are multiple appropiate folders (on Linux the subdirectories of /usr/share/fonts, on Mac OS X /System/Library/Fonts and /Library/Fonts). Unfortunately I don't have a real system to check if the Mac OS X and Windows paths are right.

mainrs commented 3 years ago

I can tackle this one down :) Expect a PR at the end of the week :)