{"record":{"id":"0710195c30d7cd67","repo":"siyuan-note/siyuan","slug":"font-family-is-empty","errorCode":null,"errorMessage":"font family is empty","messagePattern":"font family is empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/util/font.go","lineNumber":270,"sourceCode":"\t\t\tswitch {\n\t\t\tcase strings.Contains(s, \"thin\"):\n\t\t\t\tweight = 100\n\t\t\tcase strings.Contains(s, \"light\"):\n\t\t\t\tweight = 300\n\t\t\tcase strings.Contains(s, \"medium\"):\n\t\t\t\tweight = 500\n\t\t\tcase strings.Contains(s, \"semibold\") || strings.Contains(s, \"demi\"):\n\t\t\t\tweight = 600\n\t\t\tcase strings.Contains(s, \"bold\"):\n\t\t\t\tweight = 700\n\t\t\tcase strings.Contains(s, \"black\") || strings.Contains(s, \"heavy\"):\n\t\t\t\tweight = 900\n\t\t\t}\n\t\t}\n\t}\n\n\tif family == \"\" || strings.HasPrefix(family, \".\") {\n\t\treturn nil, errors.New(\"font family is empty\")\n\t}\n\n\tdisplayName := family\n\tif subfamily != \"\" && !strings.EqualFold(subfamily, \"Regular\") {\n\t\tdisplayName = family + \" \" + subfamily\n\t}\n\n\treturn &Font{\n\t\tFamily:      family,\n\t\tWeight:      weight,\n\t\tDisplayName: displayName,\n\t}, nil\n}\n\nfunc selectFontName(entries []*sfnt.NameEntry, nameIDs ...sfnt.NameID) string {\n\tfor _, nameID := range nameIDs {\n\t\tvar selected string\n\t\tselectedScore := 4","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/util/font.go#L252-L288","documentation":"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.","triggerScenarios":"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 '.'.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["fonts","parsing","metadata","validation"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}