Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide
translations



Rockbox mail archive

Subject: Re: Multifont: testing & feedback

Re: Multifont: testing & feedback

From: Fredrik Öhrn <ohrn_at_chl.chalmers.se>
Date: Sat, 11 Mar 2006 19:08:56 +0100

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
fonts.


Regards,
Fredrik

-- 
    "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
ohrn_at_chl.chalmers.se                                                  Sweden
Received on 2006-03-11

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy