golint and godoc fixes in textencoding

This commit is contained in:
Gunnsteinn Hall 2018-08-03 10:18:44 +00:00
parent a487f6848a
commit 0b25fcc4e7
5 changed files with 11 additions and 9 deletions

View File

@ -10,6 +10,7 @@ import (
"github.com/unidoc/unidoc/pdf/core"
)
// TextEncoder defines the common methods that a text encoder implementation must have in UniDoc.
type TextEncoder interface {
// String returns a string that describes the TextEncoder instance.
String() string

View File

@ -4,7 +4,8 @@
*/
/*
* The embedded glyph to unicode mappings specified in this file are distributed under the terms
* listed in ./glyphlist/glyphlist.txt, ./glyphlist/texglyphlist.txt and ./glyphlist/addtional.txt
* listed in ./testdata/glyphlist/glyphlist.txt, ./testdata/glyphlist/texglyphlist.txt
* and ./tesdtdata/glyphlist/addtional.txt
*/
package textencoding

View File

@ -4,7 +4,7 @@
*/
/*
* The embedded glyph to unicode mappings specified in this file are distributed under the terms listed in
* ./glyphlist/zapfdingbats.txt.
* ./testdata/glyphlist/zapfdingbats.txt.
*/
package textencoding

View File

@ -18,8 +18,8 @@ type IdentityEncoder struct {
baseName string
}
// NewSimpleTextEncoder returns a IdentityEncoder based on predefined encoding `baseName` and
// difference map `differences`.
// NewIdentityTextEncoder returns a new IdentityEncoder based on predefined
// encoding `baseName` and difference map `differences`.
func NewIdentityTextEncoder(baseName string) IdentityEncoder {
return IdentityEncoder{baseName}
}

View File

@ -38,14 +38,14 @@ func NewTrueTypeFontEncoder(runeToGlyphIndexMap map[uint16]uint16) TrueTypeFontE
// ttEncoderNumEntries is the maximum number of encoding entries shown in SimpleEncoder.String()
const ttEncoderNumEntries = 1000
// String returns a string that describes `se`.
func (se TrueTypeFontEncoder) String() string {
// String returns a string that describes `enc`.
func (enc TrueTypeFontEncoder) String() string {
parts := []string{
fmt.Sprintf("%d entries", len(se.runeToGlyphIndexMap)),
fmt.Sprintf("%d entries", len(enc.runeToGlyphIndexMap)),
}
codes := []int{}
for c := range se.runeToGlyphIndexMap {
for c := range enc.runeToGlyphIndexMap {
codes = append(codes, int(c))
}
sort.Ints(codes)
@ -57,7 +57,7 @@ func (se TrueTypeFontEncoder) String() string {
for i := 0; i < numCodes; i++ {
c := codes[i]
parts = append(parts, fmt.Sprintf("%d=0x%02x: %q",
c, c, se.runeToGlyphIndexMap[uint16(c)]))
c, c, enc.runeToGlyphIndexMap[uint16(c)]))
}
return fmt.Sprintf("TRUETYPE_ENCODER{%s}", strings.Join(parts, ", "))
}