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 := 4

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Replace the font with one that has a valid Family name (nameID 1 or 16).
  2. Re-add the name table with fonttools: 'ttx' dump, edit, recompile.
  3. Skip system/private fonts that legitimately use '.'-prefixed names rather than installing them as custom fonts.
Defensive patterns

Strategy: validation

Prevention

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


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/0710195c30d7cd67. Report an issue: GitHub.