From 81625020133f60c511ebf9222d02bf9e3292c620 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Thu, 4 Aug 2022 20:27:36 -0400 Subject: [PATCH] Add font.Family to local fonts Signed-off-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> --- finder.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/finder.go b/finder.go index 757d0e5..4b67021 100644 --- a/finder.go +++ b/finder.go @@ -62,7 +62,9 @@ func NewFinder(opts *FinderOpts) *Finder { // Attempt to identify fonts by filename. matches := fontRegistry.matchFontsByFilename(filename) if len(matches) == 0 { - matches = append(matches, &Font{Filename: filename}) + basename := filepath.Base(filename) + family := cleanQuery(strings.TrimSuffix(basename, filepath.Ext(basename))) + matches = append(matches, &Font{Family: family, Filename: filename}) } fonts = append(fonts, matches...)