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: Different charsets, loadable fonts, unicode ....

Re: Different charsets, loadable fonts, unicode ....

From: Eric Linenberg <elinenbe_at_umich.edu>
Date: Thu, 11 Jul 2002 15:46:26 -0400

It seems there may be an error with your zip, as there is nothing in
the apps dir. I would love to test this out today, so if you could
resend it to the list with the proper .zip that would be great.

-eric

AG> Hi all,
AG> I am attaching a patch with my recent works on loadable fonts. It
AG> addresses few issues Bjorn pointed out. Such as using malloc and
AG> code styling issues. I would certainly appreciate feedback.
AG> I will desscribe how to apply patch (very simple latter in this mail)

AG> Now details.
AG> 1. Background
AG> As I have tons of music in Cyrillic (both filenames and id3 tags) I
AG> got into 2 problems with devices that don't support Cyrillic - one is
AG> pure pragmatic - It's tedious to go and rename all files (not to
AG> mention changing tags), second aestatic - pretty obvious. As most
AG> manufacturer are not willing to support multimillion nation, Rockbox
AG> project was like bright light and was a good chance to get what I
AG> need. So I started playing with it.
AG> Obviously similar issues are faced by people who speak Hebrew,
AG> Chinese, Japanese, Greek and other languages with different
AG> characters.

AG> 2. Technical details.
AG> Please notice that everything I discuss is only applicable to recorder
AG> with lcd bitmap.
AG> One solution would be to rewrite chartables in Rockbox and extend them
AG> to chars from 0x80 to 0xFF. But then everybody would need to do the
AG> same thing for their language.
AG> The better way would be to allow people to have external font in some
AG> format and have Rockbox load it and use it to display text.
AG> As I don't have time to go to deep into font formats like true type
AG> (which would be attractive probably). I stopped on a BDF 2.1 as a
AG> simple font format widely available.
AG> First attempt to load font into player directly turned out to a
AG> disaster due to memory allocation problems and other resource
AG> limitations. So I figured that better way is to precompile BDF to some
AG> binary format that resembles as much as possible to Rockbox fonts
AG> (hardcoded).
AG> Eventually, I stopped on following format: 0xBD 0xFC <height> [ char
AG> len char bitmap]. Format is pretty strict. 0xBD 0xFC is a magic
AG> (stands for BDF compiled). <height> is one byte (up to 255 which is
AG> 10 times more than enough). After that exactly 256 char bitmaps each
AG> preceded by one byte number of bytes in bitmap.
AG> In firmaware fonts are stored as simple byte buffer. And there are
AG> few utility functions to extract bitmaps and info. I called it AJF as
AG> Archos Jukebox font.
AG> To make life easier I wrote bdf2ajf utility that takes BDF font and
AG> converts it to AJF font.
AG> At the current stage only one AJF font is supported. File named
AG> system.ajf must be placed to root of jukebox.

AG> 3. Encoding, unicode....
AG> One issue that needs to be addressed is encoding. All filenames on
AG> Archos are unicode while most id3 tags and system messages are not.
AG> For now I implemented very preliminary hack for filenames that just
AG> maps all non 0 pages to page 04 (Cyrillic) and does proper adjustment
AG> for encoding of characters in AJF. Example: Cyrillic letter A maps to
AG> 0xC0 in non unicode font and to 0x0410 unicode. This simplest thing
AG> just sees 04 codepage and takes lower byte and adds 0xB0 to it.
AG> Eventually, it should look at the code page and map it to proper font
AG> and conversion table.
AG> So proposed solution would be to define codepage in AJF file and also
AG> give somehow conversion table. Then in setting one would say that page
AG> 04 maps to cyrillic.ajf + cyrillic.tbl. And similar for other pages.
AG> Probably 2 pages in addition to default would be enough.
AG> And non unicode should map directly to font where position of
AG> character defines it's encoding.

AG> One more conversion.
AG> I don't know about other languages, but Cyrillic has few different
AG> encodings. For now I just hardcoded conversion table in bdf2ajf but
AG> eventually it should be externalized. It's not an issue for anybody
AG> who does not go beyond 0x7F character (which is the case now anyway).


AG> 4. Finally how to apply patch.
AG> Unpack ajf_diff.zip to some directory, say, /tmp/ajf_diff.
AG> Checkout clean code as of 07/11/02:
AG> mkdir ~/test
AG> cd ~/test
AG> cvs co apps firmware tools
AG> cd /tmp/ajf_diff
AG> ./apply.sh ~/test

AG> Now thing is patched.
AG> Switch to tools and do make.
AG> then create build dir and configure in it.:

AG> cd ~/test/tools
AG> make
AG> cd ..
AG> mkdir build
AG> cd build
AG> ../tools/configure

AG> Enter target platform: (defaults to Recorder)
AG> 1 - Archos Player old LCD
AG> 2 - Archos Player/Studio new LCD
AG> 3 - Archos Recorder
AG> 3
AG> Loadable fonts support? (y|n) [n]
AG> y

AG> Build (N)ormal, (D)ebug or (S)imulated version? (N)
AG> n
AG> Created Makefile

AG> make

AG> Now copy ajbrec.ajz and system.ajf to Jukebox and you are done.

AG> Notice that system.ajf is 6x10 font, so I did proper height adjustment
AG> in firmware (it was hardcoded to 8 originally). In general it looks
AG> good.

AG> Now enjoy and tell me what you think....
AG> Best
AG> Alex Gitelman
Received on 2002-07-11

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