5

I use an Omega subtheme in my Drupal 7 site, and I'd like to change the default font to a custom font. How can I do this?

13

This question is over 6 months old. The best solution now for adding custom fonts is to use the @fontyourface module.

8

I highly recommend Google Webfonts, as @dibs suggested.

Here's the code to include the webfont into your Omega subtheme:

function omega_preprocess_html(&$variables) {
  drupal_add_css('http://fonts.googleapis.com/css?family=Lato',array('type' => 'external'));
}

Add that to your sites/all/themes/your_omega_sub_theme/template.php file.

The URL is the one google webfonts gives you (pick a font and click "Quick use"). Or you can use another online font site.

Now that your font is imported (I used "Lato") you can edit your subtheme with something like this:

body {font-family: 'lato'}
0
6

@font-your-face is the best to use Fonts on your drupal site, just enable the font and make changes to your css files. you are done

1
  • What changes should be made for working with local fonts? Nov 2 '15 at 0:06
3

If you want to use custom fonts, you should give font-face a try.

You can read more about this technique here.

Once you have created your font-face font, you should use your theme CSS files to set this font to whatever elements you want.

You might also consider to go with Cufón library, and you can even find a Drupal module for it.

The Cufón library renders fonts using canvas tags, which makes text unselectable; Fontface is a much more flexible solution.

3
  • 3
    Just to make you aware, if you're using @font-face, you need to be aware of the licensing restrictions for your font. You may not legally be allowed to embed it using @font-face.
    – Chapabu
    Mar 7 '12 at 11:01
  • Of course. I assume that the topic starter has the right to embed that font into his website. Mar 7 '12 at 11:36
  • I think licensing issue comes up WHENEVER you are using font, regardless of the media and technology :)
    – Artur
    May 12 '12 at 9:58
0

If you do want non-standard fonts on your website and are unsure about the copywrite of using them, try a font web deliverer such as typkit.com. They have a plan where you can use any of their fonts and they sort out the copywrite for you. There is a module which implements this into drupal 7 also.

-1

You should check out Google web fonts.

http://www.google.com/webfonts

  • They are easily added to a site
  • Open-source
  • Large selection. 500+ font families at time of writing.
-3

Fontyourface module now supports google fonts so no need to add code manually.

1
  • Exactly like the two top answers already state. Except they also include a link to the module.
    – Letharion
    Feb 23 '13 at 21:42

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.