summaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/golang/freetype
diff options
context:
space:
mode:
Diffstat (limited to 'Godeps/_workspace/src/github.com/golang/freetype')
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/AUTHORS1
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/CONTRIBUTORS1
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/example/drawer/main.go6
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/example/freetype/main.go4
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/example/gamma/main.go4
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/example/raster/main.go4
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/example/round/main.go4
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/example/truetype/main.go6
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/freetype.go8
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/raster/geom.go2
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/raster/raster.go2
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/raster/stroke.go2
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/truetype/face.go6
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/truetype/face_test.go4
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/truetype/glyph.go4
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/truetype/hint.go2
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/truetype/hint_test.go2
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/truetype/truetype.go167
-rw-r--r--Godeps/_workspace/src/github.com/golang/freetype/truetype/truetype_test.go27
19 files changed, 185 insertions, 71 deletions
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/AUTHORS b/Godeps/_workspace/src/github.com/golang/freetype/AUTHORS
index 5d8b8a6b7..7b70f7768 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/AUTHORS
+++ b/Godeps/_workspace/src/github.com/golang/freetype/AUTHORS
@@ -15,3 +15,4 @@ Google Inc.
Jeff R. Allen <jra@nella.org>
Rémy Oudompheng <oudomphe@phare.normalesup.org>
Roger Peppe <rogpeppe@gmail.com>
+Steven Edwards <steven@stephenwithav.com>
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/CONTRIBUTORS b/Godeps/_workspace/src/github.com/golang/freetype/CONTRIBUTORS
index 32cb6753b..7494b12c3 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/CONTRIBUTORS
+++ b/Godeps/_workspace/src/github.com/golang/freetype/CONTRIBUTORS
@@ -33,3 +33,4 @@ Rémy Oudompheng <oudomphe@phare.normalesup.org> <remyoudompheng@gmail.com>
Rob Pike <r@golang.org>
Roger Peppe <rogpeppe@gmail.com>
Russ Cox <rsc@golang.org>
+Steven Edwards <steven@stephenwithav.com>
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/example/drawer/main.go b/Godeps/_workspace/src/github.com/golang/freetype/example/drawer/main.go
index 4af981f9f..0f57d1767 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/example/drawer/main.go
+++ b/Godeps/_workspace/src/github.com/golang/freetype/example/drawer/main.go
@@ -23,9 +23,9 @@ import (
"math"
"os"
- "github.com/golang/freetype/truetype"
- "golang.org/x/image/font"
- "golang.org/x/image/math/fixed"
+ "github.com/mattermost/platform/Godeps/_workspace/src/github.com/golang/freetype/truetype"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/font"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/math/fixed"
)
var (
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/example/freetype/main.go b/Godeps/_workspace/src/github.com/golang/freetype/example/freetype/main.go
index 21657a381..50cf246ec 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/example/freetype/main.go
+++ b/Godeps/_workspace/src/github.com/golang/freetype/example/freetype/main.go
@@ -22,8 +22,8 @@ import (
"log"
"os"
- "github.com/golang/freetype"
- "golang.org/x/image/font"
+ "github.com/mattermost/platform/Godeps/_workspace/src/github.com/golang/freetype"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/font"
)
var (
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/example/gamma/main.go b/Godeps/_workspace/src/github.com/golang/freetype/example/gamma/main.go
index 778697f4f..81f476e89 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/example/gamma/main.go
+++ b/Godeps/_workspace/src/github.com/golang/freetype/example/gamma/main.go
@@ -19,8 +19,8 @@ import (
"log"
"os"
- "github.com/golang/freetype/raster"
- "golang.org/x/image/math/fixed"
+ "github.com/mattermost/platform/Godeps/_workspace/src/github.com/golang/freetype/raster"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/math/fixed"
)
func p(x, y int) fixed.Point26_6 {
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/example/raster/main.go b/Godeps/_workspace/src/github.com/golang/freetype/example/raster/main.go
index ae9c57f97..ca3cddfdc 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/example/raster/main.go
+++ b/Godeps/_workspace/src/github.com/golang/freetype/example/raster/main.go
@@ -20,8 +20,8 @@ import (
"log"
"os"
- "github.com/golang/freetype/raster"
- "golang.org/x/image/math/fixed"
+ "github.com/mattermost/platform/Godeps/_workspace/src/github.com/golang/freetype/raster"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/math/fixed"
)
type node struct {
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/example/round/main.go b/Godeps/_workspace/src/github.com/golang/freetype/example/round/main.go
index 6c3012e62..b849f614f 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/example/round/main.go
+++ b/Godeps/_workspace/src/github.com/golang/freetype/example/round/main.go
@@ -26,8 +26,8 @@ import (
"math"
"os"
- "github.com/golang/freetype/raster"
- "golang.org/x/image/math/fixed"
+ "github.com/mattermost/platform/Godeps/_workspace/src/github.com/golang/freetype/raster"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/math/fixed"
)
// pDot returns the dot product p·q.
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/example/truetype/main.go b/Godeps/_workspace/src/github.com/golang/freetype/example/truetype/main.go
index 5fc72f771..e6b4d28eb 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/example/truetype/main.go
+++ b/Godeps/_workspace/src/github.com/golang/freetype/example/truetype/main.go
@@ -16,9 +16,9 @@ import (
"io/ioutil"
"log"
- "github.com/golang/freetype/truetype"
- "golang.org/x/image/font"
- "golang.org/x/image/math/fixed"
+ "github.com/mattermost/platform/Godeps/_workspace/src/github.com/golang/freetype/truetype"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/font"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/math/fixed"
)
var fontfile = flag.String("fontfile", "../../testdata/luxisr.ttf", "filename of the ttf font")
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/freetype.go b/Godeps/_workspace/src/github.com/golang/freetype/freetype.go
index bec01f6b7..27d1c5162 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/freetype.go
+++ b/Godeps/_workspace/src/github.com/golang/freetype/freetype.go
@@ -13,10 +13,10 @@ import (
"image"
"image/draw"
- "github.com/golang/freetype/raster"
- "github.com/golang/freetype/truetype"
- "golang.org/x/image/font"
- "golang.org/x/image/math/fixed"
+ "github.com/mattermost/platform/Godeps/_workspace/src/github.com/golang/freetype/raster"
+ "github.com/mattermost/platform/Godeps/_workspace/src/github.com/golang/freetype/truetype"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/font"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/math/fixed"
)
// These constants determine the size of the glyph cache. The cache is keyed
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/raster/geom.go b/Godeps/_workspace/src/github.com/golang/freetype/raster/geom.go
index f3696ea98..1a2b8a77b 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/raster/geom.go
+++ b/Godeps/_workspace/src/github.com/golang/freetype/raster/geom.go
@@ -9,7 +9,7 @@ import (
"fmt"
"math"
- "golang.org/x/image/math/fixed"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/math/fixed"
)
// maxAbs returns the maximum of abs(a) and abs(b).
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/raster/raster.go b/Godeps/_workspace/src/github.com/golang/freetype/raster/raster.go
index 995925e2a..859bee657 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/raster/raster.go
+++ b/Godeps/_workspace/src/github.com/golang/freetype/raster/raster.go
@@ -18,7 +18,7 @@ package raster
import (
"strconv"
- "golang.org/x/image/math/fixed"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/math/fixed"
)
// A cell is part of a linked list (for a given yi co-ordinate) of accumulated
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/raster/stroke.go b/Godeps/_workspace/src/github.com/golang/freetype/raster/stroke.go
index 8d4379757..fa9ba640b 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/raster/stroke.go
+++ b/Godeps/_workspace/src/github.com/golang/freetype/raster/stroke.go
@@ -6,7 +6,7 @@
package raster
import (
- "golang.org/x/image/math/fixed"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/math/fixed"
)
// Two points are considered practically equal if the square of the distance
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/truetype/face.go b/Godeps/_workspace/src/github.com/golang/freetype/truetype/face.go
index d64a014c3..e800cd1bd 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/truetype/face.go
+++ b/Godeps/_workspace/src/github.com/golang/freetype/truetype/face.go
@@ -8,9 +8,9 @@ package truetype
import (
"image"
- "github.com/golang/freetype/raster"
- "golang.org/x/image/font"
- "golang.org/x/image/math/fixed"
+ "github.com/mattermost/platform/Godeps/_workspace/src/github.com/golang/freetype/raster"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/font"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/math/fixed"
)
func powerOf2(i int) bool {
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/truetype/face_test.go b/Godeps/_workspace/src/github.com/golang/freetype/truetype/face_test.go
index 856581dff..6833e18bf 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/truetype/face_test.go
+++ b/Godeps/_workspace/src/github.com/golang/freetype/truetype/face_test.go
@@ -12,8 +12,8 @@ import (
"strings"
"testing"
- "golang.org/x/image/font"
- "golang.org/x/image/math/fixed"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/font"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/math/fixed"
)
func BenchmarkDrawString(b *testing.B) {
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/truetype/glyph.go b/Godeps/_workspace/src/github.com/golang/freetype/truetype/glyph.go
index c2935a58e..eca2623d1 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/truetype/glyph.go
+++ b/Godeps/_workspace/src/github.com/golang/freetype/truetype/glyph.go
@@ -6,8 +6,8 @@
package truetype
import (
- "golang.org/x/image/font"
- "golang.org/x/image/math/fixed"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/font"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/math/fixed"
)
// TODO: implement VerticalHinting.
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/truetype/hint.go b/Godeps/_workspace/src/github.com/golang/freetype/truetype/hint.go
index 0315de511..e4eaf9294 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/truetype/hint.go
+++ b/Godeps/_workspace/src/github.com/golang/freetype/truetype/hint.go
@@ -12,7 +12,7 @@ import (
"errors"
"math"
- "golang.org/x/image/math/fixed"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/math/fixed"
)
const (
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/truetype/hint_test.go b/Godeps/_workspace/src/github.com/golang/freetype/truetype/hint_test.go
index 7eb43dde0..d218bb0f6 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/truetype/hint_test.go
+++ b/Godeps/_workspace/src/github.com/golang/freetype/truetype/hint_test.go
@@ -10,7 +10,7 @@ import (
"strings"
"testing"
- "golang.org/x/image/math/fixed"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/math/fixed"
)
func TestBytecode(t *testing.T) {
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/truetype/truetype.go b/Godeps/_workspace/src/github.com/golang/freetype/truetype/truetype.go
index 7d166ca77..c69194d33 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/truetype/truetype.go
+++ b/Godeps/_workspace/src/github.com/golang/freetype/truetype/truetype.go
@@ -20,12 +20,49 @@ package truetype
import (
"fmt"
- "golang.org/x/image/math/fixed"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/math/fixed"
)
// An Index is a Font's index of a rune.
type Index uint16
+// A NameID identifies a name table entry.
+//
+// See https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6name.html
+type NameID uint16
+
+const (
+ NameIDCopyright NameID = 0
+ NameIDFontFamily = 1
+ NameIDFontSubfamily = 2
+ NameIDUniqueSubfamilyID = 3
+ NameIDFontFullName = 4
+ NameIDNameTableVersion = 5
+ NameIDPostscriptName = 6
+ NameIDTrademarkNotice = 7
+ NameIDManufacturerName = 8
+ NameIDDesignerName = 9
+ NameIDFontDescription = 10
+ NameIDFontVendorURL = 11
+ NameIDFontDesignerURL = 12
+ NameIDFontLicense = 13
+ NameIDFontLicenseURL = 14
+ NameIDPreferredFamily = 16
+ NameIDPreferredSubfamily = 17
+ NameIDCompatibleName = 18
+ NameIDSampleText = 19
+)
+
+const (
+ // A 32-bit encoding consists of a most-significant 16-bit Platform ID and a
+ // least-significant 16-bit Platform Specific ID. The magic numbers are
+ // specified at https://www.microsoft.com/typography/otspec/name.htm
+ unicodeEncoding = 0x00000003 // PID = 0 (Unicode), PSID = 3 (Unicode 2.0)
+ microsoftSymbolEncoding = 0x00030000 // PID = 3 (Microsoft), PSID = 0 (Symbol)
+ microsoftUCS2Encoding = 0x00030001 // PID = 3 (Microsoft), PSID = 1 (UCS-2)
+ microsoftUCS4Encoding = 0x0003000a // PID = 3 (Microsoft), PSID = 10 (UCS-4)
+)
+
// An HMetric holds the horizontal metrics of a single glyph.
type HMetric struct {
AdvanceWidth, LeftSideBearing fixed.Int26_6
@@ -78,6 +115,51 @@ func readTable(ttf []byte, offsetLength []byte) ([]byte, error) {
return ttf[offset:end], nil
}
+// parseSubtables returns the offset and platformID of the best subtable in
+// table, where best favors a Unicode cmap encoding, and failing that, a
+// Microsoft cmap encoding. offset is the offset of the first subtable in
+// table, and size is the size of each subtable.
+//
+// If pred is non-nil, then only subtables that satisfy that predicate will be
+// considered.
+func parseSubtables(table []byte, name string, offset, size int, pred func([]byte) bool) (
+ bestOffset int, bestPID uint32, retErr error) {
+
+ if len(table) < 4 {
+ return 0, 0, FormatError(name + " too short")
+ }
+ nSubtables := int(u16(table, 2))
+ if len(table) < size*nSubtables+offset {
+ return 0, 0, FormatError(name + " too short")
+ }
+ ok := false
+ for i := 0; i < nSubtables; i, offset = i+1, offset+size {
+ if pred != nil && !pred(table[offset:]) {
+ continue
+ }
+ // We read the 16-bit Platform ID and 16-bit Platform Specific ID as a single uint32.
+ // All values are big-endian.
+ pidPsid := u32(table, offset)
+ // We prefer the Unicode cmap encoding. Failing to find that, we fall
+ // back onto the Microsoft cmap encoding.
+ if pidPsid == unicodeEncoding {
+ bestOffset, bestPID, ok = offset, pidPsid>>16, true
+ break
+
+ } else if pidPsid == microsoftSymbolEncoding ||
+ pidPsid == microsoftUCS2Encoding ||
+ pidPsid == microsoftUCS4Encoding {
+
+ bestOffset, bestPID, ok = offset, pidPsid>>16, true
+ // We don't break out of the for loop, so that Unicode can override Microsoft.
+ }
+ }
+ if !ok {
+ return 0, 0, UnsupportedError(name + " encoding")
+ }
+ return bestOffset, bestPID, nil
+}
+
const (
locaOffsetFormatUnknown int = iota
locaOffsetFormatShort
@@ -93,7 +175,7 @@ type cm struct {
type Font struct {
// Tables sliced from the TTF data. The different tables are documented
// at http://developer.apple.com/fonts/TTRefMan/RM06/Chap6.html
- cmap, cvt, fpgm, glyf, hdmx, head, hhea, hmtx, kern, loca, maxp, os2, prep, vmtx []byte
+ cmap, cvt, fpgm, glyf, hdmx, head, hhea, hmtx, kern, loca, maxp, name, os2, prep, vmtx []byte
cmapIndexes []byte
@@ -112,46 +194,13 @@ func (f *Font) parseCmap() error {
cmapFormat4 = 4
cmapFormat12 = 12
languageIndependent = 0
-
- // A 32-bit encoding consists of a most-significant 16-bit Platform ID and a
- // least-significant 16-bit Platform Specific ID. The magic numbers are
- // specified at https://www.microsoft.com/typography/otspec/name.htm
- unicodeEncoding = 0x00000003 // PID = 0 (Unicode), PSID = 3 (Unicode 2.0)
- microsoftSymbolEncoding = 0x00030000 // PID = 3 (Microsoft), PSID = 0 (Symbol)
- microsoftUCS2Encoding = 0x00030001 // PID = 3 (Microsoft), PSID = 1 (UCS-2)
- microsoftUCS4Encoding = 0x0003000a // PID = 3 (Microsoft), PSID = 10 (UCS-4)
)
- if len(f.cmap) < 4 {
- return FormatError("cmap too short")
- }
- nsubtab := int(u16(f.cmap, 2))
- if len(f.cmap) < 8*nsubtab+4 {
- return FormatError("cmap too short")
- }
- offset, found, x := 0, false, 4
- for i := 0; i < nsubtab; i++ {
- // We read the 16-bit Platform ID and 16-bit Platform Specific ID as a single uint32.
- // All values are big-endian.
- pidPsid, o := u32(f.cmap, x), u32(f.cmap, x+4)
- x += 8
- // We prefer the Unicode cmap encoding. Failing to find that, we fall
- // back onto the Microsoft cmap encoding.
- if pidPsid == unicodeEncoding {
- offset, found = int(o), true
- break
-
- } else if pidPsid == microsoftSymbolEncoding ||
- pidPsid == microsoftUCS2Encoding ||
- pidPsid == microsoftUCS4Encoding {
-
- offset, found = int(o), true
- // We don't break out of the for loop, so that Unicode can override Microsoft.
- }
- }
- if !found {
- return UnsupportedError("cmap encoding")
+ offset, _, err := parseSubtables(f.cmap, "cmap", 4, 8, nil)
+ if err != nil {
+ return err
}
+ offset = int(u32(f.cmap, offset+4))
if offset <= 0 || offset > len(f.cmap) {
return FormatError("bad cmap offset")
}
@@ -345,6 +394,44 @@ func (f *Font) Index(x rune) Index {
return 0
}
+// Name returns the Font's name value for the given NameID. It returns "" if
+// there was an error, or if that name was not found.
+func (f *Font) Name(id NameID) string {
+ x, platformID, err := parseSubtables(f.name, "name", 6, 12, func(b []byte) bool {
+ return NameID(u16(b, 6)) == id
+ })
+ if err != nil {
+ return ""
+ }
+ offset, length := u16(f.name, 4)+u16(f.name, x+10), u16(f.name, x+8)
+ // Return the ASCII value of the encoded string.
+ // The string is encoded as UTF-16 on non-Apple platformIDs; Apple is platformID 1.
+ src := f.name[offset : offset+length]
+ var dst []byte
+ if platformID != 1 { // UTF-16.
+ if len(src)&1 != 0 {
+ return ""
+ }
+ dst = make([]byte, len(src)/2)
+ for i := range dst {
+ dst[i] = printable(u16(src, 2*i))
+ }
+ } else { // ASCII.
+ dst = make([]byte, len(src))
+ for i, c := range src {
+ dst[i] = printable(uint16(c))
+ }
+ }
+ return string(dst)
+}
+
+func printable(r uint16) byte {
+ if 0x20 <= r && r < 0x7f {
+ return byte(r)
+ }
+ return '?'
+}
+
// unscaledHMetric returns the unscaled horizontal metrics for the glyph with
// the given index.
func (f *Font) unscaledHMetric(i Index) (h HMetric) {
@@ -518,6 +605,8 @@ func parse(ttf []byte, offset int) (font *Font, err error) {
f.loca, err = readTable(ttf, ttf[x+8:x+16])
case "maxp":
f.maxp, err = readTable(ttf, ttf[x+8:x+16])
+ case "name":
+ f.name, err = readTable(ttf, ttf[x+8:x+16])
case "OS/2":
f.os2, err = readTable(ttf, ttf[x+8:x+16])
case "prep":
diff --git a/Godeps/_workspace/src/github.com/golang/freetype/truetype/truetype_test.go b/Godeps/_workspace/src/github.com/golang/freetype/truetype/truetype_test.go
index ce7f1277a..2382ab112 100644
--- a/Godeps/_workspace/src/github.com/golang/freetype/truetype/truetype_test.go
+++ b/Godeps/_workspace/src/github.com/golang/freetype/truetype/truetype_test.go
@@ -15,8 +15,8 @@ import (
"strings"
"testing"
- "golang.org/x/image/font"
- "golang.org/x/image/math/fixed"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/font"
+ "github.com/mattermost/platform/Godeps/_workspace/src/golang.org/x/image/math/fixed"
)
func parseTestdataFont(name string) (f *Font, testdataIsOptional bool, err error) {
@@ -211,6 +211,29 @@ func TestIndex(t *testing.T) {
}
}
+func TestName(t *testing.T) {
+ testCases := map[string]string{
+ "luximr": "Luxi Mono",
+ "luxirr": "Luxi Serif",
+ "luxisr": "Luxi Sans",
+ }
+
+ for name, want := range testCases {
+ f, testdataIsOptional, err := parseTestdataFont(name)
+ if err != nil {
+ if testdataIsOptional {
+ t.Log(err)
+ } else {
+ t.Fatal(err)
+ }
+ continue
+ }
+ if got := f.Name(NameIDFontFamily); got != want {
+ t.Errorf("%s: got %q, want %q", name, got, want)
+ }
+ }
+}
+
type scalingTestData struct {
advanceWidth fixed.Int26_6
bounds fixed.Rectangle26_6