Gantry 5 includes a new Font Picker which gives you the ability to select fonts for a variety of situations including templates, Particles, and more.
The Font Picker makes it easy to quickly choose fonts in Particles. The picker itself pops up when you click a special field in the backend that gives you the ability to set a font for a Particle, or even for the theme itself.
Based on Google Fonts, the Font Picker gives you immediate access to over 600 open source fonts.
You can find more information about adding a font to the font picker (as well as to your theme in general) in our fonts guide.
Upon clicking the font icon to the right of the Font Picker field, a popup appears that enables you to type a phrase and see it presented in over 670 different fonts from the Google Font library.
To make life a little easier, you can filter these results by Category and Subset, as well as search for a specific font using the search tool in the upper-right corner of the popup.
This is a very quick and easy way to not only get a preview of what a block of text might look like with a different font, but to apply that font to your page by simply choosing it and hitting Select.
You have the ability to quickly and easily select font weights and character sets within the Font Picker. Selecting these here will make them available in your theme.
The font weight (thin, light, normal, etc.) determines how the font appears on the front end. This can be a great way to differentiate titles and subtitles from your content, enhance your site's general typography, and more.
Character sets are especially useful for multi-language sites as they enable you to utilize Latin, Greek, Cyrillic, etc. characters. You can select one or more character sets, though not all fonts support additional character sets.
Here are the steps you would follow to access these controls:
Roboto
)Now that the font weights are available in the theme, they can be added to the site with css.
Example
The font selected in this example is Exo:800
.your-element{
font-weight:800;
}
Replace .your-element
with the id(#) or class(.) of the element
Replace 800
with the selected variation
The Roboto and Ubuntu fonts are two of the most complete font sets in the Google Font Library.
Not all of the fonts inside the Google Font Library have variations!
The Font Picker is a Gantry 5 input. If you want to add it to your template or particle, you would do so by assigning the administrative input as input.fonts
in the Particle's YAML file.
Here is an example of how this would look in the YAML file.
target:
type: input.fonts
label: Font
description: Select the font you would like to have used for content in the Particle.
default: family=Inconsolata:700,400&subset=latin,latin-ext
You can find more information about how to use YAML files in Gantry 5 in our guide.