TypeServer can operate with TrueType fonts stored either in a disk file, or that are preloaded
into memory or ROM(1).
A separate constructor is provided for each case.
The open-file constructor opens a TrueType font stored on disk, and the open-memory
constructor opens a TrueType font that resides in memory
or ROM. Here is an example of how to open a TrueType font file:
tsCServer *myServer=NULL; // pointer to a TypeServer instance
tsCFont *myTTFont=NULL; // pointer to a TrueType font instance
// create a TypeServer instance
myServer = new tsCServer();
// open a TrueType font file
myTTFont = new tsCFont( myServer, "arial.ttf", 0, 0 );
if ( (myServer == NULL) || (myTTFont == NULL) )
{ /* handle error condition */ } |
That's all there is to opening a TrueType font.
Upon return, the font pointer references the new font instance
that is used when calling other TypeServer funtions.
TypeServer can have multiple fonts open at the same time if your application
needs to display text that combines multiple fonts or typefaces.
For example, Arial normal, Arial-Bold, Times-Roman and Symbol
TrueType fonts could all be opened for processing.
Any number of fonts can be open at one time
if your application requires mixed rendering of multiple fonts.
next»
NOTES: |
1 - |
The TypeServer Developer Kit includes "TypeEmbedder", a utility program that allows you
to convert TrueType font files (.ttf) into C header files (.h) that can be compiled directly with your
program or stored into ROM. |
2 - |
The third and fourth arguments in the
tsCFont() open-file constructor
are the fileOffset
and fontNumber parameters, respectively.
fileOffset is used if the TrueType font
is embedded within a larger resource file, and specifies a byte offset
to where the TrueType font actually begins within the file.
fontNumber specifies the font number
if the TrueType file is a "collection" containing more than one font.
These paramenters are used infrequently and are normally set to zero
(but they're there if you need them). |
Home |
Products |
Order |
Register |
Support |
Company |
Contact |
Feedback
Copyright © 1999-2001 - Metagraphics Software Corporation.
|