summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/image/font/sfnt/proprietary_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/image/font/sfnt/proprietary_test.go')
-rw-r--r--vendor/golang.org/x/image/font/sfnt/proprietary_test.go125
1 files changed, 114 insertions, 11 deletions
diff --git a/vendor/golang.org/x/image/font/sfnt/proprietary_test.go b/vendor/golang.org/x/image/font/sfnt/proprietary_test.go
index dcafdd4c7..bb14a34b5 100644
--- a/vendor/golang.org/x/image/font/sfnt/proprietary_test.go
+++ b/vendor/golang.org/x/image/font/sfnt/proprietary_test.go
@@ -23,15 +23,14 @@ go test golang.org/x/image/font/sfnt -args -proprietary \
-adobeDir=$HOME/fonts/adobe \
-appleDir=$HOME/fonts/apple \
-dejavuDir=$HOME/fonts/dejavu \
- -microsoftDir=$HOME/fonts/microsoft
+ -microsoftDir=$HOME/fonts/microsoft \
+ -notoDir=$HOME/fonts/noto
To only run those tests for the Microsoft fonts:
go test golang.org/x/image/font/sfnt -test.run=ProprietaryMicrosoft -args -proprietary etc
*/
-// TODO: add Google fonts (Droid? Noto?)? Emoji fonts?
-
// TODO: enable Apple/Microsoft tests by default on Darwin/Windows?
import (
@@ -88,26 +87,41 @@ var (
"/usr/share/fonts/truetype/msttcorefonts",
"directory name for the Microsoft proprietary fonts",
)
+
+ notoDir = flag.String(
+ "notoDir",
+ // Get the fonts from https://www.google.com/get/noto/
+ "",
+ "directory name for the Noto proprietary fonts",
+ )
)
-func TestProprietaryAdobeSourceCodeProOTF(t *testing.T) {
+func TestProprietaryAdobeSourceCodeProRegularOTF(t *testing.T) {
testProprietary(t, "adobe", "SourceCodePro-Regular.otf", 1500, -1)
}
-func TestProprietaryAdobeSourceCodeProTTF(t *testing.T) {
+func TestProprietaryAdobeSourceCodeProRegularTTF(t *testing.T) {
testProprietary(t, "adobe", "SourceCodePro-Regular.ttf", 1500, -1)
}
-func TestProprietaryAdobeSourceHanSansSC(t *testing.T) {
+func TestProprietaryAdobeSourceHanSansSCRegularOTF(t *testing.T) {
testProprietary(t, "adobe", "SourceHanSansSC-Regular.otf", 65535, -1)
}
-func TestProprietaryAdobeSourceSansProOTF(t *testing.T) {
- testProprietary(t, "adobe", "SourceSansPro-Regular.otf", 1800, -1)
+func TestProprietaryAdobeSourceSansProBlackOTF(t *testing.T) {
+ testProprietary(t, "adobe", "SourceSansPro-Black.otf", 1900, -1)
+}
+
+func TestProprietaryAdobeSourceSansProBlackTTF(t *testing.T) {
+ testProprietary(t, "adobe", "SourceSansPro-Black.ttf", 1900, -1)
}
-func TestProprietaryAdobeSourceSansProTTF(t *testing.T) {
- testProprietary(t, "adobe", "SourceSansPro-Regular.ttf", 1800, -1)
+func TestProprietaryAdobeSourceSansProRegularOTF(t *testing.T) {
+ testProprietary(t, "adobe", "SourceSansPro-Regular.otf", 1900, -1)
+}
+
+func TestProprietaryAdobeSourceSansProRegularTTF(t *testing.T) {
+ testProprietary(t, "adobe", "SourceSansPro-Regular.ttf", 1900, -1)
}
func TestProprietaryAppleAppleSymbols(t *testing.T) {
@@ -186,6 +200,14 @@ func TestProprietaryMicrosoftWebdings(t *testing.T) {
testProprietary(t, "microsoft", "Webdings.ttf", 200, -1)
}
+func TestProprietaryNotoColorEmoji(t *testing.T) {
+ testProprietary(t, "noto", "NotoColorEmoji.ttf", 2300, -1)
+}
+
+func TestProprietaryNotoSansRegular(t *testing.T) {
+ testProprietary(t, "noto", "NotoSans-Regular.ttf", 2400, -1)
+}
+
// testProprietary tests that we can load every glyph in the named font.
//
// The exact number of glyphs in the font can differ across its various
@@ -219,6 +241,8 @@ func testProprietary(t *testing.T, proprietor, filename string, minNumGlyphs, fi
dir = *dejavuDir
case "microsoft":
dir = *microsoftDir
+ case "noto":
+ dir = *notoDir
default:
panic("unreachable")
}
@@ -287,7 +311,7 @@ func testProprietary(t *testing.T, proprietor, filename string, minNumGlyphs, fi
iMax = firstUnsupportedGlyph
}
for i, numErrors := 0, 0; i < iMax; i++ {
- if _, err := f.LoadGlyph(&buf, GlyphIndex(i), ppem, nil); err != nil {
+ if _, err := f.LoadGlyph(&buf, GlyphIndex(i), ppem, nil); err != nil && err != ErrColoredGlyph {
t.Errorf("LoadGlyph(%d): %v", i, err)
numErrors++
}
@@ -385,6 +409,8 @@ var proprietaryVersions = map[string]string{
"adobe/SourceCodePro-Regular.otf": "Version 2.030;PS 1.0;hotconv 16.6.51;makeotf.lib2.5.65220",
"adobe/SourceCodePro-Regular.ttf": "Version 2.030;PS 1.000;hotconv 16.6.51;makeotf.lib2.5.65220",
"adobe/SourceHanSansSC-Regular.otf": "Version 1.004;PS 1.004;hotconv 1.0.82;makeotf.lib2.5.63406",
+ "adobe/SourceSansPro-Black.otf": "Version 2.020;PS 2.0;hotconv 1.0.86;makeotf.lib2.5.63406",
+ "adobe/SourceSansPro-Black.ttf": "Version 2.020;PS 2.000;hotconv 1.0.86;makeotf.lib2.5.63406",
"adobe/SourceSansPro-Regular.otf": "Version 2.020;PS 2.0;hotconv 1.0.86;makeotf.lib2.5.63406",
"adobe/SourceSansPro-Regular.ttf": "Version 2.020;PS 2.000;hotconv 1.0.86;makeotf.lib2.5.63406",
@@ -409,6 +435,9 @@ var proprietaryVersions = map[string]string{
"microsoft/Comic_Sans_MS.ttf": "Version 2.10",
"microsoft/Times_New_Roman.ttf": "Version 2.82",
"microsoft/Webdings.ttf": "Version 1.03",
+
+ "noto/NotoColorEmoji.ttf": "Version 1.33",
+ "noto/NotoSans-Regular.ttf": "Version 1.06",
}
// proprietaryFullNames holds the expected full name of each proprietary font
@@ -417,6 +446,8 @@ var proprietaryFullNames = map[string]string{
"adobe/SourceCodePro-Regular.otf": "Source Code Pro",
"adobe/SourceCodePro-Regular.ttf": "Source Code Pro",
"adobe/SourceHanSansSC-Regular.otf": "Source Han Sans SC Regular",
+ "adobe/SourceSansPro-Black.otf": "Source Sans Pro Black",
+ "adobe/SourceSansPro-Black.ttf": "Source Sans Pro Black",
"adobe/SourceSansPro-Regular.otf": "Source Sans Pro",
"adobe/SourceSansPro-Regular.ttf": "Source Sans Pro",
@@ -441,6 +472,9 @@ var proprietaryFullNames = map[string]string{
"microsoft/Comic_Sans_MS.ttf": "Comic Sans MS",
"microsoft/Times_New_Roman.ttf": "Times New Roman",
"microsoft/Webdings.ttf": "Webdings",
+
+ "noto/NotoColorEmoji.ttf": "Noto Color Emoji",
+ "noto/NotoSans-Regular.ttf": "Noto Sans",
}
// proprietaryGlyphIndexTestCases hold a sample of each font's rune to glyph
@@ -617,6 +651,54 @@ var proprietaryGlyphTestCases = map[string]map[rune][]Segment{
},
},
+ "adobe/SourceSansPro-Black.otf": {
+ 'ยค': { // U+00A4 CURRENCY SIGN
+ // -45 147 99 168 98 hstem
+ // 44 152 148 152 vstem
+ // 102 76 rmoveto
+ moveTo(102, 76),
+ // 71 71 rlineto
+ lineTo(173, 147),
+ // 31 -13 33 -6 33 32 34 6 31 hflex1
+ cubeTo(204, 134, 237, 128, 270, 128),
+ cubeTo(302, 128, 336, 134, 367, 147),
+ // 71 -71 85 85 -61 60 rlineto
+ lineTo(438, 76),
+ lineTo(523, 161),
+ lineTo(462, 221),
+ // 21 30 13 36 43 vvcurveto
+ cubeTo(483, 251, 496, 287, 496, 330),
+ // 42 -12 36 -21 29 vhcurveto
+ cubeTo(496, 372, 484, 408, 463, 437),
+ // 60 60 -85 85 -70 -70 rlineto
+ lineTo(523, 497),
+ lineTo(438, 582),
+ lineTo(368, 512),
+ // -31 13 -34 7 -33 -33 -34 -7 -31 hflex1
+ cubeTo(337, 525, 303, 532, 270, 532),
+ cubeTo(237, 532, 203, 525, 172, 512),
+ // -70 70 -85 -85 59 -60 rlineto
+ lineTo(102, 582),
+ lineTo(17, 497),
+ lineTo(76, 437),
+ // -20 -29 -12 -36 -42 vvcurveto
+ cubeTo(56, 408, 44, 372, 44, 330),
+ // -43 12 -36 21 -30 vhcurveto
+ cubeTo(44, 287, 56, 251, 77, 221),
+ // -60 -60 rlineto
+ lineTo(17, 161),
+ // 253 85 rmoveto
+ lineTo(102, 76),
+ moveTo(270, 246),
+ // -42 -32 32 52 52 32 32 42 42 32 -32 -52 -52 -32 -32 -42 hvcurveto
+ cubeTo(228, 246, 196, 278, 196, 330),
+ cubeTo(196, 382, 228, 414, 270, 414),
+ cubeTo(312, 414, 344, 382, 344, 330),
+ cubeTo(344, 278, 312, 246, 270, 246),
+ // endchar
+ },
+ },
+
"adobe/SourceSansPro-Regular.otf": {
',': {
// -309 -1 115 hstem
@@ -1152,6 +1234,27 @@ var proprietaryGlyphTestCases = map[string]map[rune][]Segment{
transform(-1<<14, 0, 0, +1<<14, 653, 0, quadTo(482, -217, 560, -384)),
},
},
+
+ "noto/NotoSans-Regular.ttf": {
+ 'i': {
+ // - contour #0
+ moveTo(354, 0),
+ lineTo(174, 0),
+ lineTo(174, 1098),
+ lineTo(354, 1098),
+ lineTo(354, 0),
+ // - contour #1
+ moveTo(160, 1395),
+ quadTo(160, 1455, 190, 1482),
+ quadTo(221, 1509, 266, 1509),
+ quadTo(308, 1509, 339, 1482),
+ quadTo(371, 1455, 371, 1395),
+ quadTo(371, 1336, 339, 1308),
+ quadTo(308, 1280, 266, 1280),
+ quadTo(221, 1280, 190, 1308),
+ quadTo(160, 1336, 160, 1395),
+ },
+ },
}
type kernTestCase struct {