@@ -1179,28 +1179,53 @@ def score_size(self, size1, size2):
11791179 def findfont (self , prop , fontext = 'ttf' , directory = None ,
11801180 fallback_to_default = True , rebuild_if_missing = True ):
11811181 """
1182- Search the font list for the font that most closely matches
1183- the :class:`FontProperties` *prop*.
1184-
1185- :meth:`findfont` performs a nearest neighbor search. Each
1186- font is given a similarity score to the target font
1187- properties. The first font with the highest score is
1188- returned. If no matches below a certain threshold are found,
1189- the default font (usually DejaVu Sans) is returned.
1190-
1191- `directory`, is specified, will only return fonts from the
1192- given directory (or subdirectory of that directory).
1182+ Find a font that most closely matches the given font properties.
1183+
1184+ Parameters
1185+ ----------
1186+ prop : str or `~matplotlib.font_manager.FontProperties`
1187+ The font properties to search for. This can be either a
1188+ `.FontProperties` object or a string defining a
1189+ `fontconfig patterns`_.
1190+
1191+ fontext : {'ttf', 'afm'}, optional, default: 'ttf'
1192+ The extension of the font file:
1193+
1194+ - 'ttf': TrueType and OpenType fonts (.ttf, .ttc, .otf)
1195+ - 'afm': Adobe Font Metrics (.afm)
1196+
1197+ directory : str, optional
1198+ If given, only search this directory and its subdirectories.
1199+ fallback_to_default : bool
1200+ If True, will fallback to the default font family (usually
1201+ "DejaVu Sans" or "Helvetica") if the first lookup hard-fails.
1202+ rebuild_if_missing : bool
1203+ Whether to rebuild the font cache and search again if no match
1204+ is found.
1205+
1206+ Returns
1207+ -------
1208+ fontfile : str
1209+ The filename of the best matching font.
1210+
1211+ Notes
1212+ -----
1213+ This performs a nearest neighbor search. Each font is given a
1214+ similarity score to the target font properties. The first font with
1215+ the highest score is returned. If no matches below a certain
1216+ threshold are found, the default font (usually DejaVu Sans) is
1217+ returned.
11931218
11941219 The result is cached, so subsequent lookups don't have to
11951220 perform the O(n) nearest neighbor search.
11961221
1197- If `fallback_to_default` is True, will fallback to the default
1198- font family (usually "DejaVu Sans" or "Helvetica") if
1199- the first lookup hard-fails.
1200-
12011222 See the `W3C Cascading Style Sheet, Level 1
12021223 <http://www.w3.org/TR/1998/REC-CSS2-19980512/>`_ documentation
12031224 for a description of the font finding algorithm.
1225+
1226+ .. _fontconfig patterns:
1227+ https://www.freedesktop.org/software/fontconfig/fontconfig-user.html
1228+
12041229 """
12051230 # Pass the relevant rcParams (and the font manager, as `self`) to
12061231 # _findfont_cached so to prevent using a stale cache entry after an
0 commit comments