{"record":{"id":"7b2055891af18da9","repo":"JanDeDobbeleer/oh-my-posh","slug":"not-a-font-v","errorCode":null,"errorMessage":"not a font: %v","messagePattern":"not a font: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/cli/font/font.go","lineNumber":68,"sourceCode":"\tif font == nil {\n\t\treturn false\n\t}\n\n\treturn f.Name == font.Name\n}\n\nfunc (f *Font) Resolve() (*Font, bool) {\n\treturn nil, false\n}\n\nvar fontExtensions = map[string]bool{\n\t\".otf\": true,\n\t\".ttf\": true,\n}\n\nfunc newFont(fileName string, data []byte) (*Font, error) {\n\tif _, ok := fontExtensions[strings.ToLower(path.Ext(fileName))]; !ok {\n\t\treturn nil, fmt.Errorf(\"not a font: %v\", fileName)\n\t}\n\n\tfont := &Font{\n\t\tFileName: fileName,\n\t\tMetadata: make(map[nameID]string),\n\t\tData:     data,\n\t}\n\n\ttable, ok, err := readNameTable(font.Data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"font %v has no name table\", fileName)\n\t}\n\n\tentries, err := parseNameTable(table)","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/cli/font/font.go#L50-L86","documentation":"`newFont` parses a candidate file extracted from a downloaded font ZIP into a `Font`. oh-my-posh only treats `.ttf` and `.otf` files (case-insensitive) as fonts; any other extension inside the archive triggers this error naming the offending file. It filters out TXT/MD/license files commonly bundled in font zips.","triggerScenarios":"`newFont(fileName, data)` called from `InstallZIP` when iterating ZIP entries whose `path.Ext` is not `.ttf`/`.otf` — e.g. `OFL.txt`, `readme.md`, `FiraCode-Bold.ttf.bak`, or files with uppercase extensions are fine (lowered) but e.g. `.ttc`/`.woff2` are not.","commonSituations":"Custom font zip containing documentation/LICENSE files (handled — they're skipped, error surfaces only if you call newFont directly or the expected font is missing); font packaged as .ttc (TrueType Collection) which is unsupported; mistyped extension like .ttff.","solutions":["Ensure the ZIP contains actual .ttf or .otf files — convert .ttc/.woff2 with fonttools (`fonttools ttLib.woff2 decompress` / split collections) first","Check the filename extension is exactly .ttf or .otf (not .txt, .md, .bak)","Re-download the font archive if it appears truncated/renamed","If packaging your own zip, only include font binaries at the archive root"],"exampleFix":"// before: installing a file saved without extension\nnewFont(\"JetBrainsMono-Regular\", data) // \"not a font\"\n// after\nnewFont(\"JetBrainsMono-Regular.ttf\", data)","handlingStrategy":"validation","validationCode":"ext := strings.ToLower(filepath.Ext(name))\nif ext != \".ttf\" && ext != \".otf\" {\n\treturn fmt.Errorf(\"skipping %s: only .ttf/.otf supported\", name)\n}","typeGuard":"func isFontFile(name string) bool {\n\tswitch strings.ToLower(path.Ext(name)) {\n\tcase \".ttf\", \".otf\":\n\t\treturn true\n\t}\n\treturn false\n}","tryCatchPattern":null,"preventionTips":["Only zip .ttf/.otf files when building custom font archives","Convert .ttc/.woff2 to .ttf/.otf before installing","Don't rename font files manually (trailing extensions like .bak break matching)"],"tags":["fonts","zip","validation"],"backgroundTag":"unsupported-file-extension","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}