Re: Common letters in the Alphabet.

1999-12-21 Thread Jay Kulpinski

Simon Wood wrote:
> 
> For ELKSibo I have had to include a font bit map (as I have to draw each
> character to the LCD), this only has a few of the 255 ASCII codes and is the
> form:
> ASCII Value, data, data, data, etc,
> 
> The renderer compares the first byte with it's desired character and moves
> to the next character should they not match.
> 
> I would like to sequence the data so that the most common characters are
> near the start of the list and therefore speed up the display driver
> (believe me every little bit helps).
> 
> Does anyone have letter probability table I could use??? (or any idea how to
> generate one)
> 
> Simon Wood
> 

How about something like this?  The code should be small and fast,
and the data would be bigger only by the number of holes between 
MIN_FONT_CHAR and MAX_FONT_CHAR.




#define MIN_FONT_CHAR 0x20   /* ? */
#define MAX_FONT_CHAR 0x7e   /* ? */
#define N_CHAR (MAX_FONT_CHAR - MIN_FONT_CHAR + 1)
#define UNPRINTABLE N_CHAR
#define BYTES_PER_GLYPH 8/* ? */

static unsigned char lookup_index[N_CHAR] = {
0, 1, UNPRINTABLE, 2, UNPRINTABLE, /* ... */
};
static unsigned char font_data[N_CHAR + 1][BYTES_PER_GLYPH] = {
{0,0,0,0,0,0,0,0},/* data for MIN_FONT_CHAR */
{0,0,0,0,0,0,0,0}, 
{0,0,0,0,0,0,0,0}, 
/* ... */
{0,0,0,0,0,0,0,0},/* data for MAX_FONT_CHAR */
{0,0,0,0,0,0,0,0} /* data for UNPRINTABLE char */
};

unsigned char *get_font_data(unsigned char c) {
if (c < MIN_FONT_CHAR || c > MAX_FONT_CHAR) {
return font_data[UNPRINTABLE];
}
return font_data[lookup_index[c - MIN_FONT_CHAR]];
}



Re: Common letters in the Alphabet.

1999-12-21 Thread Dries van Oosten

Simon Wood wrote:
> 
> For ELKSibo I have had to include a font bit map (as I have to draw each
> character to the LCD), this only has a few of the 255 ASCII codes and is the
> form:
> ASCII Value, data, data, data, etc,
> 
> The renderer compares the first byte with it's desired character and moves
> to the next character should they not match.
> 
> I would like to sequence the data so that the most common characters are
> near the start of the list and therefore speed up the display driver
> (believe me every little bit helps).
> 
> Does anyone have letter probability table I could use??? (or any idea how to
> generate one)

Letter probability is closely related to the letter typed earlier. Maybe
it's an idea to enlarge the size of you fint bit map struct and store
after each character a pointer to the character most likely to follow
it. The probability table could be easily found by simply downloading a
few books in the language of your choice and have a script count letters
and correlations between letters. 
Furthermore I don't quite understand why you choose to step through the
font bit map structure. If you have stored it as an array, isn't it
simpler to simply use the ascii code as a memory index. This would only
require you to place the array at a smart location (for instance at the
beginning of some segment or an integer number of pages from it) so that
you can avoid having to do multiplications when calculating the memory
adress. If you fix it in such a way that each entry in the array is some
power of 2 bytes long, you can calcuted the memory adress from the index
by doing a shift and an add. Correct me if this is a stupid idea, I'm ne
wat this.

> 
> Simon Wood


Dries 




Common letters in the Alphabet.

1999-12-21 Thread Simon Wood

For ELKSibo I have had to include a font bit map (as I have to draw each
character to the LCD), this only has a few of the 255 ASCII codes and is the
form:
ASCII Value, data, data, data, etc,

The renderer compares the first byte with it's desired character and moves
to the next character should they not match.

I would like to sequence the data so that the most common characters are
near the start of the list and therefore speed up the display driver
(believe me every little bit helps). 

Does anyone have letter probability table I could use??? (or any idea how to
generate one)

Simon Wood

Hardware Engineer 
Pace Micro Technology plc
Victoria Road, Saltaire, Shipley
West Yorkshire, BD18 3LF
Tel : +44(0)1274 532000  Fax: +44(0)1274 532029

This E-Mail and any attachments hereto are strictly confidential and
intended solely for the addressee. If you are not the intended addressee
please notify the sender by return and delete the message. You must not
disclose, forward or copy this E-mail or attachments to any third party
without the prior consent of the sender.