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

Skip to content

Commit ba9ebb0

Browse files
committed
Bugfix and doc fixes in type1font.py
svn path=/trunk/matplotlib/; revision=3853
1 parent 0e5344a commit ba9ebb0

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

lib/matplotlib/type1font.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
"""
22
A class representing a Type 1 font.
33
4-
This version merely allows reading in pfa and pfb files, stores the
5-
data in pfa format, and allows reading the parts of the data in a
6-
format suitable for embedding in pdf files. A more complete class
7-
might support subsetting.
4+
This version merely reads pfa and pfb files and splits them for
5+
embedding in pdf files. There is no support yet for subsetting or
6+
anything like that.
87
9-
Usage: font = Type1Font(filename)
10-
somefile.write(font.data) # writes out font in pfa format
11-
len1, len2, len3 = font.lengths() # needed for pdf embedding
8+
Usage (subject to change):
9+
10+
font = Type1Font(filename)
11+
clear_part, encrypted_part, finale = font.parts
1212
1313
Source: Adobe Technical Note #5040, Supporting Downloadable PostScript
1414
Language Fonts.
@@ -32,8 +32,7 @@ def __init__(self, filename):
3232
def _read(self, file):
3333
rawdata = file.read()
3434
if not rawdata.startswith(chr(128)):
35-
self.data = rawdata
36-
return
35+
return rawdata
3736

3837
data = ''
3938
while len(rawdata) > 0:
@@ -101,4 +100,6 @@ def _split(self, data):
101100
if __name__ == '__main__':
102101
import sys
103102
font = Type1Font(sys.argv[1])
104-
sys.stdout.write(font.data)
103+
parts = font.parts
104+
print len(parts[0]), len(parts[1]), len(parts[2])
105+

0 commit comments

Comments
 (0)