release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Search | Go
Wiki > Main > CreateFonts

How To Easily Create Font files


Rockbox stores fonts in a special format called FNT (see FontFormat for details). If you have a Linux and/or BSD system with an X server you probably already have a font server like xfs. You can use all the fonts available on this font server to create BDF files which you then can convert to FNT format. The procedure is quite easy:

First, make sure you have a font server running. Common ones are xfs, xfs-xtt and xfstt. Usually they can be reached via a UNIX socket. On my Debian system, xfs waits for connections on unix:/7100. Other font servers may use unix:/7101 or something entirely different. If you do not have a font server, you can install one without having to install XFree86 or X.org. In Debian terms, you would do:

apt-get install xfs

The tool to extract arbitrary fonts in BDF format is called fstobdf. Debian ships this program in the package xbase-clients. You can run it like this (one line):

fstobdf -s unix/:7100 -fn -misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1 > fixed-12.bdf

The -s parameter must be followed by the address of your font server. The -fn parameter is followed by the name of the font you want to extract. You can get a list of all available fonts with xlsfonts (which is also part of the xbase-clients Debian package) or with graphical tools like xfontsel. As fstobdf prints the BDF file to stdout, you have to redirect its output to a file (in this case fixed-12.bdf).

Anyway, if you have created one or more BDF files, you can convert them with convbdf, which is shipped within the source files of Rockbox. Simply do:

convbdf -f fixed-12.bdf

where obviously fixed-12.bdf is one of your newly created BDF files. Copy the resulting fixed-12.fnt into the .rockbox/fonts directory on your player and "run" it. Rockbox should now display your font. If it looks very small and not like you expected, something went wrong in the process and Rockbox chose its default font. Maybe you tried a font that Rockbox cannot display (see below).


FontForge

A useful free software program for converting, previewing and editing fonts is FontForge (http://fontforge.sourceforge.net). It supports unicode natively and can generate fonts in many formats including BDF. It can import fonts in TrueType, Postscript (Type 1 - Type 3), SVG and several other formats as well.

To export your font for the use with convbdf, be sure to select File->Generate fonts and choose BDF as output format. Otherwise you will get nasty error messages during conversion.


Rockbox Font Convertor

This is a MS-DOS/Windows batch file which makes use of some free programs to convert any TrueType or OpenType font automatically to the Rockbox FNT format. All you need is to start the command prompt, navigate to the folder containing the convertor and type

makefont [fontname]

This is being updated constantly and I hope to create a GUI soon to do the same job and make it easier to use and configure.

There is a new version in the works. For more information see the forum thread below. I will update this ASAP. -- GeoffStokes - 23 Feb 2007

Currently, you set the font size inside the batch file, but in the future i hope to allow this to be set either in GUI or as a command line argument.

The convertor includes all necessary files in the .zip, and simply needs extraction to a convenient place. Note also that the converted font file is placed in the same folder as the original, so it's best to copy the font file into the directory which the convertor is in FIRST before starting, using a font in C:\Windows\Fonts will NOT work as the file will not be accessible from that folder.

If you already have a BDF file, simply use convbdf. You can compile it from source or obtain the binary from RockboxFontConvertor#Included_Applications.

For more information and downloads, see the Rockbox Font Convertor wiki page.


Font selection

Fonts generally have to be kept small to be usable on the low resolution screens of most devices. As a rough guide, fonts should be kept smaller than the equivalent of 16 pt on a 100 dpi display. Serif fonts tend to distort more than sans serif (or monospace) fonts at low resolutions. Remember that fonts can (and should be) tested in the UiSimulator to make sure they are viewable and not overly distorted.

Note that even though you may be able to rasterize and convert TrueType fonts (like the beautiful Bitstream family), for example by exporting to BDF and then following the above instructions, they'll tend to look ugly when used in Rockbox due to the low resolution. Previewing fonts with xfontsel is probably a good idea. If you want to use a TrueType font with Rockbox, you would be better off using the antialiased convertor (convttf, see section below) instead.

Please also remember that fonts must be released under a GPL-compatible license to be included with Rockbox. BSD and MIT/X11 are among the licenses considered compatible (see gnu.org for legal details). Commercial fonts (such as those included with Windows or various word processing applications) are virtually always unacceptable from a licensing standpoint.


X fonts gallery

The Xfree86/Xorg server distribution source contains a lot of BDF files. A gallery of a lot of these, converted to Rockbox font format can be found here. There is a problem with some of the larger fonts, where some characters look strange, or don't work at all - if you know what's causing this (BDF files are available for download as well), please contact me (JonasHaeggqvist).


Anti-Aliased fonts

Rockbox support anti-aliased fonts since r29523. The source tree contains the convttf tool which can be used to create anti-aliased .fnt files directly from .ttf fonts.

To create, for example, a 15 point high font with 1 pixel spacing from FreeSans, type:
tools/convttf -p 15 -c 1 /path/to/FreeSans.ttf
It will create a file named 15-FreeSans.fnt in the current directory.

Please refer to convttf's help output for details and further options.

Converting Non-Free fonts.

Sadly enough there are some nice or very useful non-free fonts that can't be published here. We can however publish the convttf settings.

For that the NonFreeConvTTFSettings page has been created. If you have any relevant settings, please add them.


r14 - 02 Apr 2021 - 20:46:06 - UnknownUser

Copyright © by the contributing authors.