diff --git a/freetype.go b/freetype.go index 9603586..f0e678f 100644 --- a/freetype.go +++ b/freetype.go @@ -6,15 +6,15 @@ // The freetype package provides a convenient API to draw text onto an image. // Use the freetype/raster and freetype/truetype packages for lower level // control over rasterization and TrueType parsing. -package freetype // import "github.com/golang/freetype" +package freetype import ( "errors" "image" "image/draw" - "github.com/golang/freetype/raster" - "github.com/golang/freetype/truetype" + "github.com/goki/freetype/raster" + "github.com/goki/freetype/truetype" "golang.org/x/image/font" "golang.org/x/image/math/fixed" ) diff --git a/raster/raster.go b/raster/raster.go index 7e6cd4e..995925e 100644 --- a/raster/raster.go +++ b/raster/raster.go @@ -13,7 +13,7 @@ // the Freetype "smooth" module, and the Anti-Grain Geometry library. A // description of the area/coverage algorithm is at // http://projects.tuxee.net/cl-vectors/section-the-cl-aa-algorithm -package raster // import "github.com/golang/freetype/raster" +package raster import ( "strconv" diff --git a/truetype/face.go b/truetype/face.go index 099006f..20611fa 100644 --- a/truetype/face.go +++ b/truetype/face.go @@ -9,7 +9,7 @@ import ( "image" "math" - "github.com/golang/freetype/raster" + "github.com/goki/freetype/raster" "golang.org/x/image/font" "golang.org/x/image/math/fixed" ) diff --git a/truetype/glyph.go b/truetype/glyph.go index 6157ad8..5bb236a 100644 --- a/truetype/glyph.go +++ b/truetype/glyph.go @@ -175,6 +175,9 @@ func (g *GlyphBuf) load(recursion uint32, i Index, useMyMetrics bool) (err error if recursion >= 32 { return UnsupportedError("excessive compound glyph recursion") } + if g.font.loca == nil { + return UnsupportedError("no glyph location data") + } // Find the relevant slice of g.font.glyf. var g0, g1 uint32 if g.font.locaOffsetFormat == locaOffsetFormatShort { diff --git a/truetype/truetype.go b/truetype/truetype.go index 7270bbf..703fee8 100644 --- a/truetype/truetype.go +++ b/truetype/truetype.go @@ -15,7 +15,7 @@ // // To measure a TrueType font in ideal FUnit space, use scale equal to // font.FUnitsPerEm(). -package truetype // import "github.com/golang/freetype/truetype" +package truetype import ( "fmt" @@ -312,9 +312,10 @@ func (f *Font) parseKern() error { // Since we expect that almost all fonts aim to be Windows-compatible, we only parse the "older" format, // just like the C Freetype implementation. if len(f.kern) == 0 { - if f.nKern != 0 { - return FormatError("bad kern table length") - } + // if f.nKern != 0 { + // return FormatError("bad kern table length") + // } + f.nKern = 0 // just reset and move on return nil } if len(f.kern) < 18 { @@ -346,7 +347,9 @@ func (f *Font) parseKern() error { } f.nKern, offset = int(u16(f.kern, offset)), offset+2 if 6*f.nKern != length-14 { - return FormatError("bad kern table length") + f.nKern = 0 + return nil + // return FormatError("bad kern table length") } return nil }