dataplotlib
dataplotlib copied to clipboard
Implement text drawing
dataplotlib needs to be able to draw text so it can draw labels on the axes, add a chart title, and do other important things. Ideally, the Draw trait would have two new methods: one to draw text at an arbitrary location, and one to modify the current font properties such as the size and font face being used. With SDL2, drawing text is actually fairly straightforward, but I'm not sure what the best approach is for finding the installed fonts on a given system in a crossplatform manner. We could definitely bundle a free font with dataplotlib as a default and as a fallback in case we can't find a particular requested font.
I'd definitely recommend the free Fira fonts from Mozilla, which generally fits with applications begin written in Mozilla's Rust. As for finding fonts:
Linux
- $HOME/.local/share/fonts
- $HOME/.fonts
- /usr/share/fonts
Windows
- C:\Windows\Fonts
Mac
- /Library/Fonts/
- $HOME/Library/Fonts/
- /Network/Library/Fonts/
- /System/Library/Fonts/
You could easily create an iterator that just chains these directories together, depending on the platform.