#how to use a custom local font for the entire application

5 messages · Page 1 of 1 (latest)

empty lance
#

i have a local font that have 5 types (thing, light, regular, bold. dark)
each one is on a different woff2 file, i want to make my app to use the regular font always and also be able to use any other variation if i wanted to
can someone tell me how i can do that?

tulip agate
severe cargo
#

Then you can just point to the woff2 files right in your Nuxt config - something like this:

export default defineNuxtConfig({
  modules: ['@nuxt/fonts'],
  fonts: {
    families: [            
      { name: 'Bold Font', src: 'url(https://example.com/font.woff2)', weight: 'bold' },
    ]
  }
})
#

Or maybe even just use the local provider and point it to the fonts in your /public directory. Sounds like it will pick it up automatically: https://fonts.nuxt.com/get-started/providers#local

Nuxt Fonts

Font providers are designed to be pluggable and extensible, so no matter your setup you should be able to use an existing provider or write your own.