Search code examples
cssgoogle-chromewebfonts

Same browser. Same windows version. Same styles. Different font rendering


One of our clients says the fonts on his website changed. He offered up a screenshot between Wayback and the current site as proof. Font comparison

The differences are subtle, but there appears to be a difference in height and weight.

We have spent hours comparing the styles between the two versions using BrowserStack / Windows 10 / Chrome 56. Even using Chrome's comprehensive style view (Computed -> Show All) we can find zero differences.

Everything is exactly the same. Here are our test URLs:

To see the difference, scroll down until the sticky header is activated.

Are we missing something obvious? Do we need to quit our jobs and go into sales?


Solution

  • Cached font is .ttf and live version is .woff2, maybe that's the difference? I just suppose their bot doesn't support .woff2 so google served them with .ttf, and now you see archived .ttf version of the font even though live version serves you with .woff2 one.

    The cached font is:

    /*
         FILE ARCHIVED ON 3:34:20 Feb 1, 2017 AND RETRIEVED FROM THE
         INTERNET ARCHIVE ON 22:23:03 Feb 14, 2017.
         JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
    
         ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
         SECTION 108(a)(3)).
    */
    @font-face {
      font-family: 'Montserrat';
      font-style: normal;
      font-weight: 400;
      src: local('Montserrat-Regular'), url(/web/20170201033420/http://fonts.gstatic.com/s/montserrat/v9/zhcz-_WihjSQC0oHJ9TCYC3USBnSvpkopQaUR-2r7iU.ttf) format('truetype');
    }
    @font-face {
      font-family: 'Montserrat';
      font-style: normal;
      font-weight: 700;
      src: local('Montserrat-Bold'), url(/web/20170201033420/http://fonts.gstatic.com/s/montserrat/v9/IQHow_FEYlDC4Gzy_m8fcvEr6Hm6RMS0v1dtXsGir4g.ttf) format('truetype');
    }
    

    Meanwhile the live website's font is:

    /* vietnamese */
    @font-face {
      font-family: 'Montserrat';
      font-style: normal;
      font-weight: 400;
      src: local('Montserrat Regular'), local('Montserrat-Regular'), url(http://fonts.gstatic.com/s/montserrat/v10/SKK6Nusyv8QPNMtI4j9J2yEAvth_LlrfE80CYdSH47w.woff2) format('woff2');
      unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB;
    }
    /* latin-ext */
    @font-face {
      font-family: 'Montserrat';
      font-style: normal;
      font-weight: 400;
      src: local('Montserrat Regular'), local('Montserrat-Regular'), url(http://fonts.gstatic.com/s/montserrat/v10/gFXtEMCp1m_YzxsBpKl68iEAvth_LlrfE80CYdSH47w.woff2) format('woff2');
      unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
    }
    /* latin */
    @font-face {
      font-family: 'Montserrat';
      font-style: normal;
      font-weight: 400;
      src: local('Montserrat Regular'), local('Montserrat-Regular'), url(http://fonts.gstatic.com/s/montserrat/v10/zhcz-_WihjSQC0oHJ9TCYPk_vArhqVIZ0nv9q090hN8.woff2) format('woff2');
      unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
    }
    /* vietnamese */
    @font-face {
      font-family: 'Montserrat';
      font-style: normal;
      font-weight: 700;
      src: local('Montserrat Bold'), local('Montserrat-Bold'), url(http://fonts.gstatic.com/s/montserrat/v10/IQHow_FEYlDC4Gzy_m8fcjh33M2A-6X0bdu871ruAGs.woff2) format('woff2');
      unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB;
    }
    /* latin-ext */
    @font-face {
      font-family: 'Montserrat';
      font-style: normal;
      font-weight: 700;
      src: local('Montserrat Bold'), local('Montserrat-Bold'), url(http://fonts.gstatic.com/s/montserrat/v10/IQHow_FEYlDC4Gzy_m8fchHJTnCUrjaAm2S9z52xC3Y.woff2) format('woff2');
      unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
    }
    /* latin */
    @font-face {
      font-family: 'Montserrat';
      font-style: normal;
      font-weight: 700;
      src: local('Montserrat Bold'), local('Montserrat-Bold'), url(http://fonts.gstatic.com/s/montserrat/v10/IQHow_FEYlDC4Gzy_m8fcoWiMMZ7xLd792ULpGE4W_Y.woff2) format('woff2');
      unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
    }
    

    UPD: The difference is in versions, as you can see from the linked .ttf, the link contains "v9", while .woff2 is "v10". If you compare "v10" .ttf with "v10" .woff2 they will render identically the same.

    If you were in love with previous version of the font, you can set the @font-face via css and hardcode the links to v9 fonts instead:

    @font-face {
      font-family: 'Montserrat';
      font-weight: 400;
      font-style: normal;
      src: url('http://fonts.gstatic.com/s/montserrat/v9/zhcz-_WihjSQC0oHJ9TCYFQlYEbsez9cZjKsNMjLOwM.eot');
      src: url('http://fonts.gstatic.com/s/montserrat/v9/zhcz-_WihjSQC0oHJ9TCYFQlYEbsez9cZjKsNMjLOwM.eot?#iefix') format('embedded-opentype'),
           local('Montserrat Regular'),
           local('Montserrat-regular'),
           url('http://fonts.gstatic.com/s/montserrat/v9/zhcz-_WihjSQC0oHJ9TCYAzyDMXhdD8sAj6OAJTFsBI.woff2') format('woff2'),
           url('http://fonts.gstatic.com/s/montserrat/v9/zhcz-_WihjSQC0oHJ9TCYL3hpw3pgy2gAi-Ip7WPMi0.woff') format('woff'),
           url('http://fonts.gstatic.com/s/montserrat/v9/zhcz-_WihjSQC0oHJ9TCYC3USBnSvpkopQaUR-2r7iU.ttf') format('truetype'),
       url('http://fonts.gstatic.com/l/font?kit=zhcz-_WihjSQC0oHJ9TCYKWUboTb-jS2tyCOQMtm97g&skey=7bc19f711c0de8f&v=v9#Montserrat') format('svg');
    }