remove redundant types in literals

This commit is contained in:
Denys Smirnov 2018-12-09 19:30:13 +02:00
parent 99f3184879
commit 5993a8b171
4 changed files with 26 additions and 26 deletions

View File

@ -12,7 +12,7 @@ import (
) )
// Defaults to the open source license. // Defaults to the open source license.
var licenseKey *LicenseKey = MakeUnlicensedKey() var licenseKey = MakeUnlicensedKey()
// Sets and validates the license key. // Sets and validates the license key.
func SetLicenseKey(content string, customerName string) error { func SetLicenseKey(content string, customerName string) error {

View File

@ -156,11 +156,11 @@ func (tl *TOCLine) prepareParagraph(sp *StyledParagraph, ctx DrawContext) {
sp.chunks = []*TextChunk{ sp.chunks = []*TextChunk{
&tl.Number, &tl.Number,
&TextChunk{ {
Text: title, Text: title,
Style: tl.Title.Style, Style: tl.Title.Style,
}, },
&TextChunk{ {
Text: page, Text: page,
Style: tl.Page.Style, Style: tl.Page.Style,
}, },

View File

@ -68,7 +68,7 @@ func NewToUnicodeCMap(codeToUnicode map[CharCode]rune) *CMap {
Ordering: "UCS", Ordering: "UCS",
Supplement: 0, Supplement: 0,
}, },
codespaces: []Codespace{Codespace{Low: 0, High: 0xffff}}, codespaces: []Codespace{{Low: 0, High: 0xffff}},
codeToUnicode: codeToUnicode, codeToUnicode: codeToUnicode,
} }
} }

View File

