99import difflib
1010import hashlib
1111
12+
1213def sha1 (data ):
1314 hash = hashlib .sha1 ()
1415 hash .update (data )
1516 return hash .hexdigest ()
1617
18+
1719def test_Type1Font ():
1820 filename = os .path .join (os .path .dirname (__file__ ), 'cmr10.pfb' )
1921 font = t1f .Type1Font (filename )
@@ -30,24 +32,24 @@ def test_Type1Font():
3032 diff = set (differ .compare (font .parts [0 ].splitlines (),
3133 slanted .parts [0 ].splitlines ()))
3234 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' ):
4244 assert_in (line , diff , 'diff to slanted font must contain %s' % line )
4345
4446 diff = set (differ .compare (font .parts [0 ].splitlines (),
4547 condensed .parts [0 ].splitlines ()))
4648 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' ):
5355 assert_in (line , diff , 'diff to condensed font must contain %s' % line )
0 commit comments