cssfontsshopifyfont-facegoogle-fonts

Failed to decode downloaded font, but using correct CSS Font Face


I am using the following code to import the google Font "Syncopate" into my shopify site:

@font-face {
    font-family: 'Syncopate';
    font-weight: 400;
    font-style: normal;
    src: url('//cdn.shopify.com/s/files/1/0633/5778/0153/t/2/assets/Syncopate-Regular.eot'); /* IE9 Compat Modes */
    src: url('//cdn.shopify.com/s/files/1/0633/5778/0153/t/2/assets/Syncopate-Regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
         url('//cdn.shopify.com/s/files/1/0633/5778/0153/t/2/assets/Syncopate-Regular.woff2') format('woff2'), /* Super Modern Browsers */
         url('//cdn.shopify.com/s/files/1/0633/5778/0153/t/2/assets/Syncopate-Regular.woff') format('woff'), /* Pretty Modern Browsers */
         url('//cdn.shopify.com/s/files/1/0633/5778/0153/t/2/assets/Syncopate-Regular.ttf')  format('truetype'), /* Safari, Android, iOS */
         url('//cdn.shopify.com/s/files/1/0633/5778/0153/t/2/assets/Syncopate-Regular.svg#Syncopate') format('svg'); /* Legacy iOS */
  } 

I downloaded the .tff file from google fonts and created the font-face with transformer.org. In the console of greenjet.at I now get the following errors:

When implementing it with the google font link it works perfectly:

<link rel="stylesheet"
          href="https://fonts.googleapis.com/css?family=Syncopate">

But it is necessary due to privacy issues with google to load the font locally. What is the error here? Is the shopify asset file uploader maybe using ASCII instead of the binary file transfer causing this error?


Solution

  • OTS parsing errors indicate, your font files are not valid

    The aforementioned font file is definitely corrupt/not valid

    On the other hand:

    Your @font-face rules is fine.

    Font file corruption

    Instead of converting the master truetype files, try to get all font-files via google web font helper..

    Then try to upload/replace the font files.
    Debugging: You should be able to download the new truetype font and doubleclick it in your Desktop environment (win, MacOs, Linux).
    If your OS still bugging you about an invalid format - there's something wrong with the shopify uploader.

    Contact shopify support

    Maybe there's a bug in the file uploader (e.g. converting encodings).