@@ -408,51 +408,50 @@ def destroy(self):
408408
409409 def get_kern (self , font1 , fontclass1 , sym1 , fontsize1 ,
410410 font2 , fontclass2 , sym2 , fontsize2 , dpi ):
411- r """
411+ """
412412 Get the kerning distance for font between *sym1* and *sym2*.
413413
414- *fontX*: one of the TeX font names::
415-
416- tt, it, rm, cal, sf, bf or default/regular (non-math)
417-
418- *fontclassX*: TODO
419-
420- *symX*: a symbol in raw TeX form. e.g., '1', 'x' or '\sigma'
421-
422- *fontsizeX*: the fontsize in points
423-
424- *dpi*: the current dots-per-inch
414+ See `~.Fonts.get_metrics` for a detailed description of the parameters.
425415 """
426416 return 0.
427417
428418 def get_metrics (self , font , font_class , sym , fontsize , dpi , math = True ):
429419 r"""
430- *font*: one of the TeX font names::
431-
432- tt, it, rm, cal, sf, bf or default/regular (non-math)
433-
434- *font_class*: TODO
435-
436- *sym*: a symbol in raw TeX form. e.g., '1', 'x' or '\sigma'
437-
438- *fontsize*: font size in points
439-
440- *dpi*: current dots-per-inch
441-
442- *math*: whether sym is a math character
443-
444- Returns an object with the following attributes:
445-
446- - *advance*: The advance distance (in points) of the glyph.
447-
448- - *height*: The height of the glyph in points.
449-
450- - *width*: The width of the glyph in points.
451-
452- - *xmin*, *xmax*, *ymin*, *ymax* - the ink rectangle of the glyph
420+ Parameters
421+ ----------
422+ font : str
423+ One of the TeX font names: "tt", "it", "rm", "cal", "sf", "bf",
424+ "default", "regular", "bb", "frak", "scr". "default" and "regular"
425+ are synonyms and use the non-math font.
426+ font_class : str
427+ One of the TeX font names (as for *font*), but **not** "bb",
428+ "frak", or "scr". This is used to combine two font classes. The
429+ only supported combination currently is ``get_metrics("frak", "bf",
430+ ...)``.
431+ sym : str
432+ A symbol in raw TeX form, e.g., "1", "x", or "\sigma".
433+ fontsize : float
434+ Font size in points.
435+ dpi : float
436+ Rendering dots-per-inch.
437+ math : bool
438+ Whether we are currently in math mode or not.
453439
454- - *iceberg* - the distance from the baseline to the top of
455- the glyph. This corresponds to TeX's definition of "height".
440+ Returns
441+ -------
442+ object
443+
444+ The returned object has the following attributes (all floats,
445+ except *slanted*):
446+
447+ - *advance*: The advance distance (in points) of the glyph.
448+ - *height*: The height of the glyph in points.
449+ - *width*: The width of the glyph in points.
450+ - *xmin*, *xmax*, *ymin*, *ymax*: The ink rectangle of the glyph
451+ - *iceberg*: The distance from the baseline to the top of the
452+ glyph. (This corresponds to TeX's definition of "height".)
453+ - *slanted*: Whether the glyph should be considered as "slanted"
454+ (currently used for kerning sub/superscripts).
456455 """
457456 info = self ._get_info (font , font_class , sym , fontsize , dpi , math )
458457 return info .metrics
@@ -466,23 +465,13 @@ def set_canvas_size(self, w, h, d):
466465 self .mathtext_backend .set_canvas_size (
467466 self .width , self .height , self .depth )
468467
469- def render_glyph (self , ox , oy , facename , font_class , sym , fontsize , dpi ):
468+ @cbook ._rename_parameter ("3.4" , "facename" , "font" )
469+ def render_glyph (self , ox , oy , font , font_class , sym , fontsize , dpi ):
470470 """
471- Draw a glyph at
472-
473- - *ox*, *oy*: position
474-
475- - *facename*: One of the TeX face names
476-
477- - *font_class*:
478-
479- - *sym*: TeX symbol name or single character
480-
481- - *fontsize*: fontsize in points
482-
483- - *dpi*: The dpi to draw at.
471+ At position (*ox*, *oy*), draw the glyph specified by the remaining
472+ parameters (see `get_metrics` for their detailed description).
484473 """
485- info = self ._get_info (facename , font_class , sym , fontsize , dpi )
474+ info = self ._get_info (font , font_class , sym , fontsize , dpi )
486475 self .used_characters .setdefault (info .font .fname , set ()).add (info .num )
487476 self .mathtext_backend .render_glyph (ox , oy , info )
488477
@@ -777,12 +766,11 @@ def __init__(self, *args, **kwargs):
777766 if rcParams ['mathtext.fallback_to_cm' ] is not None :
778767 fallback_rc = ('cm' if rcParams ['mathtext.fallback_to_cm' ]
779768 else None )
780-
781- font_class = {'stix' : StixFonts ,
782- 'stixsans' : StixSansFonts ,
783- 'cm' : BakomaFonts
784- }.get (fallback_rc )
785- self .cm_fallback = font_class (* args , ** kwargs ) if font_class else None
769+ font_cls = {'stix' : StixFonts ,
770+ 'stixsans' : StixSansFonts ,
771+ 'cm' : BakomaFonts
772+ }.get (fallback_rc )
773+ self .cm_fallback = font_cls (* args , ** kwargs ) if font_cls else None
786774
787775 super ().__init__ (* args , ** kwargs )
788776 self .fontmap = {}
0 commit comments