Define your site’s typography with a fonts.json file. You can load fonts from Google Fonts or from local font files bundled with your project.
Place a fonts.json at your project root (the same folder where you execute npx doccupine). Choose one of the following configurations depending on the source of your fonts.
Use this when your font is hosted by Google Fonts.
{
"googleFont": {
"fontName": "Work_Sans",
"subsets": ["latin"],
"weight": "400"
}
}_.
Work_Sanslatin)."400").Use this when you want to ship your own font files. Upload your font files to the Next.js public directory, then reference them with relative paths.
{
"localFonts": {
"src": [
{
"path": "../public/font.woff",
"weight": "400",
"style": "normal"
},
{
"path": "../public/font.woff",
"weight": "400",
"style": "italic"
},
{
"path": "../public/font.woff",
"weight": "700",
"style": "normal"
},
{
"path": "../public/font.woff",
"weight": "700",
"style": "italic"
}
]
}
}If you have only one file, you can use:
{
"localFonts": "../public/font.woff"
}font.woff (and any additional weights/styles) in your Next.js public directory.../public/font.woff."400", "700")."normal" or "italic"..woff is broadly supported and recommended for the web.fonts.json in the project root alongside config.json and (optionally) theme.json.googleFont.fontName (capitalize, replace spaces with _).public directory.{
"googleFont": {
"fontName": "Work_Sans",
"subsets": ["latin"],
"weight": "400"
}
}{
"localFonts": {
"src": [
{ "path": "../public/font.woff", "weight": "400", "style": "normal" },
{ "path": "../public/font.woff", "weight": "400", "style": "italic" },
{ "path": "../public/font.woff", "weight": "700", "style": "normal" },
{ "path": "../public/font.woff", "weight": "700", "style": "italic" }
]
}
}