Example: Fastgraph/Fonts Basics

Example FGFW1 illustrates the use of fgf_load(), fgf_print(), and fgf_justify(). It uses fgf_load() to load a font; it exits if the load operation fails. The first three sets of calls to fgf_justify() and fgf_print() display the string "FG/Fonts" left justified, centered, and right justified at the top of the virtual buffer. The next three sets of calls display the string in these positions centered vertically, and the last three display it in these positions at the bottom of the virtual buffer. Note how the example uses Fastgraph's fg_move() and fg_setcolor() functions to control the position and color of the string.

C/C++ version

C++Builder version

Delphi version

Visual Basic version

In Visual Basic, prefixing the font file name string with the App.Path property makes fgf_load() look for the file in the directory where the application's project (VBP) file resides when running the application from Visual Basic's development environment, or from the directory where the EXE file resides when running the application as an executable. If we don't do this, Visual Basic programs will look in the Visual Basic directory when running from the development environment. The PowerBASIC versions of the Fastgraph/Fonts examples include an AppPath() function that behaves the same way.

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.