summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/golang/freetype/truetype/truetype.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-05-17 16:51:25 -0400
committerGitHub <noreply@github.com>2017-05-17 16:51:25 -0400
commitd103ed6ca97ca5a2669f6cf5fe4b3d2a9c945f26 (patch)
treedbde13123c6add150448f7b75753ac022d862475 /vendor/github.com/golang/freetype/truetype/truetype.go
parentcd23b8139a9463b67e3096744321f6f4eb0ca40a (diff)
downloadchat-d103ed6ca97ca5a2669f6cf5fe4b3d2a9c945f26.tar.gz
chat-d103ed6ca97ca5a2669f6cf5fe4b3d2a9c945f26.tar.bz2
chat-d103ed6ca97ca5a2669f6cf5fe4b3d2a9c945f26.zip
Upgrading server dependancies (#6431)
Diffstat (limited to 'vendor/github.com/golang/freetype/truetype/truetype.go')
-rw-r--r--vendor/github.com/golang/freetype/truetype/truetype.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/vendor/github.com/golang/freetype/truetype/truetype.go b/vendor/github.com/golang/freetype/truetype/truetype.go
index 7a17d8e86..7270bbf22 100644
--- a/vendor/github.com/golang/freetype/truetype/truetype.go
+++ b/vendor/github.com/golang/freetype/truetype/truetype.go
@@ -324,11 +324,20 @@ func (f *Font) parseKern() error {
if version != 0 {
return UnsupportedError(fmt.Sprintf("kern version: %d", version))
}
+
n, offset := u16(f.kern, offset), offset+2
- if n != 1 {
- return UnsupportedError(fmt.Sprintf("kern nTables: %d", n))
- }
- offset += 2
+ if n == 0 {
+ return UnsupportedError("kern nTables: 0")
+ }
+ // TODO: support multiple subtables. In practice, almost all .ttf files
+ // have only one subtable, if they have a kern table at all. But it's not
+ // impossible. Xolonium Regular (https://fontlibrary.org/en/font/xolonium)
+ // has 3 subtables. Those subtables appear to be disjoint, rather than
+ // being the same kerning pairs encoded in three different ways.
+ //
+ // For now, we'll use only the first subtable.
+
+ offset += 2 // Skip the version.
length, offset := int(u16(f.kern, offset)), offset+2
coverage, offset := u16(f.kern, offset), offset+2
if coverage != 0x0001 {