canvas
                                
                                 canvas copied to clipboard
                                
                                    canvas copied to clipboard
                            
                            
                            
                        load font error: GSUB: lookupOrderOffset must be NULL
hi, I'm using this  into my project, I notice load some font file, return this error:
load font error: GSUB: lookupOrderOffset must be NULL,
here is my code:
import (
	"context"
	"errors"
	"fmt"
	"github.com/tdewolff/canvas"
	"testing"
)
func TestDrawFont(t *testing.T) {
	font_location := "fd48cf323a854ca389e08c546f34198f.otf"
	font_name := "Paralines"
	pathValue, err := drawTextPath1(context.TODO(), "T", font_location, font_name)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(fmt.Sprintf("<html><body><svg><path d=\"%s\" /></svg></body></html>", pathValue))
}
func drawTextPath1(ctx context.Context, nameText, fontRes, fontFam string) (pathStr string, err error) {
	fontFamily := canvas.NewFontFamily(fontFam)
	fmt.Println(ctx, "drawTextPath fontsPath:", fontRes)
	if err = fontFamily.LoadFontFile(fontRes, canvas.FontRegular); err != nil {
		fmt.Println(ctx, "load font error:", err)
		return "", errors.New("font not found")
	}
	face := fontFamily.Face(20, canvas.Black, canvas.FontRegular)
	path, _, err := face.ToPath(nameText)
	if err != nil {
		return pathStr, errors.New("CodeError")
	}
	//path = path.Transform(canvas.Identity.Translate(0.0, 0).Scale(1.0, -1.0).Translate(0.0, -10))
	svgPath := path.ToSVG()
	if len(svgPath) == 0 {
		return "", errors.New("text not render path")
	}
	return svgPath, nil
}
Could you please send me the font to check what's wrong? The lookupOrderOffset in the GSUB script table should be NULL according to the specification. I've attached a commit that omits the check, but perhaps another bug has led this check to fail.
Hi, this is the font file link, https://kilofolo-oss-test.oss-cn-shanghai.aliyuncs.com/fd48cf323a854ca389e08c546f34198f.otf
font name is Paralines font family is also Paralines.
Thank you, I can confirm. The offsets to the respective script list table was zero in GSUB, this is bad according to the specification but led the script table to reparse the same GSUB table and interpreted the major/minor version of it as 256 instead of NULL (hence the error). I've fixed this properly now!
Thank you very much!