@ -113,7 +113,7 @@ func TestNewStandard14Font(t *testing.T) {
fonts.CharMetrics fonts.CharMetrics
} }
tests := map[model.Standard14Font]expect{ tests := map[model.Standard14Font]expect{
"Courier": expect{ "Courier": {
subtype: "Type1", subtype: "Type1",
basefont: "Courier", basefont: "Courier",
CharMetrics: fonts.CharMetrics{Wx: 600, Wy: 0}}, CharMetrics: fonts.CharMetrics{Wx: 600, Wy: 0}},
@ -249,7 +249,7 @@ func TestCharcodeBytesToUnicode(t *testing.T) {
} }
var charcodeBytesToUnicodeTest = []fontFragmentTest{ var charcodeBytesToUnicodeTest = []fontFragmentTest{
fontFragmentTest{"Helvetica built-in", {"Helvetica built-in",
"./testdata/font/simple.txt", 1, "./testdata/font/simple.txt", 1,
[]byte{32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, []byte{32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
@ -267,7 +267,7 @@ var charcodeBytesToUnicodeTest = []fontFragmentTest{
"abcdefghijklmnopqrstuvwxyz{|}~€ƒ„…†‡ˆ‰ŠOEŽ“”•˜™šoežŸ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·" + "abcdefghijklmnopqrstuvwxyz{|}~€ƒ„…†‡ˆ‰ŠOEŽ“”•˜™šoežŸ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·" +
"¸¹º»¼½¾¿ÀÁÂÃÄÅAEÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞfzàáâãäåaeçèéêëìíîïðñòóôõö÷øùúûüýþÿ", "¸¹º»¼½¾¿ÀÁÂÃÄÅAEÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞfzàáâãäåaeçèéêëìíîïðñòóôõö÷øùúûüýþÿ",
}, },
fontFragmentTest{"Symbol built-in", {"Symbol built-in",
"./testdata/font/simple.txt", 3, "./testdata/font/simple.txt", 3,
[]byte{32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, []byte{32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
@ -281,7 +281,7 @@ var charcodeBytesToUnicodeTest = []fontFragmentTest{
" !∀#∃%&∋()+,./0123456789:;<=>?≅ΑΒΧ∆ΕΦΓΗΙϑΚΛΜΝΟΠΘΡΣΤΥςΩΞΨΖ[∴]⊥_αβχδεφγηιϕκλµνοπθρστυϖω" + " !∀#∃%&∋()+,./0123456789:;<=>?≅ΑΒΧ∆ΕΦΓΗΙϑΚΛΜΝΟΠΘΡΣΤΥςΩΞΨΖ[∴]⊥_αβχδεφγηιϕκλµνοπθρστυϖω" +
"ξψζ{|}∼€ϒ′≤⁄∞ƒ♣♦♥♠↔←↑→↓°±″≥×∝∂•÷≠≡≈…↵ℵℑℜ℘⊗⊕∅∩∪⊃⊇⊄⊂⊆∈∉∠∇∏√⋅¬∧∨⇔⇐⇑⇒⇓◊〈∑〉∫⌠⌡", "ξψζ{|}∼€ϒ′≤⁄∞ƒ♣♦♥♠↔←↑→↓°±″≥×∝∂•÷≠≡≈…↵ℵℑℜ℘⊗⊕∅∩∪⊃⊇⊄⊂⊆∈∉∠∇∏√⋅¬∧∨⇔⇐⇑⇒⇓◊〈∑〉∫⌠⌡",
}, },
fontFragmentTest{"ZapfDingbats built-in", {"ZapfDingbats built-in",
"./testdata/font/simple.txt", 4, "./testdata/font/simple.txt", 4,
[]byte{32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, []byte{32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
@ -297,7 +297,7 @@ var charcodeBytesToUnicodeTest = []fontFragmentTest{
"❘❙❚❛❜❝❞❡❢❣❤❥❦❧♣♦♥♠①②③④⑤⑥⑦⑧⑨⑩❶❷❸❹❺❻❼❽❾❿➀➁➂➃➄➅➆➇➈➉➊➋➌➍➎➏➐➑➒➓➔→↔↕" + "❘❙❚❛❜❝❞❡❢❣❤❥❦❧♣♦♥♠①②③④⑤⑥⑦⑧⑨⑩❶❷❸❹❺❻❼❽❾❿➀➁➂➃➄➅➆➇➈➉➊➋➌➍➎➏➐➑➒➓➔→↔↕" +
"➘➙➚➛➜➝➞➟➠➡➢➣➤➥➦➧➨➩➪➫➬➭➮➯➱➲➳➴➵➶➷➸➹➺➻➼➽➾", "➘➙➚➛➜➝➞➟➠➡➢➣➤➥➦➧➨➩➪➫➬➭➮➯➱➲➳➴➵➶➷➸➹➺➻➼➽➾",
}, },
fontFragmentTest{"MacRoman encoding", {"MacRoman encoding",
"./testdata/font/axes.txt", 10, "./testdata/font/axes.txt", 10,
[]byte{32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, []byte{32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
@ -315,7 +315,7 @@ var charcodeBytesToUnicodeTest = []fontFragmentTest{
"abcdefghijklmnopqrstuvwxyz{|}~ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶fz®©™´¨≠AEØ∞" + "abcdefghijklmnopqrstuvwxyz{|}~ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶fz®©™´¨≠AEØ∞" +
"±≤≥¥µ∂∑∏π∫ªºΩaeø¿¡¬√ƒ≈∆«»…ÀÃÕOEoe—“”÷◊ÿŸfifl‡·„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ", "±≤≥¥µ∂∑∏π∫ªºΩaeø¿¡¬√ƒ≈∆«»…ÀÃÕOEoe—“”÷◊ÿŸfifl‡·„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ",
}, },
fontFragmentTest{"Test beginbfchar and beginbfrange cmap entries", {"Test beginbfchar and beginbfrange cmap entries",
"./testdata/font/Yemeni.txt", 470, "./testdata/font/Yemeni.txt", 470,
[]byte{0x1, 0xa8, 0x1, 0xb3, 0x1, 0xc2, 0x1, 0xcc, 0x1, 0xe7, 0x1, 0xef, 0x1, 0xf3, 0x0, []byte{0x1, 0xa8, 0x1, 0xb3, 0x1, 0xc2, 0x1, 0xcc, 0x1, 0xe7, 0x1, 0xef, 0x1, 0xf3, 0x0,
0x20, 0x1, 0xa2, 0x1, 0xfc, 0x2, 0x8, 0x1, 0xa6, 0x1, 0xe7, 0x0, 0x20, 0x2, 0xb, 0x0, 0x20, 0x1, 0xa2, 0x1, 0xfc, 0x2, 0x8, 0x1, 0xa6, 0x1, 0xe7, 0x0, 0x20, 0x2, 0xb, 0x0,
@ -323,30 +323,30 @@ var charcodeBytesToUnicodeTest = []fontFragmentTest{
0xcf, 0x0, 0xd0, 0x0, 0xd1, 0x1, 0xa1, 0x0, 0x20, 0x1, 0xa9, 0x2, 0x1}, 0xcf, 0x0, 0xd0, 0x0, 0xd1, 0x1, 0xa1, 0x0, 0x20, 0x1, 0xa9, 0x2, 0x1},
"ﺔﺟﺮﺸﻓﻛﻟ ﺎﻨﻴﺒﻓ ﻷ ﻻ ﻉ ٠١٢٣٤ﺍ ﺕﻭ", "ﺔﺟﺮﺸﻓﻛﻟ ﺎﻨﻴﺒﻓ ﻷ ﻻ ﻉ ٠١٢٣٤ﺍ ﺕﻭ",
}, },
fontFragmentTest{"TrueType font with ToUnicode cmap", {"TrueType font with ToUnicode cmap",
"./testdata/font/print_alerts.txt", 9, "./testdata/font/print_alerts.txt", 9,
[]byte{43, 40, 41, 34, 37, 42, 38, 49, 36, 38, 48, 34, 35, 36, 37, 35, 36, 58}, []byte{43, 40, 41, 34, 37, 42, 38, 49, 36, 38, 48, 34, 35, 36, 37, 35, 36, 58},
"Alerts on printing", "Alerts on printing",
}, },
fontFragmentTest{"Type0 font with ToUnicode cmap", {"Type0 font with ToUnicode cmap",
"./testdata/font/CollazoBio.txt", 7, "./testdata/font/CollazoBio.txt", 7,
[]byte{255, 50, 255, 65, 255, 78, 255, 68, 255, 79, 255, 77, 0, 32, 0, 32, 255, 77, 255, 65, []byte{255, 50, 255, 65, 255, 78, 255, 68, 255, 79, 255, 77, 0, 32, 0, 32, 255, 77, 255, 65,
255, 84, 255, 82, 255, 73, 255, 67, 255, 69, 255, 83, 0, 46}, 255, 84, 255, 82, 255, 73, 255, 67, 255, 69, 255, 83, 0, 46},
" .", " .",
}, },
fontFragmentTest{"Type1 font with FontFile entry", {"Type1 font with FontFile entry",
"./testdata/font/lm.txt", 7, "./testdata/font/lm.txt", 7,
[]byte{102, 65, 106, 66, 103}, []byte{102, 65, 106, 66, 103},
"{A|B}", "{A|B}",
}, },
fontFragmentTest{"Type1 font with /Encoding with /Differences", {"Type1 font with /Encoding with /Differences",
"./testdata/font/noise-invariant.txt", 102, "./testdata/font/noise-invariant.txt", 102,
[]byte{96, 247, 39, 32, 147, 231, 148, 32, 232, 32, 193, 111, 180, 32, 105, 116, []byte{96, 247, 39, 32, 147, 231, 148, 32, 232, 32, 193, 111, 180, 32, 105, 116,
169, 115, 32, 204, 195, 196, 197, 198, 199, 168, 202, 206, 226, 234, 172, 244, 173, 151, 169, 115, 32, 204, 195, 196, 197, 198, 199, 168, 202, 206, 226, 234, 172, 244, 173, 151,
177, 151, 178, 179, 183, 185, 188, 205, 184, 189}, 177, 151, 178, 179, 183, 185, 188, 205, 184, 189},
"‘ł’ “Ł” Ø `o´ it's ˝ˆ˜¯˘˙¨˚ˇªº‹ı›—–—†‡•„…˛¸‰", "‘ł’ “Ł” Ø `o´ it's ˝ˆ˜¯˘˙¨˚ˇªº‹ı›—–—†‡•„…˛¸‰",
}, },
fontFragmentTest{"base glyphs", {"base glyphs",
"./testdata/font/cover.txt", 11, "./testdata/font/cover.txt", 11,
[]byte{44, 45, 46, 48, 49, 50, 51, 53, 54, 55, 56, 58, 59, []byte{44, 45, 46, 48, 49, 50, 51, 53, 54, 55, 56, 58, 59,
65, 66, 67, 68, 69, 70, 71, 72, 65, 66, 67, 68, 69, 70, 71, 72,
@ -355,53 +355,53 @@ var charcodeBytesToUnicodeTest = []fontFragmentTest{
114, 115, 116, 117}, 114, 115, 116, 117},
",-.01235678:;ABCDEFGHTUabcdefghijlmnorstu", ",-.01235678:;ABCDEFGHTUabcdefghijlmnorstu",
}, },
fontFragmentTest{"tex glyphs 48->", {"tex glyphs 48->",
"./testdata/font/noise-contrast.txt", 36, "./testdata/font/noise-contrast.txt", 36,
[]byte{33, 48, 65, 104, 149, 253}, []byte{33, 48, 65, 104, 149, 253},
"!Ah•ý", "!Ah•ý",
}, },
fontFragmentTest{"tex2 glyphs ", {"tex2 glyphs ",
"./testdata/font/Weil.txt", 30, "./testdata/font/Weil.txt", 30,
[]byte{55, 0, 1, 2, 20, 24, 33, 50, 102, 103, 104, 105}, []byte{55, 0, 1, 2, 20, 24, 33, 50, 102, 103, 104, 105},
"↦−·×≤∼→∈{}⟨⟩", "↦−·×≤∼→∈{}⟨⟩",
}, },
fontFragmentTest{"additional glyphs", {"additional glyphs",
"./testdata/font/noise-contrast.txt", 34, "./testdata/font/noise-contrast.txt", 34,
[]byte{32, 40, 48, 64, 80, 88, 65, 104, 149, 253}, []byte{32, 40, 48, 64, 80, 88, 65, 104, 149, 253},
"({∑∑h•ý", "({∑∑h•ý",
}, },
fontFragmentTest{".notdef glyphs", {".notdef glyphs",
"./testdata/font/lec10.txt", 6, "./testdata/font/lec10.txt", 6,
[]byte{59, 66}, []byte{59, 66},
string([]rune{textencoding.MissingCodeRune, textencoding.MissingCodeRune}), string([]rune{textencoding.MissingCodeRune, textencoding.MissingCodeRune}),
}, },
fontFragmentTest{"Numbered glyphs pattern 1", {"Numbered glyphs pattern 1",
"./testdata/font/v14.txt", 14, "./testdata/font/v14.txt", 14,
[]byte{24, 25, 26, 27, 29}, []byte{24, 25, 26, 27, 29},
" ffifflfffi", " ffifflfffi",
}, },
fontFragmentTest{"Glyph aliases", {"Glyph aliases",
"./testdata/font/townes.txt", 10, "./testdata/font/townes.txt", 10,
[]byte{2, 3, 4, 5, 6, 7, 1, 8, 9, 5, 1, 10, 9, 5, 48}, []byte{2, 3, 4, 5, 6, 7, 1, 8, 9, 5, 1, 10, 9, 5, 48},
"Townes van Zan…", "Townes van Zan…",
}, },
fontFragmentTest{"Glyph `.` extensions. e.g. `integral.disp`", {"Glyph `.` extensions. e.g. `integral.disp`",
"./testdata/font/preview.txt", 156, "./testdata/font/preview.txt", 156,
[]byte{83, 0, 4, 67, 62, 64, 100, 65}, []byte{83, 0, 4, 67, 62, 64, 100, 65},
"∫=≈≥∈<d>", "∫=≈≥∈<d>",
}, },
fontFragmentTest{"A potpourri of glyph naming conventions", {"A potpourri of glyph naming conventions",
"./testdata/font/Ingmar.txt", 144, "./testdata/font/Ingmar.txt", 144,
[]byte{18, 20, 10, 11, 13, 14, 15, 16, 21, 22, 23, 25, 26, 27, 28, 29, 30, []byte{18, 20, 10, 11, 13, 14, 15, 16, 21, 22, 23, 25, 26, 27, 28, 29, 30,
31, 33, 12, 17, 19, 24}, 31, 33, 12, 17, 19, 24},
"ʼ8ČŽĆřćĐĭűőftffiflfffičž!fbfkffl\u00a0", "ʼ8ČŽĆřćĐĭűőftffiflfffičž!fbfkffl\u00a0",
}, },
fontFragmentTest{"Zapf Dingbats", {"Zapf Dingbats",
"./testdata/font/estimation.txt", 122, "./testdata/font/estimation.txt", 122,
[]byte{2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 14}, []byte{2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 14},
"✏✮✁☛❄❍❥❇◆✟✙", "✏✮✁☛❄❍❥❇◆✟✙",
}, },
fontFragmentTest{"Found these by trial and error", {"Found these by trial and error",
"./testdata/font/helminths.txt", 19, "./testdata/font/helminths.txt", 19,
[]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
@ -410,7 +410,7 @@ var charcodeBytesToUnicodeTest = []fontFragmentTest{
75, 76, 77}, 75, 76, 77},
" *ﺏﻁﻝﺍﺔﻴﻠﻜ،ﺕﺭﺘﻌﻤﺎﺠﻲﻨﻘﺩﻬ/ﻙﻭﻕﺃﻡﻋﻓﺴ٢٠٣ﻯﻥﺒﺸﺌﺱﻷ,ﺯﺤﺄﻀـﺓﺫ.)٤(٩ل٥٧٨ﻸﻰ%١ﺇ٦ﺡﻱﻅﻐﺼﻑﺨﺀﻊLM", " *ﺏﻁﻝﺍﺔﻴﻠﻜ،ﺕﺭﺘﻌﻤﺎﺠﻲﻨﻘﺩﻬ/ﻙﻭﻕﺃﻡﻋﻓﺴ٢٠٣ﻯﻥﺒﺸﺌﺱﻷ,ﺯﺤﺄﻀـﺓﺫ.)٤(٩ل٥٧٨ﻸﻰ%١ﺇ٦ﺡﻱﻅﻐﺼﻑﺨﺀﻊLM",
}, },
fontFragmentTest{"Tesseract", {"Tesseract",
"./testdata/font/tesseract.txt", 3, "./testdata/font/tesseract.txt", 3,
[]byte{0, 65, 0, 97, []byte{0, 65, 0, 97,
1, 2, 1, 65, 1, 97, 1, 2, 1, 65, 1, 97,