dont fail on font load error

This commit is contained in:
Bernard Xie 2023-03-24 15:28:12 -07:00
parent 811a630fb7
commit c01beb6089
No known key found for this signature in database
GPG key ID: 3C3E0036CE0F892C

View file

@ -282,9 +282,12 @@ func compile(ctx context.Context, ms *xmain.State, plugin d2plugin.Plugin, sketc
}
// load custom fonts before initializing ruler
fontFamily, err := d2fonts.AddFont(font)
if err != nil {
return nil, false, err
var fontFamily d2fonts.FontFamily
if !sketch {
fontFamily, err = d2fonts.AddFont(font)
if err != nil {
ms.Log.Error.Printf("failed to load font %v, rendering with default font.", font)
}
}
ruler, err := textmeasure.NewRuler()