FontFamily. Don't take effect!!!
huizhang001 opened this issue · comments
func writeFile(buf []byte) error {
tmpPath := "./tmp"
err := os.MkdirAll(tmpPath, 0700)
if err != nil {
return err
}
file := filepath.Join(tmpPath, "chinese-line-chart.png")
err = ioutil.WriteFile(file, buf, 0600)
if err != nil {
return err
}
return nil
}
func main() {
buf, err := ioutil.ReadFile("./fonts/xx.TTF")
if err != nil {
panic(err)
}
err = charts.InstallFont("noto", buf)
if err != nil {
panic(err)
}
//font, _ := truetype.Parse(buf)
p, err := charts.TableOptionRender(charts.TableChartOption{
//Font: font,
FontFamily: "noto",
Header: []string{"名称", "年龄"},
Data: [][]string{{"张三", "18"}},
})
buf, err = p.Bytes()
if err != nil {
panic(err)
}
err = writeFile(buf)
if err != nil {
panic(err)
}
}
@huizhang001 下个版本修复,可以先使用以下方式解决:
font, _ := charts.GetFont("noto")
p, err := charts.TableOptionRender(charts.TableChartOption{
Font: font,
// FontFamily: "noto",
Header: []string{"名称", "年龄"},
Data: [][]string{{"张三", "18"}},
})
最新版本已修复
好,谢谢