PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Font print etc.

Hello,
for those who want to create fonts quick ive made program for it :) Its in attachments.
Its simple to use...
1) Start program :)
2) Check its buttons

  • Space/Chars per row - here you can setup space between characters on picture, and character count in 1 row.

  • Font - By clicking on button you can choose all your fonts settings.

  • Color - Here you can choose back color & color of font.

  • Build - By clicking on button program will print picture on form.

3) After you will build simply use Print Screen button or something to get it of the program. Program cannot save pictures atm. After this you can edit it in Photoshop etc. or just let it be like it is now :)


Here is sample code to use it with PocketHAL :)
Code:

void <class name>::Print(int sx, int sy, char* txt)// Start positions for x,y & text you want to print
{
Display* display = GetDisplay();
int x = sx;
int y = sy;
for(int i=0;i<(int)strlen(txt);i++) //We are going to check all characters in "txt"
{
int chr = ((int)txt[i]); //Grab character id
if(chr >= 33 && chr <= 125) //Only for characters existing in our font picture
{
chr-=33; //Remove 33 coz our picture's 1st character is 33
int by = 0; //font picture row
while(chr>=24){by++;chr-=24;} //24 characters in 1 row, so we add row every time when we reach 24. char in row
display->Blit( x, y, <Surface* with your font picture>, &Rect( chr*16, by*16, (chr+1)*16, (by+1)*16 ) ); //16*16pix rect from our font picture
}
else if(chr == 10) //is character "\r" ? then jump to another line
{
y+=16; //we will now paint 16 pixels lower
x=sx-8; //we would like to start from beggining & -8 coz we will add 8 on next line :) funny
}
x+=8; //Spaces between pained characters
}
}
Attachments:
FontBuilder.zip (10 KB)