mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-01 22:17:29 +08:00
Don't import core anonymously
This commit is contained in:
parent
3310b040db
commit
e5783d58fb
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/unidoc/unidoc/common"
|
"github.com/unidoc/unidoc/common"
|
||||||
"github.com/unidoc/unidoc/common/license"
|
"github.com/unidoc/unidoc/common/license"
|
||||||
. "github.com/unidoc/unidoc/pdf/core"
|
"github.com/unidoc/unidoc/pdf/core"
|
||||||
"github.com/unidoc/unidoc/pdf/model"
|
"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
|
// 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 {
|
if len(objs) != 2 {
|
||||||
err = fmt.Errorf("Invalid number of params: %d", len(objs))
|
err = fmt.Errorf("Invalid number of params: %d", len(objs))
|
||||||
common.Log.Debug("toFloatXY: err=%v", err)
|
common.Log.Debug("toFloatXY: err=%v", err)
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/unidoc/unidoc/common"
|
"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"
|
||||||
"github.com/unidoc/unidoc/pdf/model/fonts"
|
"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
|
// the new PDF object is the same as the input object
|
||||||
func objFontObj(t *testing.T, fontDict string) error {
|
func objFontObj(t *testing.T, fontDict string) error {
|
||||||
|
|
||||||
parser := NewParserFromString(fontDict)
|
parser := core.NewParserFromString(fontDict)
|
||||||
obj, err := parser.ParseDict()
|
obj, err := parser.ParseDict()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("objFontObj: Failed to parse dict obj. fontDict=%q err=%v", fontDict, err)
|
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.
|
// Resolve all the indirect references in the font objects so we can compare their contents.
|
||||||
obj1 := FlattenObject(obj)
|
obj1 := core.FlattenObject(obj)
|
||||||
obj2 := FlattenObject(font.ToPdfObject())
|
obj2 := core.FlattenObject(font.ToPdfObject())
|
||||||
|
|
||||||
// Check that the reconstituted font is the same as the original.
|
// 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)
|
t.Errorf("Different objects.\nobj1=%s\nobj2=%s\nfont=%s", obj1, obj2, font)
|
||||||
return errors.New("different objects")
|
return errors.New("different objects")
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/unidoc/unidoc/common"
|
"github.com/unidoc/unidoc/common"
|
||||||
. "github.com/unidoc/unidoc/pdf/core"
|
"github.com/unidoc/unidoc/pdf/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
// IdentityEncoder represents an 2-byte identity encoding
|
// 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.
|
// 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 != "" {
|
if enc.baseName != "" {
|
||||||
return MakeName(enc.baseName)
|
return core.MakeName(enc.baseName)
|
||||||
}
|
}
|
||||||
return MakeNull()
|
return core.MakeNull()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user