KiSS DP-450 and DP-500 fonts

Overview

The only interesting file for us is /bin/init contained in romfs.bin.
kx:# mount -o loop 'KiSS DP-450 Firmware 2.7.1 PAL.iso' /mnt/dp450
kx:# mount -o loop /mnt/dp450/romfs.bin /mnt/dp450.romfs
kx:$ cd /mnt/dp450.romfs
kx:/mnt/dp450.romfs$ ls -l bin
total 0
-rwxr-xr-x    1 root     root        57528 Jan  1  1970 busybox
-rwxr-xr-x    1 root     root       875428 Jan  1  1970 init
To create new romfs.bin, I use:
genromfs -d newromfs -f /tmp/romfs.bin -a 512 -V 'romfs'
If you need documentation on extracting files and assembling them back on windows, please refer to www.kiss-tuning.nl.

KiSS programmers use the NANO-X graphical library, probably version 0.89. Unfortunately it is statically linked with bin/init, what will not make our life easier. :-(

The following fonts are defined:

Each font has three interesting structures: Description of 24-pixel font follows.

Fonts

Characters' definitions

Each character is defined in 16x24 grid (width x height) or 32x24 grid. Most characters fit into the smaller one, only some of them don't (%, @, W, m, (C), (R), 1/4, 1/2, 3/4 an so on - you can find them yourself - they look a bit strange on my picture, because I displayed them like any other character ignoring the fact they use twice as space). But I had a very good reason for making it looks like this - it is very handy when we need the address of a character from the table.
16x24 grid characters are encoded as 24 16-bit words, where the most significant bit is on the left side of the character. Words are little endian (low byte, high byte).
An example:
    FEDCBA9876543210
 1  ........XXX..... 32+64+128 = 224 0x00E0
 2  .......X...X.... 16+256    = 272 0x0110
 3  ........XXX..... 32+64+128 = 224 0x00E0
...
24  ................


E0, 00, 10, 01, E0, 00, ...
32x24 grid characters are encoded as 24 pairs of 16-bit words, where the first word is the left side of the row of the character.
So normal character uses 48 bytes and wider one - 96 bytes).

Table of pointers

Some characters use 48 bytes, some 96, so we can't compute the address of the definition of a given characters. These addresses are stored in the table. Table stores 2-byte words (little endian). The table starts with the address of the space character (code 32). The address of the space is 0. The address of the next character ("!") is... no, not 48 ;-) It would be too easy. You need to divide it by 2 :) So the address of "!" is 24.
This table has a nice advantage which I used to make a version with Polish characters. There are two encoding standards used in Poland - iso-8859-2 and windows-1250. Unfortunately, they are different! But it is possible to make a firmware which displays both standards correctly. For example, character "¶" is 0xB6 in iso-8859-2 and 0x9C in windows-1250. So I set both pointers (for 0xB6 and 0x9C characters) to the same value - the address of the "¶" character - 0x127 * 48 / 2 = 7080
In the C syntax:
ptr_table [0xB6 - ' '] = ptr_table [0x9C - ' '] = 7080;
And that's all (well, almost all - we need one more step).

Table of characters' width

This table of bytes stores the width of characters. First element is a width of space, second of "!" and so on. To complete defining "¶" character in iso-8859-2 and windows-1250 we need to set it's width.
width_table [0xB6 - ' '] = width_table [0x9C - ' '] = w;
where w is of course the width of our "¶".

Problem with Korean characters

KiSS has configured the NANO-X library to handle Korean fonts, probably by defining HAVE_EUCJP_SUPPORT or HAVE_KSC5601_SUPPORT macro. As we can see in microwin-0.89/src/engine/devfont.c this support is done by decoding two-byte sequences into one character. This is described as bug "Bad display of extended Latin characters in menus and subtitles" in the bugs thread of the Kiss DVD software forum.
To disable this "feature" we need to change two bytes from "1" to "0" at offsets shown below as "Disabling Korean encoding".

File offsets

FW versionCharacters' definitionsTable of pointersTable of widthsDisabling Korean encoding
DP-450 2.7.4610240644176648406406176 and 446044
DP-500 2.7.4812664846600850830453520 and 493388

Adding custom font

Adding a custom font requires the following steps: