FNTTEST.C

/****************************************************************************
    (c) 1984 - 2003 by Scientific Endeavors Corporation.
    All rights reserved.

    This program is a demonstration of the font plotting features.
****************************************************************************/

#include <graphic.h>                           /* Include all needed files */

#if TCQ                                 /* Set stack for Borland (Turbo) C */
extern unsigned _stklen = 0x3000;
#endif

/****************************************************************************
    Main program
****************************************************************************/
void GPC_MAIN(void)
{
    char buffer[80];

    set_time(0);                                        /* Start 1st timer */

    bgnplot(1, 'g', "fntdemo.tkf");              /* GraphiC Initialization */
    startplot(WHITE);
    metricunits(0);                                 /* Plots are in inches */
    rotate(1);                                  /* Plot rotated 90 degrees */
    fillfont(1);                                    /* Enable filled fonts */

    page(6.884f, 9.0f);                      /* Size of page and plot area */

/* The first string is Swiss Bold with each character a different color */
    font(1, "swissbld.fnt", '\310');                       /* Select fonts */
    lmargin(0.1f);                               /* Left margin is .1 inch */
    tmargin(0.0f);                                        /* No top margin */
    linesp(1.1f);                /* Line space is 1.1 * (character height) */
    ctline("\310|2|G|5|r|6|a|8|p|9|h|10|i|11|C |12|F|13|o|14|n|15|t|1|s", .45f);
/* An example of the Simplex fonts */
    font(3, "simplex.fnt", '\310', "simgrma.fnt", '\311',  /* Select fonts */
        "simscr.fnt", '\312');
    color(GREEN);                                 /* Text plotted is green */
    linesp(2.9f);                                        /* Big line space */
    ltline("\310There are many GraphiC fonts:", .2f);
    color(MAGENTA);                             /* Text plotted is magenta */
    linesp(2.2f);
    lmargin(.5f);
    ltline("\310Simplex: QRSTUVW jklmnop 56789", .18f);
    ltline("\310Simplex Greek/Math: \311gdz8@#$~", .18f);
    ltline("\310Simplex Script: \312QRSTUVW jklmnop", .18f);
/* Duplex and Triplex fonts */
    font(3, "duplex.fnt", '\310', "triplex.fnt", '\311',   /* Select fonts */
        "tripital.fnt", '\312');
    ltline("\310Duplex, \311Triplex, \312Triplex Italics,", .18f);
/* Complex fonts */
    font(4, "complex.fnt", '\310', "compital.fnt", '\311', /* Select fonts */
        "comscr.fnt", '\312', "compgrma.fnt", '\313');
    ltline("\310Complex, \311Complex Italics, \312Complex Script,", .18f);
    ltline("\310Complex Greek/Math: \313ab,0E&}", .18f);
/* English Gothic, Microb, and Russian fonts */
    font(3, "engoth.fnt", '\310', "microb.fnt", '\311',    /* Select fonts */
        "russian.fnt", '\312');
    ltline("\310English Gothic, \311Microb, and \312Russian", .18f);
/* Mathematical formulae using Greek/Math fonts*/
    font(2, "complex.fnt", '\310', "compgrma.fnt", '\311');/* Select fonts */
    color(BLUE);                                                   /* Blue */
    lmargin(0.1f);
    linesp(2.9f);
    ltline("\310Complicated formulae are easy:", .2f);
    fbox(1,.05f);                                      /* Box around string */
    ctline("\311w\310[i]]c[ = x[y[\311a]]\310B]0[ + \311 2A\310mv[2]dv", .18f);
    fbox(0,.1f);

/* Widened, skewed, thick, and sizeable characters */
    font(4, "simplex.fnt", '\310', "duplex.fnt", '\311',   /* Select fonts */
        "complex.fnt", '\312', "microb.fnt", '\313');
    color(LGT_GREEN);                                      /* Bright green */
    linesp(2.8f);
    widen(1.5f);                  /* Specify aspect ratio for widened text */
    skew(.3f);                             /* Specify slant of skewed text */
    tfont(4);
    ltline("\311Letters can be ^widened^ , `skewed`", .2f);
    charspc(4);
    ctline("\310and \313#THICKENED#.",.2f);
    charspc(0);
    color(LGT_BLUE);                                        /* Bright blue */
    ltline("\312They can be", .2f);
    linesp(1.5f);
    ctline("\312LARGE", 1.0f);
    linesp(2.9f);
    ctline("\312or they can be small.", .15f);
    endplot();                                 /* GraphiC closing routines */
    sprintf(buffer, "Elapsed time: %s", get_time(0));  /* Get elapsed time */
    GPC_PUTS(buffer);                              /* Display elapsed time */
    stopplot();
}