A utility package for testing and loading fonts in matplotlib.
pip install mplfontutils# Install as a tool (for command-line usage)
uv tool install mplfontutils
# Or add to your project
uv add mplfontutilsTest which fonts can display Hello 世界:
# Direct execution in the environment (after pip install or uv add)
mplfontutils "Hello 世界"
# Using uv tool run
uv tool run mplfontutils "Hello 世界"
# Traditional module execution
python -m mplfontutils "Hello 世界"Use the -o or --output parameter to save a visualization image showing the test text rendered in all compatible fonts:
# Save visualization to a PNG file
mplfontutils "Hello 你好 こんにちは" -o font_test.pngfrom mplfontutils import find_available_fonts, load_fonts_from_directory
# Load fonts from directory
load_fonts_from_directory("/path/to/fonts")
# Find compatible fonts
fonts = find_available_fonts("中文测试")
print(f"Found {len(fonts)} compatible fonts")