Rockbox mail archive
Subject: Different charsets, loadable fonts, unicode ....
From: Alex Gitelman (alex_at_fg-soup.com)
I am attaching a patch with my recent works on loadable fonts. It
addresses few issues Bjorn pointed out. Such as using malloc and
code styling issues. I would certainly appreciate feedback.
I will desscribe how to apply patch (very simple latter in this mail)
As I have tons of music in Cyrillic (both filenames and id3 tags) I
got into 2 problems with devices that don't support Cyrillic - one is
pure pragmatic - It's tedious to go and rename all files (not to
mention changing tags), second aestatic - pretty obvious. As most
manufacturer are not willing to support multimillion nation, Rockbox
project was like bright light and was a good chance to get what I
need. So I started playing with it.
Obviously similar issues are faced by people who speak Hebrew,
Chinese, Japanese, Greek and other languages with different
2. Technical details.
Please notice that everything I discuss is only applicable to recorder
with lcd bitmap.
One solution would be to rewrite chartables in Rockbox and extend them
to chars from 0x80 to 0xFF. But then everybody would need to do the
same thing for their language.
The better way would be to allow people to have external font in some
format and have Rockbox load it and use it to display text.
As I don't have time to go to deep into font formats like true type
(which would be attractive probably). I stopped on a BDF 2.1 as a
simple font format widely available.
First attempt to load font into player directly turned out to a
disaster due to memory allocation problems and other resource
limitations. So I figured that better way is to precompile BDF to some
binary format that resembles as much as possible to Rockbox fonts
Eventually, I stopped on following format: 0xBD 0xFC <height> [ char
len char bitmap]. Format is pretty strict. 0xBD 0xFC is a magic
(stands for BDF compiled). <height> is one byte (up to 255 which is
10 times more than enough). After that exactly 256 char bitmaps each
preceded by one byte number of bytes in bitmap.
In firmaware fonts are stored as simple byte buffer. And there are
few utility functions to extract bitmaps and info. I called it AJF as
Archos Jukebox font.
To make life easier I wrote bdf2ajf utility that takes BDF font and
converts it to AJF font.
At the current stage only one AJF font is supported. File named
system.ajf must be placed to root of jukebox.
3. Encoding, unicode....
One issue that needs to be addressed is encoding. All filenames on
Archos are unicode while most id3 tags and system messages are not.
For now I implemented very preliminary hack for filenames that just
maps all non 0 pages to page 04 (Cyrillic) and does proper adjustment
for encoding of characters in AJF. Example: Cyrillic letter A maps to
0xC0 in non unicode font and to 0x0410 unicode. This simplest thing
just sees 04 codepage and takes lower byte and adds 0xB0 to it.
Eventually, it should look at the code page and map it to proper font
and conversion table.
So proposed solution would be to define codepage in AJF file and also
give somehow conversion table. Then in setting one would say that page
04 maps to cyrillic.ajf + cyrillic.tbl. And similar for other pages.
Probably 2 pages in addition to default would be enough.
And non unicode should map directly to font where position of
character defines it's encoding.
One more conversion.
I don't know about other languages, but Cyrillic has few different
encodings. For now I just hardcoded conversion table in bdf2ajf but
eventually it should be externalized. It's not an issue for anybody
who does not go beyond 0x7F character (which is the case now anyway).
4. Finally how to apply patch.
Unpack ajf_diff.zip to some directory, say, /tmp/ajf_diff.
Checkout clean code as of 07/11/02:
cvs co apps firmware tools
Now thing is patched.
Switch to tools and do make.
then create build dir and configure in it.:
Enter target platform: (defaults to Recorder)
1 - Archos Player old LCD
2 - Archos Player/Studio new LCD
3 - Archos Recorder
Loadable fonts support? (y|n) [n]
Build (N)ormal, (D)ebug or (S)imulated version? (N)
Now copy ajbrec.ajz and system.ajf to Jukebox and you are done.
Notice that system.ajf is 6x10 font, so I did proper height adjustment
in firmware (it was hardcoded to 8 originally). In general it looks
Now enjoy and tell me what you think....
Page was last modified "Jan 10 2012" The Rockbox Crew