feat: support get and set default font

This commit is contained in:
vicanso 2022-11-12 20:01:36 +08:00
parent 2ed86a81d0
commit de4250f60b
6 changed files with 24 additions and 10 deletions

View file

@ -26,7 +26,6 @@ import (
"sort"
"github.com/golang/freetype/truetype"
"github.com/wcharczuk/go-chart/v2"
)
type ChartOption struct {
@ -270,7 +269,7 @@ func (o *ChartOption) fillDefault() {
o.font, _ = GetFont(o.FontFamily)
if o.font == nil {
o.font, _ = chart.GetDefaultFont()
o.font, _ = GetDefaultFont()
} else {
// 如果指定了字体,则设置主题的字体
t.SetFont(o.font)
@ -388,7 +387,7 @@ func TableOptionRender(opt TableChartOption) (*Painter, error) {
opt.Font, _ = GetFont(opt.FontFamily)
}
if opt.Font == nil {
opt.Font, _ = chart.GetDefaultFont()
opt.Font, _ = GetDefaultFont()
}
p, err := NewPainter(PainterOptions{