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



Rockbox mail archive

Subject: [PATCH] compiled-in and loadable fonts
From: Greg Haerr (greg_at_censoft.com)
Date: 2002-09-12


Here's a complete patch for adding compiled-in and loadable
fonts to the current (09-11-2002) CVS. Also included
are a set of new .fnt font files and their .bdf source.

To make the system for testing, ./configure and select
NO for loadable fonts, and YES for proportional fonts.
Then copy some .fnt file to /system.fnt (I am using the large
courB14.fnt to show the coolness of large fonts).

To create a new .fnt file for your own pleasure, say from
source courB08.bdf, do the following:

cd tools
./bdf2fnt courB08 (don't use .bdf extension here...)
[this creates a courB08.fnt in the current directory)
cp courB08.fnt /system.fnt

To create a compiled-in font other than the default
(current X5x8.bdf since I don't have the source for the
6x8 that's currently used):

cd tools
./bdf2c X6x9.bdf > X6x9.c
[this creates X6x9.c in the current directory]
cd ../firmware
[edit font.c and include font_X6x9 in the sysfonts
array]

Currently, you can choose a basic fixed-pitch font (FONT_SYSFIXED),
a proportional font (FONT_UI), and a font when displaying MP3's
(FONT_MP3). All the code isn't quite in place for the applications
and game code selecting fonts. Also, the MAX_FONT_SIZE define
in firmware/font.h must be changed to the aggregate size of all
loaded fonts.

Technical notes:
1. This patch doesn't cleanup the LOADABLE_FONTS and
non LCD_PROPFONTS code. I'll do that after the patch is
accepted. Also, the Cyrillic font isn't tested yet, I'll try to do that
tonight and talk with Alex about it (it needs codepage support
added to my code)

2. When the FONT_UI height is > 8 pixels, sometimes the bottom
of the display gets messed up. The WPS code needs to be
checked by somebody to fix this problem. (use lcd_getfontsize()
to find the current font height and calculate x,y appropriately)

3. Not tested on win32. Needs perl to create .bdf files.

4. Currently, .bdf files get fully converted, supporting ISO8859-1.
I'm going to add an option for just ascii 20-0x7e to the conversion
files. This will make font and compiled-in files smaller.

5. I want to rename some lcd_ functions to a higher level,
that is, font_xxx. This is because these functions are not
strictly driver level function, and all depend on lcd_bitmap.
Likewise, the lcd_drawline et al should move to a
different file at least, perhaps firmware/graphics.c. I'll look
at all this after the patch is accepted and we have a single
font system.

6. Somebody needs to seperate out the HAVE_CHARCELLS
version of lcd.c into another file, it's still ugly.

Have fun!

Regards,

Greg





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