Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Faxual II for CA-Clipper - // ripex3.prg http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
//  ripex3.prg
//
//  Faxual II RIP example 3.  This program demonstrates row/column
//  positioning to print out a Fahrenheit/Celsius conversion table.
//
//  Compile with /n /w ($Clip: -nw$)
//

#define SYSFONT "sys20x32.xfb"  // Stock fixed-pitch font
#define OUTFILE "ripex3.tif"    // Output file name

procedure Main
    local hfont
    local i

    // Load the font.

    hfont := FontLoadXFB(SYSFONT)

    if hfont == 0
        ? SYSFONT + ": " + F2ErrorMessage(F2Error())
        quit
    endif

    // Set up row and column units to match the dimensions of this
    // font.  Move the origin down so that row zero will not be cut off
    // at the top of the page.  These functions can be called even when
    // the RIP is not initialized.

    RipRCUnits(1 / FontLineSpacing(hfont), 1 / FontAveWidth(hfont))
    RipOrigin(50, FontAscent(hfont))

    // Create the output file and select the font we just loaded.

    RipBegin(OUTFILE)
    RipFont(hfont)

    // Center the title at the top of the page, then write the four
    // column headers.  NOTE: The stock font uses the IBM PC character
    // set, so we can use graphics (the degree sign) and line-drawing
    // characters that are not available in most fonts.

    RipRCCJust(0, 40, "Fahrenheit/Celsius Conversions")

    for i := 0 to 3
        RipRCLJust(2, 20 * i, "  .F   |  .C   ")
        RipRCLJust(3, 20 * i, "-------+-------")
    next

    // We'll go from 0 to 212 degrees F in four columns of 55.

    for i := 0 to 212
        RipPos(4 + i % 55, 20 * int(i / 55))
        RipWrite(str(i, 6, 1) + " |" + str((i - 32) / 1.8, 6, 1))
    next

    // Write the page out.  Cut it off 1/4" (50 default units) below
    // the bottom of the last line.

    RipEject(RipCutoff() + 50)
    RipEnd()

    // Unload the font.  Not strictly necessary since the program is
    // about to end, but good practice.

    FontUnload(hfont)

    return

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson