[Previous] [Contents] [Index] [Next]

PfGenerateFontName(), PfGenerateFontNameCx()

Generate a font name

Synopsis:

char * PfGenerateFontName(
             char const * pkcDescription,
             uint32_t kuiFlags,
             uint32_t kuiSize,
             char * pcBuff );

char * PfGenerateFontNameCx(
             struct _Pf_ctrl *context,
             char const * pkcDescription,
             uint32_t kuiFlags,
             uint32_t kuiSize,
             char * pcBuff );

Arguments:

context
(PfGenerateFontNameCx() only) A pointer to the font context to use, which you can get by calling PfAttach().
pkcDescription
The descriptive name of the font, usually the name provided by the font foundry, e.g. Helvetica, Comic Sans MS.
kuiFlags
The attributes to apply to the font. The following bits can be ORed together:
kuiSize
The requested point size, e.g. 12.
pcBuff
A buffer in which to store the resulting font identifier. This must be of size MAX_FONT_TAG.

Library:

ph

Description:

PfGenerateFontName() and PfGenerateFontNameCx() are convenience functions that generate proper font names from the given arguments.

Returns:

NULL on failure, pcBuff on success.

Errors:

ENOMEM
Not enough memory to proceed with the request.
EFAULT
One of the required parameters is NULL.
EINVAL
The requested size is 0.

Examples:

char szHelvetica12[MAX_FONT_TAG];

if(PfGenerateFontName("Helvetica", PF_STYLE_BOLD,
                      12, szHelvetica12) == NULL) {
   perror("Unable to find font");
} else {
   PfExtentText(&tsExtent, NULL, szHelvetica12,
                "Hello", 0);
}

The szHelvetica12 variable can now be used with any function that takes a "font" pointer, such as PfExtentText(), PfGlyph(), or PfRenderText().

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PfAttach(), PfDecomposeStemToID(), PfQueryFontInfo(), PfQueryFonts()

Fonts chapter of the Photon Programmer's Guide


[Previous] [Contents] [Index] [Next]