I need a bit of help with some code modification, im trying to add in an extra column to get 6x8 characters.
heres the code im working with
Code: Select all
/*Macro_LCD_Print_String_Start*/
char xwidth, xpix, ypix, pos_Str, count, xcount, ycount, height, width, i;
char Fontwidth = 1; //First we assume small font
char Fontheight = 1;
char inv_colour = 1;
char temp[6];
temp[5] = 0x00; //Spacing Line
if (Colour)
inv_colour = 0;
if (Font == 1) //Double Height Sizes //Double Width
{
Fontwidth = 2;
}
if (Font == 2) //Double Height and Width Sizes
{
Fontwidth = 2;
Fontheight = 2;
}
if (Font == 3) //Double Height Sizes
{
Fontheight = 2;
}
xcount = 0;
for (i=0;i<MSZ_String;i++) //Start at beginning of string and work along
{
if (String[i] == 0)
return;
pos_Str = String[i] - 32; //Calculate place in ASCII memory
/* character is made up of 5*8 pixels, get all columns into temporary memory */
for (count = 0; count < 5; count++) //Use correct buffer location
{
if (pos_Str < 12)
{
temp[count]=ASCII1[(pos_Str*5)+count];
}
else if (pos_Str < 24)
{
temp[count]=ASCII2[((pos_Str - 12)*5)+count];
}
else if (pos_Str < 36)
{
temp[count]=ASCII3[((pos_Str - 24)*5)+count];
}
else if (pos_Str < 48)
{
temp[count]=ASCII4[((pos_Str - 36)*5)+count];
}
else if (pos_Str < 60)
{
temp[count]=ASCII5[((pos_Str - 48)*5)+count];
}
else if (pos_Str < 72)
{
temp[count]=ASCII6[((pos_Str - 60)*5)+count];
}
else if (pos_Str < 84)
{
temp[count]=ASCII7[((pos_Str - 72)*5)+count];
}
else if (pos_Str < 96)
{
temp[count]=ASCII8[((pos_Str - 84)*5)+count];
}
else if (pos_Str < 108)
{
temp[count]=ASCII9[((pos_Str - 96)*5)+count]; // this is for custom ASCII
}
}
if (String[i] > 126)
xwidth=5;
else if (String[i] == 32)
xwidth=4; // width of space
else
// xwidth=6;
{
for (count=4,xwidth=6;count>0 && temp[count]==0;count--) //counts the 0 in last column
{ // normal font width with 1 space line 5+1
xwidth--; // remove spaces
}
}
/* now working across columns of temporary memory */
for (xpix=0; xpix<xwidth; xpix++) //For 6 ASCII bytes 0 - 5
{
for (width=0;width<Fontwidth;width++)
{
ycount = 0;
for (ypix=0;ypix<8;ypix++) //For 8 data bits in bytes 0 - 7
{
for (height=0;height<Fontheight;height++)
{
if (test_bit(temp[xpix],ypix))
{
LCD_PlotPixel(X + xcount, Y + ycount, Colour);
}
else if (Transparent == 0)
{
LCD_PlotPixel(X+xcount, Y+ycount, inv_colour);
}
ycount++;
}
}
xcount++;
}
}
}
//LCD_Write_Screen(); //Needs to refresh whole display
/*Macro_LCD_Print_String_End*/
if i do manage to get it to display a 6th column then i have no spaces in between the characters.
Does anyone know how to do this correctly??