Skip to content

Font

Firefly supports custom font configuration using CDN fonts or local font files.

Config File

src/config/fontConfig.ts

Basic Configuration

PropertyTypeDefaultDescription
enablebooleanfalseEnable custom fonts
preloadbooleantruePreload font files
selectedstring | string[]["misans-regular"]Selected font ID(s)
fallbackstring[]["system-ui", ...]Global font fallback list

Font Item Properties

PropertyTypeRequiredDescription
idstringYesUnique font identifier
namestringYesDisplay name
srcstringYesFont file path or URL
familystringYesCSS font-family name
weightstring | numberNoFont weight
stylestringNoFont style: "normal", "italic", "oblique"
displaystringNofont-display: "auto", "block", "swap", "fallback", "optional"

Built-in Fonts

IDNameSource
systemSystem FontBuilt-in
zen-maru-gothicZen Maru GothicGoogle Fonts
interInterGoogle Fonts
misans-normalMiSans Normalunpkg CDN
misans-regularMiSans Regularunpkg CDN
misans-semiboldMiSans Semiboldunpkg CDN

Adding Custom Fonts

ts
fonts: {
  "my-font": {
    id: "my-font",
    name: "My Custom Font",
    src: "https://fonts.googleapis.com/css2?family=My+Font&display=swap",
    family: "My Font",
    display: "swap",
  },
},

Then add it to selected:

ts
selected: ["my-font"],

WARNING

  • CDN fonts are recommended as they support on-demand loading with good performance
  • Local font files require font subsetting, otherwise pages will load slowly
  • Font subsetting may cause dynamic content (comments, Bangumi, etc.) to display incorrectly