Don't import core anonymously

This commit is contained in:
Peter Williams 2018-07-15 17:29:27 +10:00
parent 3310b040db
commit e5783d58fb
3 changed files with 11 additions and 11 deletions

View File

@ -11,7 +11,7 @@ import (
"github.com/unidoc/unidoc/common"
"github.com/unidoc/unidoc/common/license"
. "github.com/unidoc/unidoc/pdf/core"
"github.com/unidoc/unidoc/pdf/core"
"github.com/unidoc/unidoc/pdf/model"
)
@ -36,7 +36,7 @@ func procBuf(buf *bytes.Buffer) {
}
// toFloatList returns `objs` as 2 floats, if that's what it is, or an error if it isn't
func toFloatXY(objs []PdfObject) (x, y float64, err error) {
func toFloatXY(objs []core.PdfObject) (x, y float64, err error) {
if len(objs) != 2 {
err = fmt.Errorf("Invalid number of params: %d", len(objs))
common.Log.Debug("toFloatXY: err=%v", err)

View File

@ -5,7 +5,7 @@ import (
"testing"
"github.com/unidoc/unidoc/common"
. "github.com/unidoc/unidoc/pdf/core"
"github.com/unidoc/unidoc/pdf/core"
"github.com/unidoc/unidoc/pdf/model"
"github.com/unidoc/unidoc/pdf/model/fonts"
)
@ -142,7 +142,7 @@ func TestCompositeFonts(t *testing.T) {
// the new PDF object is the same as the input object
func objFontObj(t *testing.T, fontDict string) error {
parser := NewParserFromString(fontDict)
parser := core.NewParserFromString(fontDict)
obj, err := parser.ParseDict()
if err != nil {
t.Errorf("objFontObj: Failed to parse dict obj. fontDict=%q err=%v", fontDict, err)
@ -155,11 +155,11 @@ func objFontObj(t *testing.T, fontDict string) error {
}
// Resolve all the indirect references in the font objects so we can compare their contents.
obj1 := FlattenObject(obj)
obj2 := FlattenObject(font.ToPdfObject())
obj1 := core.FlattenObject(obj)
obj2 := core.FlattenObject(font.ToPdfObject())
// Check that the reconstituted font is the same as the original.
if !EqualObjects(obj1, obj2) {
if !core.EqualObjects(obj1, obj2) {
t.Errorf("Different objects.\nobj1=%s\nobj2=%s\nfont=%s", obj1, obj2, font)
return errors.New("different objects")
}

View File

@ -10,7 +10,7 @@ import (
"fmt"
"github.com/unidoc/unidoc/common"
. "github.com/unidoc/unidoc/pdf/core"
"github.com/unidoc/unidoc/pdf/core"
)
// IdentityEncoder represents an 2-byte identity encoding
@ -113,9 +113,9 @@ func (enc IdentityEncoder) GlyphToRune(glyph string) (rune, bool) {
}
// ToPdfObject returns a nil as it is not truly a PDF object and should not be attempted to store in file.
func (enc IdentityEncoder) ToPdfObject() PdfObject {
func (enc IdentityEncoder) ToPdfObject() core.PdfObject {
if enc.baseName != "" {
return MakeName(enc.baseName)
return core.MakeName(enc.baseName)
}
return MakeNull()
return core.MakeNull()
}