How To Enable Custom Google Fonts For Drupal 8 Website

There are several options how to enable custom fonts for Drupal 8 website, in this article I will stick with one of the easiest - using a custom module - @font-your-face

As usual, for this Drupal tutorial I will use a real-time scenario: For website I'm using custom Premium theme adapted for Drupal 8, at one stage I noticed that example theme looks better than customized, and then I realized we are missing few fonts, which must be loaded manually.

As, said there are several options to handle this, but this time I decided to use a module. Again, there are two scenarios possible, either you are building Drupal theme from scratch and writing custom .css style or you are using a readily built theme. As in this case, I'm using the ready built theme, I won't touch .css part, as code already have been written.

  • Download and enable @font-your-face module
  • As for this case I'm using Google Fonts, enable Google Fonts module
  • Go to admin/appearance/font and enable custom fonts you need
  • Flush cache and enjoy result

Custom fonts enabled

Custom fonts enabled