We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    If you have faced below font related error in browser console,

    downloadable font: rejected by sanitizer (font-family: “Sofia Pro Regular” style:normal weight:400 stretch:100 src index:0) source: ../../../../../../en_US/fonts/SofiaProRegular.woff2 in magento 2

    Then follow given step-by-step guide to solve the error.

    Step 1: First check used fonts related ttf, woff and woff2 files. It must be available in the font folder with the same name.

    E.g.

    - app/design/frontend/Magemonkey/YourTheme/web/fonts/SofiaProRegular.ttf
    
    - app/design/frontend/Magemonkey/YourTheme/web/fonts/SofiaProRegular.woff
    
    - app/design/frontend/Magemonkey/YourTheme/web/fonts/SofiaProRegular.woff2

     

    Step 2 : Open below file

    app/design/frontend/Magemonkey/YourTheme/web/css/source/_typography.less

    Step 3 : Add below mention line under font path in _typoraphy.less

    E.g. @font-format: ‘woff’,

    See below code after adding above mention line and it should look like below

    .lib-font-face(
        @family-name: 'Sofia Pro Regular',
        @font-path: '@{baseDir}fonts/SofiaProRegular',
        @font-format: 'woff',                             // Add this line for remove above font related error
        @font-weight: 400,
        @font-style: normal,
        @font-display:swap
    );

     

    Step 4: After placing the above code, please run the below-mentioned commands

    - php bin/magento setup:upgrade
    
    - php bin/magento setup:static-content:deploy -f
    
    - php bin/magento cache:clean

    That’s it…

    Now refresh your site and check the console for this font-related error. Your font error should be solved.

    Fill the below form if you need any Magento relate help/advise/consulting.

    With Only Agency that provides a 24/7 emergency support.

      Get a Free Quote