Skip to content

Commit ffdfa93

Browse files
authored
add more detailed font overview
1 parent 3836375 commit ffdfa93

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

examples/text_labels_and_annotations/font_family_rc.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,21 @@ def print_text(text):
7979

8080
#############################################################################
8181
#
82-
# Print all available fonts (this is OS specific):
82+
# Print all available font paths (this is OS specific):
8383

8484
import matplotlib.font_manager
85-
list_of_fonts = matplotlib.font_manager.findSystemFonts(fontpaths=None, fontext='ttf')
86-
for l in list_of_fonts:
87-
print(l)
85+
fpaths = matplotlib.font_manager.findSystemFonts(fontpaths=None, fontext='ttf')
86+
for i in fpaths:
87+
print(i)
88+
89+
90+
#############################################################################
91+
#
92+
# Print all available font names and their style (this is OS specific):
93+
94+
import matplotlib.font_manager
95+
fpaths = matplotlib.font_manager.findSystemFonts()
96+
97+
for i in fpaths:
98+
f = matplotlib.font_manager.get_font(i)
99+
print(f"{f.family_name=:<35} {f.style_name = }")

0 commit comments

Comments
 (0)