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

PfRenderWideText()

Render a wide-character string via a callback function

Synopsis:

#include <photon/Pf.h>

int PfRenderWideText( 
        const char *font, 
        const uint16_t *str, 
        int len, 
        PhPoint_t const *pos, 
        PhRect_t const *clip,
        void (*func)( const PhPoint_t *,
                      const FontRender *));

Arguments:

font
The name of the base font. Create this name by calling PfGenerateFontName(). The actual fonts used by the string depend on the characters in it and the information in the fontext and fontmap files.
str
The wide-character string to render.
len
The length of the string, in bytes. If len is 0, strlen(str) is assumed.
pos
A pointer to a PhPoint_t structure that specifies where to render the string.
clip
A pointer to a PhRect_t structure that specifies the rectangle to which to clip the text. If clip is NULL, it's ignored. The font server performs coarse character clipping only.
func
The user callback function that does the actual rendering. It's called with the desired pen location and the metrics of the bitmap (see below). 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.

Library:

ph

Description:

This function renders the given wide-character string via a user callback function.


Note: This function assumes each character is represented by 2 bytes that conform to the ISO/IEC 10646-1 UCS-2 double-byte format.

When a request to construct the bitmap is sent to the font server, the string bitmap is returned, for efficiency, in the shared-memory area 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 FontRender metrics structure contains at least the following members:

PhPoint_t size
The bounding size of the bitmap (in pixels).
PhPoint_t offset
The offset of the bitmap (the upper-left of the extent).
int width
The width of the bitmap.
short bpl
The number of bytes per line.
short bpp
The number of bits per pixel (1 for normal output, 4 for anti-aliased).
unsigned char *bmptr
A pointer to the bitmap data (stored row-wise).

Returns:

0
Success.
-1
An error occurred; the value of errno is set appropriately.

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PfExtentWideText(), PfFractionalRenderText() PfRenderCtx(), PfRenderCx(), PfRenderText(), PfGenerateFontName(), PfWideTextWidthBytes(), PfWideTextWidthChars(), PhPoint_t, PhRect_t

Fonts chapter of the Photon Programmer's Guide


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