PfExtent16dot16Cx()

Calculate the 16.16 fixed point extent rectangle of a text string

Synopsis:

#include <font_api.h>
int PfExtent16dot16Cx( struct _Pf_ctrl *context,
                    pf_rect_16dot16_t *extent,
                    pf_point_16dot16_t const *pos,
                    const char *font,
                    long adata,
                    long bdata,
                    const char *str,
                    int len,
                    int flags,
                    pf_rect_t const *clip );

Arguments:

context
A pointer to the font context to use, returned by PfAttachCx() or PfAttachDllCx().
extent
A pointer to a pf_rect_16dot16_t structure where the function stores the calculated 16.16 fixed poiint extent. The members are:
ul.x_16dot16
the left bearing.
lr.x_16dot16
the maximum x distance.
ul.y_16dot16
the ascender.
lr.y_16dot16
the descender.

pos
A pointer to a pf_point_16dot16_t structure that specifies an offset to apply to the extent. If pos is NULL, no offset is applied.
font
The base font, which you should create by calling PfGenerateFontName().
adata
The horizontal fractional point size, if you set PF_FRACTIONAL in the flags argument.
bdata
The vertical fractional point size, if you set PF_FRACTIONAL in the flags argument.
str
The string whose extent you want to calculate. The string is a UTF-8 multibyte one by default.
len
The length of the string, str, in bytes. If len is 0, the function uses strlen(str).
flags
Flags that affect the behavior of the function. You can set up to one of the following to indicate the format of the string:

If you don't set either of the above, the function assumes that the string is composed of UTF-8 multibyte characters.

You can OR in any of these flags:

clip
A pointer to a pf_rect_t structure that's a suggested clipping rectangle for the font manager to abide by.

Library:

PfExtentCx()
font

Description:

This function calculates the 16.16 fixed point extent rectangle of a text string. The 16.16 fixed point return value describes the extent with much greater accuracy than the extent pixel values. The base font determines the ascender and descender values of the extent. The width depends on the string; the actual font used by characters within the string may differ from this base font (as specified in the fontext and fontmap files).

The difference between PfExtent16dot16() and PfExtent16dot16Cx() is that PfExtent16dot16Cx() lets you specify the font context to use.

The PfExtent16dot16() and PfExtent16dot16Cx() functions never load metrics locally. A message is always sent to the server.

The generic design of this routine allows for future expansion.

Returns:

If you set PF_RECT in the flags argument, PfExtent16dot16() and PfExtent16dot16Cx() return the number of characters that fit within the rectangle specified by clip, or -1 if an error occurred.

If you don't set PF_RECT in the flags argument, these functions return 0 on success, or -1 if an error occurred.

Classification:

Photon

PfExtent16dot16Cx()

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

PfAttach(), PfAttachCx(), PfDetach(), PfDetachCx(), PfExtentComponents(), PfExtentComponentsCx(), PfExtentFractTextCharPositions(), PfExtentText(), PfExtentTextCharPositions(), PfExtentTextCharPositionsCx(), PfExtentTextToRect(), PfExtentWideText(), PfFractionalExtentText(), PfGenerateFontName(), PfGenerateFontNameCx(), PfLoadMetrics(), PfLoadMetricsCx(), PhPoint_t, PhRect_t