Caution: This version of this document is no longer maintained. For the latest documentation, see

PgSetFont(), PgSetFontCx()

Set the text font


void PgSetFont( char const *ff );

void PgSetFontCx( PhGC_t *gc,
                  char const *ff );




These functions set the font for text subsequently drawn with PgDrawText*() or PgDrawString*(). The ff argument is a pointer to a font identifier, which you should create by calling PfGenerateFontName().

If the M1 or M2 global alpha values are set, and an anti-aliased font type is supplied to the function, the resulting text will be blended according to the global alpha values. See the PgSetAlphaBlend() or PgSetAlpha() functions for more information about setting global alpha values.

PgSetFont() works on the current graphics context, while you can specify the graphics context gc for PgSetFontCx().


char font_name[MAX_FONT_TAG];

// Use Helvetica, 12p, Normal:

if (PfGenerateFontName( "Helvetica", 0, 12,
                        font_name ) != NULL) {
   PgSetFont( font_name );

// Use Helvetica, 14p, Bold Italic:

if (PfGenerateFontName( "Helvetica",
                        PF_STYLE_BOLD | PF_STYLE_ITALIC,
                        14, font_name ) != NULL ) {
   PgSetFont( font_name );



Interrupt handler No
Signal handler No
Thread No

See also:

PfGenerateFontName(), PgDrawString*(), PgDrawText*(), PgSetFillColor*(), PgSetFillDither*(), PgSetFillTransPat*(), PgSetUnderline*()

Drawing attributes in the Raw Drawing and Animation chapter of the Photon Programmer's Guide