In Apple-style color fonts, bitmap images are embedded in a so-called
sbix table inside the font file. Multiple images at various sizes can be assigned to each glyph. Thus the Apple device displaying it can pick the most appropriate resolution.
Prepare Size Variations
Usually, Apple-style color fonts make use of Portable Network Graphic (PNG) format. JPEG and TIFF also work fine. The specification even allows for PDFs, but they are not (yet) supported by iOS or OS X. Whichever format we choose, we need to prepare those images outside of Glyphs.
Let’s say I want to take the Glyphs icon and put it into the uppercase G of a font. It is a good idea to prepare image files at several resolutions in an image editing application like Pixelmator or Preview. If you already have the pictures, then all you need to do is produce the size variations. Note that simple downscaling can even be done with an Automator workflow, which can be triggered via the contextual menu in Finder, when installed as an OS X service.
Hint: Create at least one small variation below 100 pixels, because it can significantly boost display performance at low resolutions, especially on older devices.
In any event, we strongly recommend to keep your images in a subfolder next to the
.glyphs file. That is because Glyphs only stores their relative path in the file, not the binary itself.
Of course, whenever you move your
.glyphs file, move the subfolder along with it. Otherwise, you risk Glyphs complaining about missing image files. Should that happen to you, you may find the Set New Path for Images script useful. Find it in the Images folder in my Glyphs-Scripts repository on GitHub.
Set the Width
Now, let’s start Glyphs and create a new font. I bring up my uppercase G and change its width. The master layer is only for determining the metrics of the glyph, and will stay empty.
The width should reflect the ratio of the image in relationship to the Units Per Em (UPM). You can check on your UPM value in File > Font Info > Font.
In my case, I set its width to 1000, because my icon is square and my UPM is 1000, the recommended value for CFF OpenType Fonts and the app default in Glyphs. If your graphic is only half as wide as it is high, set it to half its UPM, i.e. 500. If it is twice as wide, set it to 2000. You get the idea.
Now, with the G still open, open the Palette (Window > Palette, Cmd-Opt-P), and go to the Layers section. Select your Regular master, and create sublayers by clicking the Copy button as often as necessary. You need as many sublayers as you have PNG files.
Rename the layers to
iColor, followed by a wordspace and a number indicating the image resolution. For instance,
iColor 128, and
The rest is easy. Simply drag the PNG files from the Finder into the respective
iColor layers. If you have done everything right, your setup could look similar to this:
The width of the
iColor sublayers, as well as any image manipulations (scaling or placement), will be ignored. So, you do not need to bother to readjust the PNGs in the glyph metrics.
Now when you go to File > Export, pick OTF, TTF or any Webfont format as export format. Glyphs will create a font containing the sbix table, which can be viewed and used on both iOS and Mac OS X. Have fun!
sbix in Photoshop
The latest versions of Photoshop CC can display Apple-style color fonts as well. But for sbix to work in Photoshop, these three criteria must be fulfilled:
- The sbix glyphs must contain outlines as well, even if it is only two tiny paths. They define the cropping bounding box in Photoshop. If there are no outlines, everything is cropped, and you do not see your pixel image.
- The font must be installed in the system (e.g., in FontBook). The Adobe Fonts folder will not do. We recommend to use different names every time you export in order to avoid font cache problems.
- After each font installation, you must restart Photoshop for the sbix fonts to be recognized.
Update 2017-08-08: Added ‘sbix in Photoshop’ section, title-cased headers.