Home |
Obtaining a Pointer to PegPresentationManager Determining the Position of an Object Overriding the Message() Method The Vector Font |
The Vector FontFonts created with FontCapture are variable width bitmapped fonts. The disadvantage of bitmapped fonts is that a new font is needed for each point size and style used by the application. RTPEG-32's built-in vector font can be used to create any number and size of bitmapped fonts at run time. They can then be used just like any other fonts. The PegScreen member functions MakeFont() and DeleteFont() can be used to create and delete a bitmapped font from the vector font. The following is an example of using the vector font in an application program. void MyWindow::Draw(void) { BeginDraw(); // create 20 point font, not bold, italic: PegFont * MyFont = Screen()->MakeFont(20, FALSE, TRUE); // use MyFont here to draw text on the screen DrawText(.., MyFont); ... // after the program is done with the font, is should be deleted: Screen()->DeleteFont(MyFont); EndDraw(); } A bitmapped font created at run time can be assigned to any text related object such as a PegTextButton or PegString. However the user must insure that the font has been created before it is assigned to the object, and it must also be deleted after the object has been destroyed.
|