Giter Site home page Giter Site logo

Comments (3)

iamakulov avatar iamakulov commented on September 24, 2024

One easy (but maybe not good enough?) workaround Google Fonts can take is to include the full font as the very first @font-face:

/* full font */
@font-face {
  font-family: 'Inter Tight';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/intertight/v7/NGSnv5HMAFg6IuGlBNMjxJEL2VmU3NS7Z2mj6AiqWSRToK8EPg.woff2) format('woff2');
  /* Note: no unicode-range */
}
/* cyrillic-ext */
@font-face {
  font-family: 'Inter Tight';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/intertight/v7/NGSyv5HMAFg6IuGlBNMjxLsCwadkREW-emmbxg.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: 'Inter Tight';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/intertight/v7/NGSyv5HMAFg6IuGlBNMjxLsCwa5kREW-emmbxg.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* ... */

Per the spec, the later @font-faces take the precedence over the earlier ones. So in this situation, the full font will only be downloaded if the page uses glyphs not present in the subsetted @font-faces.

from fonts.

emmamarichal avatar emmamarichal commented on September 24, 2024

@rsheeter, do you have an explanation?

from fonts.

rsheeter avatar rsheeter commented on September 24, 2024

This, while suboptimal, is by design.

For context,

Adding a "whole font" final face with no unicode-range results in an absurdly high volume of downloads to fetch characters the font doesn't support, often downloading several unicode-range faces plus a duplicative and unused whole font.

Generating a subsetting scheme unique to the family would fix this but we have not currently implemented that.

https://www.w3.org/TR/IFT/ is meant to fix this once and for all. We chose to deprioritize improving the existing mechanism to focus on that. In retrospect our estimates for how fast we could ship IFT may have been optimistic.

from fonts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.