Hi again,
I'm currently integrating your GLK12232-25 into a new product and I wanted to be able to load fonts into the display from a microcontroller.
I have been following your PCB Rev 2 manual to construct the font header and after much pain in trial and error I think I have found a typo.
In Table 8 you explain the structure of the font header. You say the number of bytes for each character follows the character offset. Well it would appear that instead of putting in the number of bytes, I need to put in the number of columns I want displayed.
Is this the case? If so is the manual or the firmware wrong? I don't want to hardcode one method and then change it if you are going to fix your firmware.
Thanks
Matt
Downloading Fonts
-
- LCD?
- Posts: 5
- Joined: Mon Feb 13, 2006 7:19 pm
- Location: Brisbane, Australia
-
- LCD Guru
- Posts: 55
- Joined: Tue Apr 12, 2005 2:31 am
Re: Downloading Fonts
You are right, it is the width of the actual character, not the total number of bytes. I've written the routine in C#, I don't know if it is usefull for you, but this is the code which I wrote to construct the font data.matt alder wrote:In Table 8 you explain the structure of the font header. You say the number of bytes for each character follows the character offset. Well it would appear that instead of putting in the number of bytes, I need to put in the number of columns I want displayed.
Is this the case? If so is the manual or the firmware wrong? I don't want to hardcode one method and then change it if you are going to fix your firmware.
Code: Select all
public byte[] Data
{
get
{
const byte cHeaderLength=6;
const byte cPlaceHolder = 0xFF;
byte[] tmpArr;
int ix;
int numbytes;
int count;
int offset;
int chardatalength=0;
// determine total fontdata
for (int i=0;i<fontdata.ArrBitmap.Length;i++)
chardatalength += (int)Math.Ceiling((double)(fontdata.ArrBitmap[i].Width*fontdata.ArrBitmap[i].Height)/8);
// start of fontdata in array
offset = cHeaderLength + fontdata.charcount*3;
// Init array length
tmpArr = new byte[cHeaderLength+chardatalength+fontdata.ArrBitmap.Length*3];
// Fill array header
tmpArr[0] = cPlaceHolder; // placeholder
tmpArr[1] = cPlaceHolder; // placeholder
tmpArr[2] = fontdata.width;
tmpArr[3] = fontdata.height;
tmpArr[4] = (byte)fontdata.firstchar;
tmpArr[5] = (byte)(((byte)fontdata.firstchar)+(fontdata.charcount-1));
// Fill bitmap data
for (int i=0;i<fontdata.ArrBitmap.Length;i++)
{
numbytes = (byte)(Math.Ceiling(((double)(fontdata.ArrBitmap[i].Width * fontdata.ArrBitmap[i].Height))/8));
count = 0;
for (int j=0;j<fontdata.ArrBitmap[i].Width;j++) // X
{
for (int k=0;k<fontdata.ArrBitmap[i].Height;k++) // Y
{
ix = (int)(count/8);
if(fontdata.ArrBitmap[i].GetPixel(j,k).GetBrightness()>(20/100))
{
// tmpArr[ix+offset] = (byte)(tmpArr[ix+offset] + ((byte)(Math.Pow(2,(count % 8)))));
}
else
tmpArr[ix+offset] = (byte)(tmpArr[ix+offset] + ((byte)(Math.Pow(2,(count % 8)))));
count++;
}
}
// Fill header info
tmpArr[6 + (i*3)] = (byte)(offset/256);
tmpArr[6 + (i*3) + 1] = (byte)offset;
tmpArr[6 + (i*3) + 2] = (byte)fontdata.ArrBitmap[i].Width;
offset = offset + numbytes;
}
return tmpArr;
}
}
-
- LCD?
- Posts: 5
- Joined: Mon Feb 13, 2006 7:19 pm
- Location: Brisbane, Australia
Cheers
Thanks very much, I'm not using C# but it is very helpfull
Matt
Matt