Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit20baeaa

Browse files
committed
Improve documentation of FontManager
1 parentd4020d8 commit20baeaa

File tree

1 file changed

+52
-29
lines changed

1 file changed

+52
-29
lines changed

‎lib/matplotlib/font_manager.py

Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -627,32 +627,33 @@ class FontProperties:
627627
628628
- family: A list of font names in decreasing order of priority.
629629
The items may include a generic font family name, either
630-
'sans-serif' (default), 'serif', 'cursive', 'fantasy', or 'monospace'.
630+
'sans-serif', 'serif', 'cursive', 'fantasy', or 'monospace'.
631631
In that case, the actual font to be used will be looked up
632-
from the associated rcParam.
632+
from the associated rcParam. Default: :rc:`font.family`
633633
634-
- style: Either 'normal' (default), 'italic' or 'oblique'.
634+
- style: Either 'normal', 'italic' or 'oblique'.
635+
Default: :rc:`font.style`
635636
636-
- variant: Either 'normal' (default) or 'small-caps'.
637+
- variant: Either 'normal' or 'small-caps'.
638+
Default: :rc:`font.variant`
637639
638640
- stretch: A numeric value in the range 0-1000 or one of
639641
'ultra-condensed', 'extra-condensed', 'condensed',
640-
'semi-condensed', 'normal' (default), 'semi-expanded', 'expanded',
641-
'extra-expanded' or 'ultra-expanded'.
642+
'semi-condensed', 'normal', 'semi-expanded', 'expanded',
643+
'extra-expanded' or 'ultra-expanded'. Default: :rc:`font.stretch`
642644
643645
- weight: A numeric value in the range 0-1000 or one of
644-
'ultralight', 'light', 'normal' (default), 'regular', 'book', 'medium',
646+
'ultralight', 'light', 'normal', 'regular', 'book', 'medium',
645647
'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy',
646-
'extra bold', 'black'.
648+
'extra bold', 'black'. Default: :rc:`font.weight`
647649
648650
- size: Either an relative value of 'xx-small', 'x-small',
649651
'small', 'medium', 'large', 'x-large', 'xx-large' or an
650-
absolute font size, e.g., 10 (default).
652+
absolute font size, e.g., 10. Default: :rc:`font.size`
651653
652-
- math_fontfamily: The family of fonts used to render math text; overrides
653-
:rc:`mathtext.fontset`. Supported values are the same as the ones
654-
supported by :rc:`mathtext.fontset`: 'dejavusans', 'dejavuserif', 'cm',
655-
'stix', 'stixsans' and 'custom'.
654+
- math_fontfamily: The family of fonts used to render math text.
655+
Supported values are: 'dejavusans', 'dejavuserif', 'cm',
656+
'stix', 'stixsans' and 'custom'. Default: :rc:`mathtext.fontset`
656657
657658
Alternatively, a font may be specified using the absolute path to a font
658659
file, by using the *fname* kwarg. However, in this case, it is typically
@@ -807,7 +808,7 @@ def set_family(self, family):
807808
is CSS parlance), such as: 'serif', 'sans-serif', 'cursive',
808809
'fantasy', or 'monospace', a real font name or a list of real
809810
font names. Real font names are not supported when
810-
:rc:`text.usetex` is `True`.
811+
:rc:`text.usetex` is `True`. Default: :rc:`font.family`
811812
"""
812813
iffamilyisNone:
813814
family=rcParams['font.family']
@@ -817,7 +818,11 @@ def set_family(self, family):
817818

818819
defset_style(self,style):
819820
"""
820-
Set the font style. Values are: 'normal', 'italic' or 'oblique'.
821+
Set the font style.
822+
823+
Parameters
824+
----------
825+
style : {'normal', 'italic', 'oblique'}, default: :rc:`font.style`
821826
"""
822827
ifstyleisNone:
823828
style=rcParams['font.style']
@@ -826,7 +831,11 @@ def set_style(self, style):
826831

827832
defset_variant(self,variant):
828833
"""
829-
Set the font variant. Values are: 'normal' or 'small-caps'.
834+
Set the font variant.
835+
836+
Parameters
837+
----------
838+
variant : {'normal', 'small-caps'}, default: :rc:`font.variant`
830839
"""
831840
ifvariantisNone:
832841
variant=rcParams['font.variant']
@@ -835,10 +844,14 @@ def set_variant(self, variant):
835844

836845
defset_weight(self,weight):
837846
"""
838-
Set the font weight. May be either a numeric value in the
839-
range 0-1000 or one of 'ultralight', 'light', 'normal',
840-
'regular', 'book', 'medium', 'roman', 'semibold', 'demibold',
841-
'demi', 'bold', 'heavy', 'extra bold', 'black'
847+
Set the font weight.
848+
849+
Parameters
850+
----------
851+
weight : int or {'ultralight', 'light', 'normal', 'regular', 'book',\
852+
'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy',\
853+
'extra bold', 'black'}, default: :rc:`font.weight`
854+
If int, must be in the range 0-1000.
842855
"""
843856
ifweightisNone:
844857
weight=rcParams['font.weight']
@@ -853,10 +866,14 @@ def set_weight(self, weight):
853866

854867
defset_stretch(self,stretch):
855868
"""
856-
Set the font stretch or width. Options are: 'ultra-condensed',
857-
'extra-condensed', 'condensed', 'semi-condensed', 'normal',
858-
'semi-expanded', 'expanded', 'extra-expanded' or
859-
'ultra-expanded', or a numeric value in the range 0-1000.
869+
Set the font stretch or width.
870+
871+
Parameters
872+
----------
873+
stretch : int or {'ultra-condensed', 'extra-condensed', 'condensed',\
874+
'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded',\
875+
'ultra-expanded'}, default: :rc:`font.stretch`
876+
If int, must be in the range 0-1000.
860877
"""
861878
ifstretchisNone:
862879
stretch=rcParams['font.stretch']
@@ -871,9 +888,14 @@ def set_stretch(self, stretch):
871888

872889
defset_size(self,size):
873890
"""
874-
Set the font size. Either an relative value of 'xx-small',
875-
'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'
876-
or an absolute font size, e.g., 12.
891+
Set the font size.
892+
893+
Parameters
894+
----------
895+
size : float or {'xx-small', 'x-small', 'small', 'medium',\
896+
'large', 'x-large', 'xx-large'}, default: :rc:`font.size`
897+
If float, the font size in points. The string values denote sizes
898+
relative to the default font size.
877899
"""
878900
ifsizeisNone:
879901
size=rcParams['font.size']
@@ -1091,8 +1113,9 @@ def addfont(self, path):
10911113
----------
10921114
path : str or path-like
10931115
"""
1094-
path=str(path)# Convert to string in case of a path as
1095-
# afmFontProperty and FT2Font expect this
1116+
# Convert to string in case of a path as
1117+
# afmFontProperty and FT2Font expect this
1118+
path=str(path)
10961119
ifPath(path).suffix.lower()==".afm":
10971120
withopen(path,"rb")asfh:
10981121
font=_afm.AFM(fh)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp