dmitri.shuralyov.com/font/woff2/...

initial implementation of woff2 dmitri.shuralyov.com/font/woff2#1

Mergeddmitshur opened this change 6 years ago
Patch Set 3: add comment describing null-padding check

Also add a TODO comment to improve this check. It's not compliant with
spec as is. Addressing this will be a part of future changes.
dmitshur committed 6 years ago commit 168ee20982043604cc605e4a2526ec7c9452ed9d
Collapse all
Commit Message
FileFile
@@ -1,10 +1,10 @@
11
Parent:     e9561ae (Initial commit.)
22
Author:     Dmitri Shuralyov <dmitri@shuralyov.com>
33
AuthorDate: Sun Feb 11 15:10:28 2018 -0500
44
Commit:     Dmitri Shuralyov <dmitri@shuralyov.com>
5
CommitDate: Sun Feb 11 15:19:24 2018 -0500
5
CommitDate: Tue Feb 20 15:59:02 2018 -0500
66

77
Add initial parser implementation.
88

99
This is an initial implementation of a parser for the WOFF2 font
1010
packaging format.
parse.go
FileFile
@@ -53,10 +53,13 @@ func Parse(r io.Reader) (File, error) {
5353
	pd, err := parsePrivateData(r, hdr)
5454
	if err != nil {
5555
		return File{}, err
5656
	}
5757

58
	// Check for padding with a maximum of three null bytes.
59
	// TODO: This check needs to be moved to Extended Metadata and Private Data blocks,
60
	//       and made more precise (i.e., the beginning of those blocks must be 4-byte aligned).
5861
	n, err := io.Copy(discardZeroes{}, r)
5962
	if err != nil {
6063
		return File{}, fmt.Errorf("Parse: %v", err)
6164
	}
6265
	if n > 3 {