9
9
import difflib
10
10
import hashlib
11
11
12
+
12
13
def sha1 (data ):
13
14
hash = hashlib .sha1 ()
14
15
hash .update (data )
15
16
return hash .hexdigest ()
16
17
18
+
17
19
def test_Type1Font ():
18
20
filename = os .path .join (os .path .dirname (__file__ ), 'cmr10.pfb' )
19
21
font = t1f .Type1Font (filename )
@@ -30,24 +32,24 @@ def test_Type1Font():
30
32
diff = set (differ .compare (font .parts [0 ].splitlines (),
31
33
slanted .parts [0 ].splitlines ()))
32
34
for line in (
33
- # Removes UniqueID
34
- '- FontDirectory/CMR10 known{/CMR10 findfont dup/UniqueID known{dup' ,
35
- '+ FontDirectory/CMR10 known{/CMR10 findfont dup' ,
36
- # Alters FontMatrix
37
- '- /FontMatrix [0.001 0 0 0.001 0 0 ]readonly def' ,
38
- '+ /FontMatrix [0.001 0.0 0.001 0.001 0.0 0.0]readonly def' ,
39
- # Alters ItalicAngle
40
- '- /ItalicAngle 0 def' ,
41
- '+ /ItalicAngle -45.0 def' ):
35
+ # Removes UniqueID
36
+ '- FontDirectory/CMR10 known{/CMR10 findfont dup/UniqueID known{dup' ,
37
+ '+ FontDirectory/CMR10 known{/CMR10 findfont dup' ,
38
+ # Alters FontMatrix
39
+ '- /FontMatrix [0.001 0 0 0.001 0 0 ]readonly def' ,
40
+ '+ /FontMatrix [0.001 0.0 0.001 0.001 0.0 0.0]readonly def' ,
41
+ # Alters ItalicAngle
42
+ '- /ItalicAngle 0 def' ,
43
+ '+ /ItalicAngle -45.0 def' ):
42
44
assert_in (line , diff , 'diff to slanted font must contain %s' % line )
43
45
44
46
diff = set (differ .compare (font .parts [0 ].splitlines (),
45
47
condensed .parts [0 ].splitlines ()))
46
48
for line in (
47
- # Removes UniqueID
48
- '- FontDirectory/CMR10 known{/CMR10 findfont dup/UniqueID known{dup' ,
49
- '+ FontDirectory/CMR10 known{/CMR10 findfont dup' ,
50
- # Alters FontMatrix
51
- '- /FontMatrix [0.001 0 0 0.001 0 0 ]readonly def' ,
52
- '+ /FontMatrix [0.0005 0.0 0.0 0.001 0.0 0.0]readonly def' ):
49
+ # Removes UniqueID
50
+ '- FontDirectory/CMR10 known{/CMR10 findfont dup/UniqueID known{dup' ,
51
+ '+ FontDirectory/CMR10 known{/CMR10 findfont dup' ,
52
+ # Alters FontMatrix
53
+ '- /FontMatrix [0.001 0 0 0.001 0 0 ]readonly def' ,
54
+ '+ /FontMatrix [0.0005 0.0 0.0 0.001 0.0 0.0]readonly def' ):
53
55
assert_in (line , diff , 'diff to condensed font must contain %s' % line )
0 commit comments