FontFinder does not recurse into sub-directories
On current GNU/Linux systems, the personal fonts are stored in sub-directories of the
~/.fonts directory.
Example: Font
Hack installed
$ tree ~/.fonts ~/.fonts └── h ├── Hack_BoldItalic.ttf ├── Hack_Bold.ttf ├── Hack_Italic.ttf └── Hack_Regular.ttf
This code shows the issue:
from reportlab.lib import fontfinder ff = fontfinder.FontFinder() ff.addDirectory(os.path.expanduser('~/.fonts')) ff.search() print(len(ff.getFamilyNames())) ff.addDirectory(os.path.expanduser('~/.fonts/h')) ff.search() print(len(ff.getFamilyNames()))
Output:
0 1
I have added a recur=False argument to the FontFinder.init, it seems to do what you want when set to True. I don't think we use the FontFinder at all in our usage of the RL toolkit so this module has been overlooked.
Thanks for your quick response. Unfortunately this uncovers another small bug: line 279 is using only the basename of the file. It should be
(mind the
f.in front of
fileName)