Generate a font name
#include <photon/Pf.h> char * PfGenerateFontName( char const * pkcDescription, uint32_t kuiFlags, uint32_t kuiSize, char * pcBuff ); #include <font_api.h> char * PfGenerateFontNameCx( struct _Pf_ctrl *context, char const * pkcDescription, uint32_t kuiFlags, uint32_t kuiSize, char * pcBuff );
PfGenerateFontName() is a convenience function that generates proper font names from the given arguments. PfGenerateFontNameCx() is similar to PfGenerateFontName(), but lets you specify the font context.
PfGenerateFontName() uses a global context, so you must call PhAttach() or PhInit() first to set up the global context. If you don't, your application will crash. |
NULL on failure, pcBuff on success.
PfGenerateFontNameCx(): See the examples for PfConvertFontIDCx() and PfExtentCx().
PfGenerateFontName():
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(), PfExtentTextCx(), PfGlyph(), PfRenderCx() or PfRender().
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | Yes |
PfAttach(), PfAttachCx(), PfDecomposeStemToID(), PfDecomposeStemToIDCx(), PfQueryFontInfo(), PfQueryFontInfoCx(), PfQueryFonts(), PfQueryFontsCx()
Fonts chapter of the Photon Programmer's Guide