I'm trying to include my own font to my drupal website. I've got a custom.css file in my theme inside 'sites/all/themes/mytheme/css' folder. My fonts are in my 'sites/all/themes/mytheme/fonts' folder. The css is called from the template.php in my theme folder. This is my css code right now:

@font-face {
    font-family: 'slashbadass_black';
    src: url('../fonts/Myfont.eot');
    src: url('../fonts/Myfont.eot?#iefix') format('embedded-opentype'),
         url('../fonts/Myfont.woff2') format('woff2'),
         url('../fonts/Myfont.woff') format('woff'),
         url('../fonts/Myfont.ttf') format('truetype'),
         url('../fonts/Myfont.svg#slashbadass_black') format('svg');
    font-weight: normal;
    font-style: normal;

So is this path OK? For what I've seen the font-family is not available right now.


Define your css in mytheme.info:

stylesheets[all][] = css/style.css

@font-face {
  font-family: "Oswald";
  src: url(../fonts/oswald.eot?#iefix) format("embedded-opentype"),
     url(../fonts/oswald.woff) format("woff"),
     url(../fonts/oswald.ttf) format("truetype"), 
     url(../fonts/oswald.svg) format("svg")

instead of template.php

  • I'm adapting an external theme so I try to follow the same structure. If i call the css file from theme.info the path will be fine as it is? – Miquel Correa Casablanca Oct 21 '15 at 11:50
  • I have it so in all my Drupal projects so it will work – Paul Bönisch Oct 21 '15 at 11:58
  • It worked as you said but the real problem was not having the fonts on the server. – Miquel Correa Casablanca Oct 22 '15 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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