PfGenerateFontName, PfGenerateFontNameCx
![]() |
![]() |
![]() |
![]() |
PfGenerateFontName(), PfGenerateFontNameCx()
Generate a font name
Synopsis:
#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 );
Arguments:
- context
- A pointer to the font context to use, returned by PfAttachCx() or PfAttachDllCx().
- pkcDescription
- The descriptive name of the font, usually the name provided by the font foundry, e.g. Helvetica.
- kuiFlags
- The attributes to apply to the font. The following bits can be
ORed together:
- PF_STYLE_BOLD
- PF_STYLE_ITALIC
- PF_STYLE_ANTIALIAS
- PF_STYLE_ULINE
- PF_STYLE_DULINE
- 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:
- PfGenerateFontName()
- ph
- PfGenerateFontNameCx()
- font
Description:
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. |
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.
- ESRCH
- Unable to locate font.
Examples:
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().
Classification:
Photon
PfGenerateFontName()
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | No |
| Thread | No |
PfGenerateFontNameCx()
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | No |
| Thread | Yes |
See also:
PfAttach(), PfAttachCx(), PfDecomposeStemToID(), PfDecomposeStemToIDCx(), PfQueryFontInfo(), PfQueryFontInfoCx(), PfQueryFonts(), PfQueryFontsCx()
Fonts chapter of the Photon Programmer's Guide
![]() |
![]() |
![]() |
![]() |

![[Previous]](../prev.gif)
![[Contents]](../contents.gif)
![[Index]](../keyword_index.gif)
![[Next]](../next.gif)

