Update d2renderers/d2fonts/d2fonts.go

Co-authored-by: gavin-ts <85081687+gavin-ts@users.noreply.github.com>
This commit is contained in:
Bernard Xie 2023-03-24 17:31:58 -07:00 committed by GitHub
parent 6f74209a78
commit 194fb58027
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -222,8 +222,7 @@ func AddFont(fontLoc string) (FontFamily, error) {
if fontLoc == "" {
return "", nil
}
splitFont := strings.Split(fontLoc, "/")
fontFileName := splitFont[len(splitFont)-1]
fontFileName := filepath.Base(fontLoc)
ext := filepath.Ext(fontFileName)
if ext != ".ttf" {