dmitri.shuralyov.com/service/change/fs

Update mock data for first woff2 change.
dmitshur committed 6 years ago commit e5d81b90c30ef8b47bf582517aeaf4271c684c2e
Showing partial commit. Full Commit
Collapse all
fs/fs.go
@@ -31,39 +31,69 @@ var s = struct {
				ID:        1,
				State:     change.OpenState,
				Title:     "Initial implementation of woff2.",
				Labels:    nil,
				Author:    shurcool,
				CreatedAt: time.Now().UTC().Add(-5 * time.Minute),
				CreatedAt: time.Date(2018, 2, 12, 0, 9, 19, 621031866, time.UTC),
				Replies:   0,

				Commits: 1,
			},
			Timeline: []interface{}{
				change.Review{
					User:      users.User{Login: "Eric Grosse", AvatarURL: "https://lh6.googleusercontent.com/-_sdEtv2PRxk/AAAAAAAAAAI/AAAAAAAAAAA/aE1Q66Cuvb4/s100-p/photo.jpg"},
					CreatedAt: time.Now().UTC().Add(-1 * time.Minute),
					State:     change.Approved,
					Comments: []change.InlineComment{
						{
							File: "LICENSE",
							Line: 26,
							Body: "Ok by me, but how was this chosen?",
						},
						{
							File: "parse.go",
							Line: 31,
							Body: "As someone who reads the server logs, my gut feeling is that 1 QPS of Lookup logs will give me sufficient data to tell me the system is working, without creating a big mess.",
						},
					},
				change.Comment{
					User:      shurcool,
					CreatedAt: time.Date(2018, 2, 12, 0, 9, 19, 621031866, time.UTC),
					Body: `Add initial parser implementation.

This is an initial implementation of a parser for the WOFF2 font
packaging format.

It is incomplete; further work will come later. The scope for this
milestone was to be able to parse .woff2 files for the needs of the
github.com/ConradIrwin/font/sfnt package.

At this time, the API is very low level and maps directly to the binary
format of the file, as described in [its specification](https://www.w3.org/TR/WOFF2/). This API is in
early development and is expected to change as further progress is made.

It successfully parses some Go font family .woff2 files that were
generated using the https://github.com/google/woff2 encoder
from the Go font source .ttf files located at
https://go.googlesource.com/image/+/master/font/gofont/ttfs/.

Add basic test coverage.

Helps https://github.com/ConradIrwin/font/issues/1.

For convenience, a ` + "`" + `godoc` + "`" + ` view of this change can be seen [here](https://redpen.io/rk9a75c358f45654a8).`,
				},
			},
			Commits: []change.Commit{{
				SHA:        "4a911c4a1eabcc20a66ccc5c983dede401da2796",
				Message:    "Initial implementation of woff2.\n\nMaybe some additional details here.",
				SHA: "d2568fb6f10921b2d0c84d58bad14b2fadb88aa7",
				Message: `Add initial parser implementation.

This is an initial implementation of a parser for the WOFF2 font
packaging format.

It is incomplete; further work will come later. The scope for this
milestone was to be able to parse .woff2 files for the needs of the
github.com/ConradIrwin/font/sfnt package.

At this time, the API is very low level and maps directly to the binary
format of the file, as described in its specification. This API is in
early development and is expected to change as further progress is made.

It successfully parses some Go font family .woff2 files that were
generated using the https://github.com/google/woff2 encoder
from the Go font source .ttf files located at
https://go.googlesource.com/image/+/master/font/gofont/ttfs/.

Add basic test coverage.

Helps https://github.com/ConradIrwin/font/issues/1.`,
				Author:     shurcool,
				AuthorTime: time.Now().UTC().Add(-10 * time.Minute),
				AuthorTime: time.Date(2018, 2, 11, 20, 10, 28, 0, time.UTC),
			}},
			Diff: []byte(diff),
		},
	},
}
@@ -171,53 +201,53 @@ var shurcool = users.User{
	AvatarURL: "https://dmitri.shuralyov.com/avatar.jpg",
	HTMLURL:   "https://dmitri.shuralyov.com",
	SiteAdmin: true,
}

const diff = `diff --git a/LICENSE b/LICENSE
const diff = `diff --git a/Commit Message b/Commit Message
new file mode 100644
index 0000000..49ea0f9
index 0000000..dfb31fe
--- /dev/null
+++ b/LICENSE
+++ b/Commit Message
@@ -0,0 +1,27 @@
+Copyright (c) 2018 The Go Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+   * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+   * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+   * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Parent:     e9561aed (Initial commit.)
+Author:     Dmitri Shuralyov <dmitri@shuralyov.com>
+AuthorDate: Sun Feb 11 15:10:28 2018 -0500
+Commit:     Dmitri Shuralyov <dmitri@shuralyov.com>
+CommitDate: Sun Feb 11 15:19:24 2018 -0500
+
+Add initial parser implementation.
+
+This is an initial implementation of a parser for the WOFF2 font
+packaging format.
+
+It is incomplete; further work will come later. The scope for this
+milestone was to be able to parse .woff2 files for the needs of the
+github.com/ConradIrwin/font/sfnt package.
+
+At this time, the API is very low level and maps directly to the binary
+format of the file, as described in its specification. This API is in
+early development and is expected to change as further progress is made.
+
+It successfully parses some Go font family .woff2 files that were
+generated using the https://github.com/google/woff2 encoder
+from the Go font source .ttf files located at
+https://go.googlesource.com/image/+/master/font/gofont/ttfs/.
+
+Add basic test coverage.
+
+Helps https://github.com/ConradIrwin/font/issues/1.
diff --git a/doc.go b/doc.go
new file mode 100644
index 0000000..a751214
--- /dev/null
index fd35888..a751214 100644
--- a/doc.go
+++ b/doc.go
@@ -0,0 +1,4 @@
+// Package woff2 implements a WOFF2 font decoder.
+//
+// The WOFF2 font packaging format is specified at https://www.w3.org/TR/WOFF2/.
+package woff2
@@ -2,5 +2,3 @@
 //
 // The WOFF2 font packaging format is specified at https://www.w3.org/TR/WOFF2/.
 package woff2
-
-// TODO: Implement.
diff --git a/parse.go b/parse.go
new file mode 100644
index 0000000..498a4a8
--- /dev/null
+++ b/parse.go
@@ -860,19 +890,17 @@ index 0000000..3c13a55
+	61: uint32('F'<<24 | 'e'<<16 | 'a'<<8 | 't'),
+	62: uint32('S'<<24 | 'i'<<16 | 'l'<<8 | 'l'),
+}
diff --git a/tags_test.go b/tags_test.go
new file mode 100644
index 0000000..19eab67
index 0000000..3980f39
--- /dev/null
+++ b/tags_test.go
@@ -0,0 +1,12 @@
@@ -0,0 +1,10 @@
+package woff2
+
+import (
+	"testing"
+)
+import "testing"
+
+func TestKnownTableTagsLength(t *testing.T) {
+	const want = 63
+	if got := len(knownTableTags); got != want {
+		t.Errorf("got len(knownTableTags): %v, want: %v", got, want)