MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / FontProperties

Class FontProperties

lib/matplotlib/font_manager.py:749–1122  ·  view source on GitHub ↗

A class for storing and manipulating font properties. The font properties are the six properties described in the `W3C Cascading Style Sheet, Level 1 `_ font specification and *math_fontfamily* for math fonts: - family: A list

Source from the content-addressed store, hash-verified

747
748
749class FontProperties:
750 """
751 A class for storing and manipulating font properties.
752
753 The font properties are the six properties described in the
754 `W3C Cascading Style Sheet, Level 1
755 <http://www.w3.org/TR/1998/REC-CSS2-19980512/>`_ font
756 specification and *math_fontfamily* for math fonts:
757
758 - family: A list of font names in decreasing order of priority.
759 The items may include a generic font family name, either 'sans-serif',
760 'serif', 'cursive', 'fantasy', or 'monospace'. In that case, the actual
761 font to be used will be looked up from the associated rcParam during the
762 search process in `.findfont`. Default: :rc:`font.family`
763
764 - style: Either 'normal', 'italic' or 'oblique'.
765 Default: :rc:`font.style`
766
767 - variant: Either 'normal' or 'small-caps'.
768 Default: :rc:`font.variant`
769
770 - stretch: A numeric value in the range 0-1000 or one of
771 'ultra-condensed', 'extra-condensed', 'condensed',
772 'semi-condensed', 'normal', 'semi-expanded', 'expanded',
773 'extra-expanded' or 'ultra-expanded'. Default: :rc:`font.stretch`
774
775 - weight: A numeric value in the range 0-1000 or one of
776 'ultralight', 'light', 'normal', 'regular', 'book', 'medium',
777 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy',
778 'extra bold', 'black'. Default: :rc:`font.weight`
779
780 - size: Either a relative value of 'xx-small', 'x-small',
781 'small', 'medium', 'large', 'x-large', 'xx-large' or an
782 absolute font size, e.g., 10. Default: :rc:`font.size`
783
784 - math_fontfamily: The family of fonts used to render math text.
785 Supported values are: 'dejavusans', 'dejavuserif', 'cm',
786 'stix', 'stixsans' and 'custom'. Default: :rc:`mathtext.fontset`
787
788 Alternatively, a font may be specified using the absolute path to a font
789 file, by using the *fname* kwarg. However, in this case, it is typically
790 simpler to just pass the path (as a `pathlib.Path`, not a `str`) to the
791 *font* kwarg of the `.Text` object.
792
793 The preferred usage of font sizes is to use the relative values,
794 e.g., 'large', instead of absolute font sizes, e.g., 12. This
795 approach allows all text sizes to be made larger or smaller based
796 on the font manager&#x27;s default font size.
797
798 This class accepts a single positional string as fontconfig_ pattern_,
799 or alternatively individual properties as keyword arguments::
800
801 FontProperties(pattern)
802 FontProperties(*, family=None, style=None, variant=None, ...)
803
804 This support does not depend on fontconfig; we are merely borrowing its
805 pattern syntax for use here.
806

Callers 15

__init__Method · 0.90
_auto_adjust_subplotparsFunction · 0.90
_parse_cachedMethod · 0.90
__init__Method · 0.90
set_fontsizeMethod · 0.90
_get_preambleFunction · 0.90
test_fontconfig_patternFunction · 0.90
test_fontconfig_strFunction · 0.90
find_matplotlib_fontFunction · 0.90
test_update_mutate_inputFunction · 0.90

Calls

no outgoing calls

Tested by 14

test_fontconfig_patternFunction · 0.72
test_fontconfig_strFunction · 0.72
find_matplotlib_fontFunction · 0.72
test_update_mutate_inputFunction · 0.72
test_ttc_outputFunction · 0.72
test_font_priorityFunction · 0.72
test_json_serializationFunction · 0.72
test_find_ttcFunction · 0.72
test_find_notoFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…