Search code examples
pythonfontscross-platform

How to get the fonts directory path in different OS?


I'm developing a module for generate CAPTCHA. This module needs a font file, but the fonts directory path are different in different operating system. Is there a universal way to get the fonts directory path that can be used in different OS?


Solution

  • I don't think there is any such library, atmost wxPython have a wxStandarPaths which can give OS specific paths, may be you can use that to get fonts folder.

    But I think even with that you will have to do tweaks per OS, so easiest way is to just create you own function get_font_folder and keep on adding OS to font folder mapping as you test or find bugs :)