@@ -54,8 +54,13 @@ class Type1Font:
54
54
55
55
def __init__ (self , input ):
56
56
"""
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`.
59
64
"""
60
65
if isinstance (input , tuple ) and len (input ) == 3 :
61
66
self .parts = input
@@ -67,9 +72,7 @@ def __init__(self, input):
67
72
self ._parse ()
68
73
69
74
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."""
73
76
rawdata = file .read ()
74
77
if not rawdata .startswith (b'\x80 ' ):
75
78
return rawdata
@@ -306,12 +309,23 @@ def suppress(tokens):
306
309
307
310
def transform (self , effects ):
308
311
"""
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`
315
329
"""
316
330
tokenizer = self ._tokens (self .parts [0 ])
317
331
transformed = self ._transformer (tokenizer ,
0 commit comments