Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2231 → Rev 2232

/programs/other/font_conv/convert.c
1,30 → 1,47
/*
Copyright 2011 dunkaist <dunkaist@gmail.com>
Distributed under the terms of the GNU General Public License v3.
See http://www.gnu.org/licenses/gpl.txt for the full license text.
*/
 
 
#include <stdio.h>
 
int main()
{
const int font_height = 9;
int font_width[2] = {5,7},
char_num,i,e;
#define FONT_HEIGHT 9
#define FONT_WIDTH_MONO 5
#define FONT_WIDTH_VAR 7 /* max symbol width */
 
short int char_num, row, col;
char ch,data;
 
freopen("char.txt","rt",stdin);
freopen("CHAR.MT","wb",stdout);
 
for(char_num=256;char_num;char_num--)
int do_symbol(short int font_width)
{
fseek(stdin,8,SEEK_CUR);
for(e=font_height;e;e--)
for(row=FONT_HEIGHT; row; row--)
{
data = 0;
for(i=0;i<font_width[0];i++)
for(col=0; col<font_width; col++)
{
data |= getchar()==' '?0:1<<i;
data |= getchar()==' '? 0 : 1<<col;
}
putchar(data);
fseek(stdin,3,SEEK_CUR);
putchar(data);
}
return 0;
}
 
 
int main()
{
freopen("char.txt", "rt", stdin);
freopen("CHAR.MT", "wb", stdout);
 
for(char_num=256; char_num; char_num--)
{
fseek(stdin, 8, SEEK_CUR);
do_symbol(FONT_WIDTH_MONO);
}
 
freopen("char2.txt","rt",stdin);
freopen("CHAR2.MT","wb",stdout);
 
34,16 → 51,7
ch = getchar();
putchar(ch==' '?0x08:ch-47);
fseek(stdin,3,SEEK_CUR);
for(e=font_height;e;e--)
{
data = 0;
for(i=0;i<font_width[1];i++)
{
data |= getchar()==' '?0:1<<i;
do_symbol(FONT_WIDTH_VAR);
}
putchar(data);
fseek(stdin,3,SEEK_CUR);
return 0;
}
}
return 0;
}