pfFont(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfFont(3pf)NAME
pfNewFont, pfGetFontClassType, pfFontCharGSet, pfGetFontCharGSet,
pfFontCharSpacing, pfGetFontCharSpacing, pfFontAttr, pfGetFontAttr,
pfFontVal, pfGetFontVal, pfFontMode, pfGetFontMode - Routines to load
fonts for use in Performer.
FUNCTION SPECIFICATION
#include <Performer/pr.h>
pfFont* pfNewFont(void *arena);
pfType* pfGetFontClassType(void);
void pfFontCharGSet(pfFont* font, int ascii, pfGeoSet* gset);
pfGeoSet* pfGetFontCharGSet(pfFont* font, int ascii);
void pfFontCharSpacing(pfFont* font, int ascii,
pfVec3 spacing);
const pfVec3* pfGetFontCharSpacing(pfFont* font, int ascii);
void pfFontAttr(pfFont* font, int which, void *attr);
void* pfGetFontAttr(pfFont* font, int which);
void pfFontVal(pfFont* font, int which, float val);
float pfGetFontVal(pfFont* font, int which);
void pfFontMode(pfFont* font, int mode, int val);
int pfGetFontMode(pfFont* font, int mode);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfFont is derived from the parent class
pfObject, so each of these member functions of class pfObject are also
directly usable with objects of class pfFont. Casting an object of class
pfFont to an object of class pfObject is taken care of automatically.
This is also true for casts to objects of ancestor classes of class
pfObject.
void pfUserDataSlot(pfObject *obj, int slot, void *data);
void pfUserData(pfObject *obj, void *data);
void* pfGetUserDataSlot(pfObject *obj, int slot);
void* pfGetUserData(pfObject *obj);
int pfGetNumUserData(pfObject *obj);
int pfGetNamedUserDataSlot(const char *name);
const char* pfGetUserDataSlotName(int slot);
int pfGetNumNamedUserDataSlots(void);
Page 1
pfFont(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfFont(3pf)
int pfGetGLHandle(pfObject *obj);
int pfDeleteGLHandle(pfObject *obj);
Since the class pfObject is itself derived from the parent class
pfMemory, objects of class pfFont can also be used with these functions
designed for objects of class pfMemory.
pfType * pfGetType(const void *ptr);
int pfIsOfType(const void *ptr, pfType *type);
int pfIsExactType(const void *ptr, pfType *type);
const char * pfGetTypeName(const void *ptr);
int pfRef(void *ptr);
int pfUnref(void *ptr);
int pfUnrefDelete(void *ptr);
int pfUnrefGetRef(void *ptr);
int pfGetRef(const void *ptr);
int pfCopy(void *dst, void *src);
int pfDelete(void *ptr);
int pfIsFluxed(void *ptr);
int pfCompare(const void *ptr1, const void *ptr2);
void pfPrint(const void *ptr, uint which, uint verbose,
FILE *file);
void * pfGetArena(void *ptr);
DESCRIPTION
The pfFont facility provides the capability to load fonts for 3-D
rendering with the string drawing routines from pfString and pfText. The
basic methodology is the user provides individual GeoSets to be used as
font characters. Likewise, the user provides 3-D spacings for each
character so that Performer can correctly move the 'cursor' or '3-D
origin' after drawing each character. Note that this facility is
completely general and is independent of external font descriptions - see
pfdLoadFont for a description of loading some PostScript Type I fonts
into a pfFont structure.
pfNewFont returns a handle to a new pfFont. arena specifies the malloc
arena out of which the pfFont is allocated or NULL for allocation off the
heap. A NULL pointer is returned to indicate failure. pfFonts can be
deleted with pfDelete.
pfGetFontClassType returns the pfType* for the class pfFont. The pfType*
returned by pfGetFontClassType is the same as the pfType* returned by
invoking pfGetType on any instance of class pfFont. Because OpenGL
Performer allows subclassing of built-in types, when decisions are made
based on the type of an object, it is usually better to use pfIsOfType to
test if an object is of a type derived from a Performer type rather than
to test for strict equality of the pfType*'s.
Page 2
pfFont(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfFont(3pf)
pfFont Definition:
Call pfFontCharGSet to set the pfGeoSet which Performer should use when
drawing the character specified by ascii in a pfString.
pfGetFontCharGSet returns the pfGeoSet currently being used for the
character specified by ascii. Call pfFontCharSpacing to set the 3D
spacing for the character specified by ascii to be the pfVec3 spacing.
This spacing is used to update the cursor position of a pfString after
this character has been drawn. pfGetFontCharSpacing returns a reference
to a pfVec3 specifying the spacing of a given character of a font.
pfFont Attributes:
pfFontAttr sets a particular attribute for a given Performer font, while
pfGetFontAttr will return a particular attribute corresponding to the
which token.
Current valid pfFont Attributes: PFFONT_GSTATE PFFONT_BBOX
PFFONT_SPACING PFFONT_NAME
PFFONT_GSTATE specifies a global pfGeoState to be used for every
character of a pfFont. Note that pfGeoStates bound to GeoSets
representing characters will take precedence over the PFFONT_GSTATE
pfGeoState. A Font has NO pfGeoState by default.
PFFONT_BBOX specifies a bounding box that will enclose every individual
character of a pfFont.
PFFONT_SPACING specifies a global spacing to use to simulate fixed width
fonts. This spacing is used only if the pfFont mode PFFONT_CHAR_SPACING
is set to PFFONT_CHAR_SPACING_FIXED or a spacing is not available (NULL)
for a given character. PFFONT_NAME simply specifies a name associated
with a pfFont.
pfFont Modes:
pfFontMode sets a particular mode for a given Performer font, while
pfGetFontMode will return the current value of the mode corresponding to
the mode token.
Current valid pfFont Modes: PFFONT_CHAR_SPACING PFFONT_NUM_CHARS
PFFONT_CHAR_SPACING specifies whether to use fixed or variable spacings
for all characters of a pfFont. Possible values are
PFFONT_CHAR_SPACING_FIXED and PFFONT_CHAR_SPACING_VARIABLE - the later
being the default.
pfFont Values:
pfFontVal sets a particular value for a given Performer font, while
pfGetFontVal will return the corresponding value associated with the
which token.
Page 3
pfFont(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfFont(3pf)NOTES
See pfText for sample code demonstrating pfFont.
SEE ALSO
pfBox, pfDelete, pfGeoSet, pfGeoState, pfString, pfText, pfdLoadFont
Page 4