I purchased a magento 2 theme, but the theme uses the Google api font.

How can I use a custom local font?

Magento ver. 2.3.0


1 Answer 1

  1. mkdir -p path_to_magento_install_dir/app/design/frontend/theme/custom-theme/web/fonts/CustomFont
  2. upload myfonts_regular.ttf
  3. mkdir -p path_to_magento_install_dir/app/design/frontend/theme/custom-theme/web/css
  4. create fonts.css
@font-face {
    font-family: 'MyFonts';
    src: url('../fonts/CustomFont/myfonts_regular.ttf');
    font-weight: 300;
    font-style: normal
  1. path_to_magento_install_dir/app/design/frontend/theme/custom-theme/Magento_Theme/layout/default_head_blocks.xml
        <css src="css/fonts.css" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.