home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / program / vdit / vdit.c < prev   
Encoding:
C/C++ Source or Header  |  1988-07-12  |  1.7 KB  |  68 lines

  1. /*
  2.  * Sample program to load fonts, display them. Eric Gisin.
  3.  * try: vdit -f91 fixed8 fixed9 fixed10 fixed11 fixed12
  4.  *
  5.  *    void vstx_load_fonts(short vdi_handle, GFont *fonts);
  6.  *    void vstx_unload_fonts(short vdi_handle);
  7.  *
  8.  * These two undocumented VDI functions are used to add fonts
  9.  * to a virtual screen. Unlike the VDI function vst_load_fonts,
  10.  * which requires GDOS, it does not load the fonts from disk.
  11.  * Instead you load them explicitly with load_fonts (or load_font),
  12.  * and pass the linked list of fonts to vstx_load_fonts as "fonts".
  13.  * To change the fonts in a virtual screen, unload then load again.
  14.  *
  15.  * The fonts must have valid font_id and size information.
  16.  * The font_id is used by vst_font to select a font family.
  17.  */
  18.  
  19. #include <vdi.h>
  20. #include <gfont.h>
  21.  
  22. #define    NULL    0L
  23.  
  24. extern    GFont *load_fonts();
  25.  
  26. main(argc, argv)
  27.     char ** argv;
  28. {
  29.     register int i;
  30.     int font = 1, size = 10;
  31.     short h = 1;
  32.     short in [11];
  33.     short out [57];
  34.  
  35.     /* parse options */
  36.     for (i = 1; i < argc; i ++) {
  37.         register char * arg = argv[i];
  38.         if (arg[0]=='-') {
  39.             if (arg[1]=='f')
  40.             font = atoi(&arg[2]);
  41.             if (arg[1]=='p')
  42.             size = atoi(&arg[2]);
  43.         } else
  44.             break;
  45.     }
  46.         
  47.     /* set up opnvwk parameters */
  48.     in[0] = 1;            /* device is screen */
  49.     in[1] = in[2] = 1;        /* line type/color */
  50.     in[3] = in[4] = 1;        /* marker type/color */
  51.     in[5] = in[6] = 1;        /* text font/color */
  52.     in[7] = in[8] = in[9] = 1;    /* fill type/style/color */
  53.     in[10] = 2;            /* raster coordinates */
  54.  
  55.     v_opnvwk(in, &h, out);
  56.     vstx_load_fonts(h, load_fonts(&argv[i]));
  57.     v_clrwk(h);
  58.     i = vst_font(h, font);
  59.     for (i = 6; i < 25; i += (i<14) ? 1 : 2) {
  60.         vst_point(h, i);
  61.         v_gtext(h, 0, i*16, "A test of load_fonts ?! {123<@>}");
  62.     }
  63.     vstx_unload_fonts(h);
  64.     v_clsvwk(h);
  65.     return 0;
  66. }
  67.  
  68.