Font Combining
When making Rockbox themes, there are numerous built in fonts to choose from. However sometimes, these may not suit the theme you are building. In situations like these, users can make their own fonts. This guide goes over several ways people can achieve this, including a guide on combining two different fonts together to create a wider language supporting font.
Making Rockbox Fonts
Rockbox uses it’s own, custom font format for it’s interface. Therefore it’s necessary to convert our fonts for use in themes. This process is slightly different for colour and monochrome models, the former allowing anti-aliasing and the latter using exclusively bitmaps fonts. For the moment I’ve focused on the non-bitmap conversion process.
Getting convttf
If you don’t already have the convttf tool, then you’ll need to build it from the source using the following guide.
- ⚬ Start by cloning the Rockbox repo: git clone git://git.rockbox.org/rockbox.
- ⚬ Navigate to the tools folder and run the command make convttf. - If you encounter errors with this, make sure "freetype-devel" and "freetype2" (or "ftgl") are installed.
Using Convttf
Convttf is used via the command line, and I find it useful to move the executable into the directory of fonts I’m working with. The executable can be used like the following.
/convttf -p 16 -c 1 fontfile.ttf
Notes
- ⚬ The number beside -p is the size of the font, this unit isn’t pt or px so you will have to experiment.
- ⚬ -c is for the spacing between letters, 1 is an all round good option for most sizes and fonts.
- ⚬ If you wish to add padding to the top and bottom of fonts, say for the menu (see Interpod for an example), then two values can be added: -Ta and -Td.
- ⚬ The values for -Ta and -Td should be negative, used like the following -Ta ‘-3’ -Td ‘-2’. Ta is the top padding, and Td the bottom.
Combining Two Fonts with Fontforge
This is a method of combining two different .ttf fonts into one. Useful for making CJK supported fonts for Rockbox, or adding glyphs into a font for web purposes etc. Fontforge is the main application used, however if you intend to make fonts for Rockbox, you’ll need convttf from their dev tools. This guide focuses on combining CJK fonts with non-CJK fonts.
Preparing the Secondary Font
Firstly, we’re going to get a secondary font. In this case we’ll be looking for a font for asian characters, known as a CJK Font (for Chinese, Japanese and Korean). The best font for this job is Noto CJK.
- ⚬ Download language specific .otf file - The best font to use here is . However make sure you download the Region Specific Subset OTF file for each language you want.
- ⚬ Open the file in Fontforge and flatten CID Layers.
- ⚬ Remove any unnecessary characters (non-CJK letters, emoji etc).
- ⚬ Re-encode as Unicode Full.
- ⚬ Save as .sfd.
Combining the Fonts
Firstly, we’re going to get a secondary font. In this case we’ll be looking for a font for asian characters, known as a CJK Font (for Chinese, Japanese and Korean). The best font for this job is Noto CJK.
- ⚬ Open the Base Font, which we want to combine with.
- ⚬ Remove any unnecessary characters, like emoji.
- ⚬ Go to Element > Merge Fonts choose the .sfd Font we just made, and merge.
- ⚬ Go to Edit > Select > Changed Glyphs.
- ⚬ Go to Element > Transform and select Scale.
- ⚬ Select Origin: Glyph Origin > Scale: 250% 250% > select all boxes. (Note: Scale will differ on the font, so experiment).
- ⚬ Export the font by going to File > Make Font choose true type and validate.