Closed kumattau closed 2 years ago
We may need to consider carefully whether to fix the problem because it is possible that there are applications depending on the incorrect behavior of directory=None.
There is qta.load_font('spyder', 'spyder.ttf', 'spyder-charmap.json')
in the document,
but spyder sets directory argument explicitly.
So spyder does not depends on the incorrect behavior of directory=None at least.
Thank you for the feedback @kumattau ! Seems like there is an inconsistency between the current functionality implemented and the docs. I think we need to change the docstring to say something along the lines of:
If directory is None, the files will be looked for in the QtAwesome `fonts` directory.
What do you think @kumattau ?
@dalthviz
I think it is better to change docs keeping current API behaivor for backward compatibility.
Additionally, I think 2 contrasted examples (with directory and without directory) are needed for users to understand the usage like as follows:
# cp myicon.ttf myicon-charmap.json /path/to/lib/python/site-packages/qtawesome/fonts/
qta.load_font('myicon', 'myicon.ttf', 'myicon-charmap.json')
# cp myicon.ttf myicon-charmap.json /path/to/myproject
qta.load_font('myicon', 'myicon.ttf', 'myicon-charmap.json', directory='/path/to/myproject')
https://qtawesomedocs.readthedocs.io/en/latest/_generate/qtawesome.load_font.html says,
but qta.load_icon() with directory=None searches a font in "qtawesome/fonts", not current "./fonts/". To avoid the problem and search a font in "./fonts/", users must set directory to "./fonts/" explicitly.