How can I remove default fonts ('Open Sans', 'Helvetica Neue' and Helvetica)? I just use Arial and sans-serif only..
Thanks
To remove the fonts you can override the _typography.less
file within your theme. I just did this as was using custom fonts and wanted to remove the unnecessary old fonts from being downloaded.
Move /vendor/magento/theme-frontend-blank/web/css/source/_typography.less
to /app/design/frontend/Vendor/Theme/web/css/source/_typography.less
and remove the font from the new _typography.less
file.
& when (@media-common = true) {
.lib-font-face(
@family-name: @font-family-name__base,
@font-path: '@{baseDir}fonts/opensans/light/opensans-300',
@font-weight: 300,
@font-style: normal
);
.lib-font-face(
@family-name: @font-family-name__base,
@font-path: '@{baseDir}fonts/opensans/regular/opensans-400',
@font-weight: 400,
@font-style: normal
);
.lib-font-face(
@family-name: @font-family-name__base,
@font-path: '@{baseDir}fonts/opensans/semibold/opensans-600',
@font-weight: 600,
@font-style: normal
);
.lib-font-face(
@family-name: @font-family-name__base,
@font-path: '@{baseDir}fonts/opensans/bold/opensans-700',
@font-weight: 700,
@font-style: normal
);
}
Remove any of the above if they are not required anymore.
Update (Preload Tags)
Magento includes certain resources as preload tags when fonts are added via XML. The Magento core adds these fonts to XML within default_head_blocks.xml for the blank theme for the above fonts. Warnings shows in Chrome saying about fonts downloaded that aren't used if this is the case.
So additionally add below to your default_head_blocks.xml
within your theme to make sure the files aren't still downloaded:
<head>
...
<remove src="fonts/opensans/regular/opensans-400.woff2"/>
<remove src="fonts/opensans/bold/opensans-700.woff2"/>
...
_typography.less
into my theme and commented the above code out and cleared magento cache. Open Sans no longer loads into the site. Thanks :)
Commented
Aug 6, 2019 at 17:28
You can add your css and change from it. refer below links
http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/using-fonts.html http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/xml-manage.html#layout_markup_css
hope it will helpful.
pub/static
when you delploy content the file will be overwritten.
Commented
Mar 9, 2016 at 6:39
In your Custom theme you need to override Blank or Luma's files.
Create a file "default_head_blocks.xml" in this path:
app/design/frontend//<Custom_Theme>/Magento_Theme/layout/override/theme/Magento/blank/
if your parent theme is luma instead:
app/design/frontend//<Custom_Theme>/Magento_Theme/layout/override/theme/Magento/luma/
In this new file paste this code:
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
</head>
</page>
after that remove css fonts declarations on
/app/design/frontend/Vendor/Theme/web/css/source/_typography.less