dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re: Multifont: testing & feedback

Re: Multifont: testing & feedback

From: Fredrik Íhrn <>
Date: 2006-03-11

bk wrote:
> Fonts selected through General Settings -> Display -> Browse Fonts
> override the theme font settings, emulating the old behavior. This is
> somewhat wasteful since we then have up to five copies of the same font
> loaded into memory, but the total overhead is around 50k (worst case) so
> I'm not too stressed about it. I debated implementing GUI menu items for
> each font context but decided against it for the sake of simplicity.

To avoid loading the same font several times, I'd suggest the following:

Drop the lines:

static struct font browserfont;
static struct font wpsfont;
static struct font menufont;

And make an array instead:

static struct font available_fonts [MAX_FONTS];

When someone calls font_load, go through the available_fonts array, if the
font already exists there just update the sysfonts array to point to the
appropriate available_fonts entry.

If the font doesn't exist, pick an empty slot in the available_fonts array,
load it and update sysfonts.

This is also a path toward using multiple fonts in a wps. Add tag that loads a
font into an available slot and a tag to change back and forth between loaded


    "40 million, son. You have any idea how many patients
    I had to ignore to get that high score? People died."     --Dr. Kelso
Fredrik Íhrn                               Chalmers University of Technology                                                  Sweden
Received on Sat Mar 11 19:14:38 2006

Page was last modified "Jan 10 2012" The Rockbox Crew