>thanks for your valuable tips. I was looking for solution
>to do it directly on the device without any conversion step
>done on PC side. Is it possible to just directly copy font
>resouces into new resource database, modify density bits and
>then open and use those fonts?
>
>Frantisek
I don't think so. We've written some internal tools to build and convert
dual-density fonts, and I believe hires fonts are always built with an
equivalent lores font. The problem is that both fonts share a common
character-width table (in standard lores coordinates) so that each character in
the hires font is always an even number of pixels wide, exactly double the
width of the lores font. Since the lores standard font has plenty of odd-width
characters, I don't think you can use its data as is for hires text.
Still, the font format is not all that complex, so you can probably allocate a
wide 1-bit lores offscreen bitmap and draw all the characters into it, padding
each one out to an even width. Then I think you can use the raw data in this
bitmap as the imagedata part of the font structure. Here is some old code
fragments that I don't all remember but might help:
// Font format:
// NFNT2_HEADER
// NFNT2_DENSITY
// NFNT2_DENSITY
// ...
// Image Location Table
// Width/Offset Table
// Bitmap Data 1
// Bitmap Data 2
// ...
// Font Name
// Font Style
typedef struct
{
short density; // 0x48 = lores
ulong bitmap_offset;
} NFNT2_DENSITY;
typedef struct {
short font_type; // 0x9200
short char_first;
short char_last;
short max_width;
short max_kern;
short negated_decent;
short rect_width;
short rect_height;
// actual_offset = 18 + 2 x <width_table_offset>
short width_table_offset;
short max_ascent;
short max_decent;
short leading;
short row_words;
// 1 = PalmNewFontVersion
ushort version;
ushort density_count;
// array of 1 or more records
NFNT2_DENSITY densities[0];
} NFNT2_HEADER;
-Vince
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/