siyuan-note/siyuan · error
font family is empty
Error message
font family is empty
What it means
Returned by parseFontInfo (font.go:270) when the selected family name is empty or begins with '.'. selectFontName failed to find a usable entry for NamePreferredFamily (16) or NameFontFamily (1) in the font's name table. Names beginning with '.' (Apple's reserved prefix) are also rejected.
Source
Thrown at kernel/util/font.go:270
switch {
case strings.Contains(s, "thin"):
weight = 100
case strings.Contains(s, "light"):
weight = 300
case strings.Contains(s, "medium"):
weight = 500
case strings.Contains(s, "semibold") || strings.Contains(s, "demi"):
weight = 600
case strings.Contains(s, "bold"):
weight = 700
case strings.Contains(s, "black") || strings.Contains(s, "heavy"):
weight = 900
}
}
}
if family == "" || strings.HasPrefix(family, ".") {
return nil, errors.New("font family is empty")
}
displayName := family
if subfamily != "" && !strings.EqualFold(subfamily, "Regular") {
displayName = family + " " + subfamily
}
return &Font{
Family: family,
Weight: weight,
DisplayName: displayName,
}, nil
}
func selectFontName(entries []*sfnt.NameEntry, nameIDs ...sfnt.NameID) string {
for _, nameID := range nameIDs {
var selected string
selectedScore := 4View on GitHub (pinned to 251596fc0d)
Solutions
- Replace the font with one that has a valid Family name (nameID 1 or 16).
- Re-add the name table with fonttools: 'ttx' dump, edit, recompile.
- Skip system/private fonts that legitimately use '.'-prefixed names rather than installing them as custom fonts.
Defensive patterns
Strategy: validation
Prevention
- Reject fonts with no Family name (nameID 1/16) at the upload boundary using fonttools.
- Skip '.'-prefixed system fonts when offering them as custom fonts.
When it happens
Trigger: parseFontInfo is called (via parseCustomFontFile, or directly when scanning system fonts) on a font whose name table contains no Family entry at all, or only entries whose value starts with '.'.
Common situations: A subsetted font with the name table stripped to reduce size; a system font exposing only private ('.'-prefixed) names; a corrupted name table where Family entries decode to empty strings.
Related errors
- font file is invalid
- only TTF and OTF font files are supported
- parse font metadata failed: %w
- font file is empty
- font file is too large
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/0710195c30d7cd67.
Report an issue: GitHub.