text/v2: refactoring

This commit is contained in:
Hajime Hoshi 2023-11-25 22:59:01 +09:00
parent f34f93a117
commit 415b9c382f

View File

@ -104,13 +104,13 @@ func NewGoTextFaceSource(source io.ReadSeeker) (*GoTextFaceSource, error) {
return nil, err return nil, err
} }
ft, err := ofont.NewFont(l) f, err := ofont.NewFont(l)
if err != nil { if err != nil {
return nil, err return nil, err
} }
s := &GoTextFaceSource{ s := &GoTextFaceSource{
f: &ofont.Face{Font: ft}, f: &ofont.Face{Font: f},
} }
s.addr = s s.addr = s
s.metadata = metadataFromLoader(l) s.metadata = metadataFromLoader(l)
@ -132,12 +132,12 @@ func NewGoTextFaceSourcesFromCollection(source io.ReadSeeker) ([]*GoTextFaceSour
sources := make([]*GoTextFaceSource, len(ls)) sources := make([]*GoTextFaceSource, len(ls))
for i, l := range ls { for i, l := range ls {
ft, err := ofont.NewFont(l) f, err := ofont.NewFont(l)
if err != nil { if err != nil {
return nil, err return nil, err
} }
s := &GoTextFaceSource{ s := &GoTextFaceSource{
f: &ofont.Face{Font: ft}, f: &ofont.Face{Font: f},
} }
s.addr = s s.addr = s
s.metadata = metadataFromLoader(l) s.metadata = metadataFromLoader(l)