fontBuilder: Don't add a stub signature to DSIG

An empty DSIG is enough to make MS applications happy and also fixes an error reported by MS Font Validator
This commit is contained in:
Miguel Sousa 2019-05-25 10:06:12 -07:00
parent 83db5ed132
commit 9fb0cac564
4 changed files with 7 additions and 33 deletions

View File

@ -712,25 +712,14 @@ class FontBuilder(object):
self._initTableWithValues("maxp", defaults, {}) self._initTableWithValues("maxp", defaults, {})
def setupDummyDSIG(self): def setupDummyDSIG(self):
"""This adds a dummy DSIG table to the font to make some MS applications """This adds an empty DSIG table to the font to make some MS applications
happy. This does not properly sign the font. happy. This does not properly sign the font.
""" """
from .ttLib.tables.D_S_I_G_ import SignatureRecord
sig = SignatureRecord()
sig.ulLength = 20
sig.cbSignature = 12
sig.usReserved2 = 0
sig.usReserved1 = 0
sig.pkcs7 = b'\xd3M4\xd3M5\xd3M4\xd3M4'
sig.ulFormat = 1
sig.ulOffset = 20
values = dict( values = dict(
ulVersion = 1, ulVersion = 1,
usFlag = 1, usFlag = 0,
usNumSigs = 1, usNumSigs = 0,
signatureRecords = [sig], signatureRecords = [],
) )
self._initTableWithValues("DSIG", {}, values) self._initTableWithValues("DSIG", {}, values)

View File

@ -293,12 +293,7 @@
<DSIG> <DSIG>
<!-- note that the Digital Signature will be invalid after recompilation! --> <!-- note that the Digital Signature will be invalid after recompilation! -->
<tableHeader flag="0x1" numSigs="1" version="1"/> <tableHeader flag="0x0" numSigs="0" version="1"/>
<SignatureRecord format="1">
-----BEGIN PKCS7-----
0000000100000000
-----END PKCS7-----
</SignatureRecord>
</DSIG> </DSIG>
</ttFont> </ttFont>

View File

@ -298,12 +298,7 @@
<DSIG> <DSIG>
<!-- note that the Digital Signature will be invalid after recompilation! --> <!-- note that the Digital Signature will be invalid after recompilation! -->
<tableHeader flag="0x1" numSigs="1" version="1"/> <tableHeader flag="0x0" numSigs="0" version="1"/>
<SignatureRecord format="1">
-----BEGIN PKCS7-----
0000000100000000
-----END PKCS7-----
</SignatureRecord>
</DSIG> </DSIG>
</ttFont> </ttFont>

View File

@ -365,12 +365,7 @@
<DSIG> <DSIG>
<!-- note that the Digital Signature will be invalid after recompilation! --> <!-- note that the Digital Signature will be invalid after recompilation! -->
<tableHeader flag="0x1" numSigs="1" version="1"/> <tableHeader flag="0x0" numSigs="0" version="1"/>
<SignatureRecord format="1">
-----BEGIN PKCS7-----
0000000100000000
-----END PKCS7-----
</SignatureRecord>
</DSIG> </DSIG>
</ttFont> </ttFont>