Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 94b2b46

Browse files
committed
Update docs of type1font
1 parent b12c761 commit 94b2b46

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

lib/matplotlib/type1font.py

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,13 @@ class Type1Font:
5454

5555
def __init__(self, input):
5656
"""
57-
Initialize a Type-1 font. *input* can be either the file name of
58-
a pfb file or a 3-tuple of already-decoded Type-1 font parts.
57+
Initialize a Type-1 font.
58+
59+
Parameters
60+
----------
61+
input : str or 3-tuple
62+
Either a pfb file name, or a 3-tuple of already-decoded Type-1
63+
font `~.Type1Font.parts`.
5964
"""
6065
if isinstance(input, tuple) and len(input) == 3:
6166
self.parts = input
@@ -67,9 +72,7 @@ def __init__(self, input):
6772
self._parse()
6873

6974
def _read(self, file):
70-
"""
71-
Read the font from a file, decoding into usable parts.
72-
"""
75+
"""Read the font from a file, decoding into usable parts."""
7376
rawdata = file.read()
7477
if not rawdata.startswith(b'\x80'):
7578
return rawdata
@@ -306,12 +309,23 @@ def suppress(tokens):
306309

307310
def transform(self, effects):
308311
"""
309-
Transform the font by slanting or extending. *effects* should
310-
be a dict where ``effects['slant']`` is the tangent of the
311-
angle that the font is to be slanted to the right (so negative
312-
values slant to the left) and ``effects['extend']`` is the
313-
multiplier by which the font is to be extended (so values less
314-
than 1.0 condense). Returns a new :class:`Type1Font` object.
312+
Return a new font that is slanted and/or extended.
313+
314+
Parameters
315+
----------
316+
effects : dict
317+
A dict with optional entries:
318+
319+
- 'slant' : float, default: 0
320+
Tangent of the angle that the font is to be slanted to the
321+
right. Negative values slant to the left.
322+
- 'extend' : float, default: 1
323+
Scaling factor for the font width. Values less than 1 condense
324+
the glyphs.
325+
326+
Returns
327+
-------
328+
font : `Type1Font`
315329
"""
316330
tokenizer = self._tokens(self.parts[0])
317331
transformed = self._transformer(tokenizer,

0 commit comments

Comments
 (0)