2

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

1 Answer 1

3
  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
    <head>
        ...
        <css src="css/fonts.css" />
        ...
    </head>
8

Your Answer

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

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