unplugin-fonts icon indicating copy to clipboard operation
unplugin-fonts copied to clipboard

Feature request: woff/woff2 support

Open Hextar opened this issue 3 years ago • 2 comments
trafficstars

If I get it right it's only possible to import .ttf.

Would be great to support other formats as well.

Hextar avatar May 04 '22 09:05 Hextar

Nah, woff/woff2 works, at least on local files. The issue I'm running into is that the rules generated are backwards:

TTF -> WOFF -> WOFF2 -> Local

When it really should be the other way around.

darkphoenixff4 avatar May 31 '22 03:05 darkphoenixff4

Nah, woff/woff2 works, at least on local files. The issue I'm running into is that the rules generated are backwards:

TTF -> WOFF -> WOFF2 -> Local

When it really should be the other way around.

I am not sure if this is the right way to do it, but src can also be an array. So it is possible to set the order. But I can't figure out how to put the local as first.

ViteFonts({
      custom: {
        display: 'swap',
        families: [
          {
            name: 'Roboto',
            src: ['./src/fonts/roboto*woff2', './src/fonts/roboto*woff', './src/fonts/roboto*ttf'],
            local: 'Roboto',
          }
        ],
      },
    })

interactivespace avatar Jun 01 '22 07:06 interactivespace