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

Subsets parameter and download

Open galaczi opened this issue 4 years ago • 8 comments

Due to the recent changes in Chrome's cache partitioning, I wanted to use the download mode.

My config: buildModules: [ [ "@nuxtjs/google-fonts", { families: { Sarabun: { wght: [400, 700] } }, subsets: ['latin'], download: true } ] ]

But the result is unexpected:

image

Am I missing something? Tried deleting both folders to redownload. Same result.

galaczi avatar Dec 06 '20 17:12 galaczi

Same here! With the following config just the first font (Montserrat) gets downloaded but including all subsets instead of just latin: googleFonts: { families: { Montserrat: [400, 700], Roboto: 400, Sanchez: true }, subsets: 'latin', display: 'swap', download: true }

derteaser avatar Dec 09 '20 10:12 derteaser

Hi @galaczi, @derteaser

Google fonts uses your browser based to know which fonts it will download.

This module uses under the hood the google-fonts-helper which defines the default user-agent. https://github.com/ricardogobbosouza/google-fonts-helper/blob/master/src/index.ts#L104

We need to document the headers option in the download area, but you can customize it as you see fit.

ricardogobbosouza avatar Dec 16 '20 19:12 ricardogobbosouza

We need to document the headers option in the download area, but you can customize it as you see fit.

Thanks for the input, how one could modify the headers option to only take latin or other subsets ?

SkullMasher avatar May 06 '21 12:05 SkullMasher

Subsets and wght are not working with download: true:

googleFonts: {
    display: 'swap',
    download: true,
    families: {
      Roboto:  {
        wght: [300, 700]
      }
    },
    subsets: 'latin'
  },

I am getting:

@font-face {
                font-family: Roboto;
                font-style: normal;
                font-weight: 400;
                font-display: swap;
                src: url(/_nuxt/fonts/Roboto-400-cyrillic-ext1.493afe7.woff2) format("woff2");
                unicode-range: U+0460-052f, U+1c80-1c88, U+20b4, U+2de0-2dff, U+a640-a69f, U+fe2e-fe2f;
            }
            @font-face {
                font-family: Roboto;
                font-style: normal;
                font-weight: 400;
                font-display: swap;
                src: url(/_nuxt/fonts/Roboto-400-cyrillic2.5e49381.woff2) format("woff2");
                unicode-range: U+0400-045f, U+0490-0491, U+04b0-04b1, U+2116;
            }
            ...

retroriff avatar May 06 '21 14:05 retroriff

Same issue here, Haven't specified any subsets, Still downloading all subsets

SwapnilSoni1999 avatar Aug 28 '21 11:08 SwapnilSoni1999

Still happening.

andrevferreiraa avatar Mar 30 '22 19:03 andrevferreiraa

Soon I will release the new version of google-fonts-helper will fix this problem

It is worth remembering that when using subsets automatically or the module uses google fonts v1 which does not allow you to define some fonts weights

See https://developers.google.com/fonts/docs/getting_started https://developers.google.com/fonts/docs/css2

ricardogobbosouza avatar Mar 30 '22 20:03 ricardogobbosouza

Still happening. Also, if we can't use subsets with weights, that seems bad.

sh0ber avatar Jul 17 '22 10:07 sh0ber

Please try v3.0.0-1

ricardogobbosouza avatar Oct 25 '22 14:10 ricardogobbosouza

If the problem persists, please reopen

ricardogobbosouza avatar Oct 27 '22 11:10 ricardogobbosouza

@ricardogobbosouza this issue still occurs, even on the last version, subset + fw doesn't work at all

emirkoni avatar Dec 09 '22 14:12 emirkoni