• Resolved pracko

    (@pracko)


    I tried using the ‘Attempt to host fonts locally’ option while adding new fonts but this feature did not work using the Spectra One (FSE) theme.

    What conditions need to be in place in order for this to work? Do I need to make a specific folder writeable?

    The only way I could get the new fonts to load was by manually adding a link to the fonts inside <head>, but this link relies on Google to serve the fonts.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Oliver Campion

    (@domainsupport)

    If your /wp-content/uploads/ folder is writable then it should work.

    Can you let me know what plugins you have active? What font(s) are you trying to add? Also, please confirm that this is the theme you are using so we can try to replicate the issue.

    Thank you,

    Oliver

    Thread Starter pracko

    (@pracko)

    Hi Oliver,

    I got it working. I think the issue had to do with me attempting to add too many font styles. When I just added the regular (400) weights for PT Sans and Nunito, it worked fine. But I haven’t confirmed this with further testing.

    Yes, that’s the Spectra One theme I was referring to.

    Thread Starter pracko

    (@pracko)

    Just as a follow-up, I notice the following in my head tag now:

    /* cyrillic-ext */
    @font-face {
      font-family: 'Nunito';
      font-style: normal;
      font-weight: 400;
      font-display: swap;
      src: url(/wp-content/uploads/gstatic/XRXI3I6Li01BKofiOc5wtlZ2di8HDLshdTk3j77e.woff2) format('woff2');
      unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
    }
    /* cyrillic */
    @font-face {
      font-family: 'Nunito';
      font-style: normal;
      font-weight: 400;
      font-display: swap;
      src: url(/wp-content/uploads/gstatic/XRXI3I6Li01BKofiOc5wtlZ2di8HDLshdTA3j77e.woff2) format('woff2');
      unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
    }
    /* vietnamese */
    @font-face {
      font-family: 'Nunito';
      font-style: normal;
      font-weight: 400;
      font-display: swap;
      src: url(/wp-content/uploads/gstatic/XRXI3I6Li01BKofiOc5wtlZ2di8HDLshdTs3j77e.woff2) format('woff2');
      unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
    }
    /* latin-ext */
    @font-face {
      font-family: 'Nunito';
      font-style: normal;
      font-weight: 400;
      font-display: swap;
      src: url(/wp-content/uploads/gstatic/XRXI3I6Li01BKofiOc5wtlZ2di8HDLshdTo3j77e.woff2) format('woff2');
      unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
    }
    /* latin */
    @font-face {
      font-family: 'Nunito';
      font-style: normal;
      font-weight: 400;
      font-display: swap;
      src: url(/wp-content/uploads/gstatic/XRXI3I6Li01BKofiOc5wtlZ2di8HDLshdTQ3jw.woff2) format('woff2');
      unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
    }
    /* cyrillic-ext */
    @font-face {
      font-family: 'PT Sans';
      font-style: normal;
      font-weight: 400;
      font-display: swap;
      src: url(/wp-content/uploads/gstatic/jizaRExUiTo99u79D0-ExdGM.woff2) format('woff2');
      unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
    }
    /* cyrillic */
    @font-face {
      font-family: 'PT Sans';
      font-style: normal;
      font-weight: 400;
      font-display: swap;
      src: url(/wp-content/uploads/gstatic/jizaRExUiTo99u79D0aExdGM.woff2) format('woff2');
      unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
    }
    /* latin-ext */
    @font-face {
      font-family: 'PT Sans';
      font-style: normal;
      font-weight: 400;
      font-display: swap;
      src: url(/wp-content/uploads/gstatic/jizaRExUiTo99u79D0yExdGM.woff2) format('woff2');
      unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
    }
    /* latin */
    @font-face {
      font-family: 'PT Sans';
      font-style: normal;
      font-weight: 400;
      font-display: swap;
      src: url(/wp-content/uploads/gstatic/jizaRExUiTo99u79D0KExQ.woff2) format('woff2');
      unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
    }

    Are the cyrillic, cyrillic-ext, and vietnamese versions necessary? Is there any way to remove them to reduce overhead?

    Plugin Author Oliver Campion

    (@domainsupport)

    Oh great!

    With regards to the Cyrillic etc files … I think these are only actually loaded if they’re needed. Correct me if I’m wrong but inspecting one of our sites that also has these, in Safari, if you go to “Sources” tab in the Inspector then make sure “By type” is selected and expand “Fonts”, the only files that have been loaded are ones that are in use … ?

    I mean I could add an additional filtering system to allow you to prevent these from being shown but I don’t think it’s necessary.

    Thread Starter pracko

    (@pracko)

    Upon further research, I found this:

    https://github.com/google/fonts/issues/68

    Seems that its the expected behavior, so no worries.

    Plugin Author Oliver Campion

    (@domainsupport)

    Yes. So Google checks out the users browser from its user-agent and decides what format font files to use accordingly. Obviously the plug-in cannot do this for all users when attempting to cache the font files so it uses the current user’s (admin’s) browser user-agent instead. Unless you’re using a very old browser or Internet Explorer to access your WordPress admin then Google should respond by sending links to the relevant WOFF2 files which are highly supported these days.

    I’ll mark this one as “resolved” now.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Attempt to host fonts locally’ is closed to new replies.