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

PfFractionalRenderText()

Render a string, using fractioanl scaling, via a callback function

Synopsis:

#include <photon/Pf.h>

int PfFractionalRenderText( 
        const char *font, 
        long xsize,
        long ysize,
        const char *str, 
        int len, 
        PhPoint_t const *pos, 
        PhRect_t const *clip,
        void (*func)( const PhPoint_t *,
                      const FontRender *));

Description:

This function renders the given string via a user callback function. The base font is given by font. The xsize and ysize arguments define the size of the font in 16.16 fixed-point format.

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:

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

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