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

Commit303d515

Browse files
authored
Merge pull request#15942 from timhoffm/doc-type1
Update docs of type1font
2 parents03b255d +94b2b46 commit303d515

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
ifisinstance(input,tuple)andlen(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
ifnotrawdata.startswith(b'\x80'):
7578
returnrawdata
@@ -306,12 +309,23 @@ def suppress(tokens):
306309

307310
deftransform(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)

[8]ページ先頭

©2009-2025 Movatter.jp