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.
1 2 3 4 5 |
- 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
1 2 3 4 5 6 7 8 |
.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
1 2 3 4 5 |
- 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.
If you want get query string params in controller file,...
Create di.xml and add the below code Magemonkey/Redirect/etc/frontend/di.xml [crayon-62838adc5a067889875719/] Create...
You can try below code to change local date to...
Step 1: First you need to add registration.php file in...
Step1 : Override message.js in current theme file on the...