Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.     Copyright 2011 dunkaist <dunkaist@gmail.com>
  3.     Distributed under the terms of the GNU General Public License v3.
  4.     See http://www.gnu.org/licenses/gpl.txt for the full license text.
  5. */
  6.  
  7.  
  8. #include <stdio.h>
  9.  
  10. #define FONT_HEIGHT         9
  11. #define FONT_WIDTH_MONO     5
  12. #define FONT_WIDTH_VAR      7   /* max symbol width */
  13.  
  14.     short int   char_num, row, col;
  15.     char        ch, data;
  16.  
  17.  
  18. int do_symbol(short int font_width)
  19. {
  20.     for(row=FONT_HEIGHT; row; row--)
  21.     {
  22.         data    =   0;
  23.         for(col=0; col<font_width; col++)
  24.         {
  25.             data    |=  getchar()==' '? 0 : 1<<col;
  26.         }
  27.         putchar(data);
  28.         fseek(stdin, 3, SEEK_CUR);
  29.     }
  30.     return 0;
  31. }
  32.  
  33.  
  34. int main()
  35. {
  36.     freopen("char_sp.txt", "rt", stdin);
  37.     freopen("char_sp.mt", "wb", stdout);
  38.  
  39.     for(char_num=256; char_num; char_num--)
  40.     {
  41.         fseek(stdin, 8, SEEK_CUR);
  42.         do_symbol(FONT_WIDTH_MONO);
  43.     }
  44.  
  45.     freopen("char2_sp.txt", "rt", stdin);
  46.     freopen("char2_sp.mt", "wb", stdout);
  47.  
  48.     for(char_num=256; char_num; char_num--)
  49.     {
  50.         fseek(stdin, 6, SEEK_CUR);
  51.         ch  =   getchar();
  52.         putchar(ch==' '? 0x08 : ch-47);
  53.         fseek(stdin, 3, SEEK_CUR);
  54.         do_symbol(FONT_WIDTH_VAR);
  55.     }
  56.     return 0;
  57. }
  58.