Let’s initiate a discussion!!
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.
[crayon-64217b2e0e1b8987662831/] Using above fucntion Images can be imported directly from...
Override view block using di.xml and add the below code...
You can check a list of called layout XML for...
Follow the below steps to install and set up PWA...
If you want to remove all leading zero's from order,...
Let our Magento expert connect to discuss your requirement.
We offer Magento
certified developers.
Our Magento clientele
is 500+.
We sign NDA for the
security of your projects.
We’ve performed 100+
Magento migration projects.
Free quotation
on your project.
Three months warranty on
code developed by us.