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



Rockbox mail archive

Subject: Re: Thoughts on Multiple Fonts in Rockbox

Re: Thoughts on Multiple Fonts in Rockbox

From: Daniel Stenberg <daniel_at_rockbox.org>
Date: 2005-08-24

On Tue, 23 Aug 2005, Greg Haerr wrote:

> I thought I'd comment on Daniel's thoughts about adding multiple fonts to
> rockbox.

Thanks, I value your input a lot!

> The font cache should house numbered fonts, not named fonts.

Right.

> There needs to be some discussion regarding how many lower level fonts
> should be loaded, since we don't have dynamic memory.

Actually, I had a slightly more complicated but flexible approach in mind:

We use a fixed size static memory area for loaded fonts. That's the cache. We
can load N fonts into the cache and thus we can use at most N different fonts
simultaneously on a single screen.

N can differ depending on the actual target model, just depending on how much
memory we want to provide/waste for fonts.

If an application selects to display a font that isn't in the cache already,
it loads that font (and possibly flushes an old one from it).

Thus, we can support displaying of numerous fonts, while we only support N
simultaneous ones. In most screens you only use a single font anyway. The only
downside is that the selecting of a font that isn't in the cache requires a
disk spin-up and load.

> Perhaps the config option that specifies the font name and its application
> display use counts them and allocates memory for all specified.

It wouldn't be possible due to the lack of dynamic memory functions, since you
can at any time load a new config file with a new font setup.

> I think the above FONT_xxx should just be an enum, with values from 0.
> FONT_SYSTEM would be 0, with optional values starting at 1.

I agree.

> Rather than loading fonts on the fly, which has memory allocation issues
> because of the differing bitmap sizes, all fonts could be loaded at boot,
> and then when the application requests FONT_xxx, the font is used if
> present, or FONT_SYSTEM is defaulted.

Forcing users to reboot when they switch font seems harsh to me.

> The application never knows the optional or default sizes, any on-screen
> formatting must use a lower-level system call to determine sizing
> information.

Already today the applications don't know the size until they figure it out
using the proper function(s).

> In this way, the application specifies a "desired" font, rather than a
> mandatory font.

I would imagine that we could have the font changing function have a parameter
that asks for the specified font mandatory or optionally, and in the latter
case we could have a fancy way for the font subsystem to pick the one of the
already loaded fonts that is most similar to the one you ask for.

-- 
  Daniel Stenberg -- http://www.rockbox.org/ -- http://daniel.haxx.se/
_______________________________________________
http://cool.haxx.se/mailman/listinfo/rockbox
Received on Wed Aug 24 09:16:13 2005

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