This directory holds Material Icons used within OCW websites.
We subset material icons' fonts to make them smaller for delivery. By "subsetting a font" we simply mean removing unnecessary characters from the font face.
Each time the set of icons changes, new subset font assets must be created. To do so, read the following sections.
-
You must have the dependencies from the main project installed.
-
Install fonttools utility.
Ubuntu
sudo apt-get install -y fonttools
MacOS
brew install fonttools
To add a new icon, follow these steps:
- Identify the name of the icon you want to use.
You may explore the icons here.
- Search the codepoint for the icon in ./MaterialIcons-Regular.codepoints or ./MaterialIconsRound-Regular.codepoints.
- Copy the codepoint declaration line.
- Paste the codepoint declaration line in ./MaterialIcons-Regular.subset.codepoints or ./MaterialIconsRound-Regular.subset.codepoints, wherever appropriate.
- Run
yarn subset-fonts
- Commit the new assets.
To remove an icon, follow these steps:
- Identify the name of the icon you want to remove.
You may explore the icons here.
- Remove the codepoint declaration line in ./MaterialIcons-Regular.subset.codepoints or ./MaterialIconsRound-Regular.subset.codepoints, wherever appropriate.
- Run
yarn subset-fonts
- Commit the new assets.
To get the latest information on this command and its arguments, run
yarn subset-fonts --help