Hi,
Im trying to get my characters to show up as 6x8 pixels,
heres the code:
So far i have managed to get it to show the character as 6x8 but theres no space between them and iv tried changing the code to get a spacing but it just messes up the characters.
changing this part,
to this,
gives me 6x8 charcters but no spaces.
Can anyone steer me in the right direction
Im trying to get my characters to show up as 6x8 pixels,
heres the code:
So far i have managed to get it to show the character as 6x8 but theres no space between them and iv tried changing the code to get a spacing but it just messes up the characters.
Code:
/*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*/
changing this part,
Code:
/* character is made up of 5*8 pixels, get all columns into temporary memory */
for (count = 0; count < 5; count++) //Use correct buffer location
to this,
Code:
/* character is made up of 5*8 pixels, get all columns into temporary memory */
for (count = 0; count < 6; count++) //Use correct buffer location
gives me 6x8 charcters but no spaces.
Can anyone steer me in the right direction