Render a string via a callback function
#include <photon/Pf.h> int PfRenderText( const char *font, const char *str, int len, PhPoint_t const *pos, PhRect_t const *clip, void (*func)( const PhPoint_t *, const FontRender *));
This function renders the given string via a user callback function. The base font is given by font. The actual fonts used by the string depend on the characters in it and the information in the fontext and fontmap files. The string str is a Unicode, multibyte string of len bytes. If len is 0, strlen(str) is assumed.
The text is to be rendered at the location specified by pos, and clipped to the rectangle specified by clip. If clip is NULL, it's ignored. The font server performs coarse character clipping only.
When a request to construct the bitmap is sent to the font server, the string bitmap is returned, for efficiency, in the shared-memory region created through the initial call to PfAttach().
This function is normally used only by graphics drivers, but may be useful for application programs that have to obtain text bitmap data directly.
The user callback function func() is called with the desired pen location and the metrics of the bitmap. If the entire bitmap doesn't fit in the allocated memory, multiple calls to the font server and the user function can be made, advancing the pen as appropriate between calls.
The FontRender metrics structure contains at least the following members:
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |