![]() |
![]() |
![]() |
![]() |
Calculate the extent rectangle of a text string
int PfExtent( PhRect_t *extent, PhPoint_t const *pos, const char *font, long adata, long bdata, const char *str, int len, int flags, PhRect_t const *clip ); int PfExtentCx( struct _Pf_ctrl *context, PhRect_t *extent, PhPoint_t const *pos, const char *font, long adata, long bdata, const char *str, int len, int flags, PhRect_t const *clip );
The baseline of the font is at position y=0; the width of the string is:
lr.x - min(ul.x, 0) + 1
You can set up to one of the following to indicate the format of the string:
![]() |
Although this flag allows for 32-bit wide characters, the underlying font system currently supports only characters up to Unicode U+FFFE. |
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:
ph
These functions calculate the extent rectangle of a text string. 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 be different than this base font (as specified in the fontext and fontmap files).
The difference between PfExtent() and PfExtentCx() is that PfExtentCx() lets you specify the font context to use.
If metrics for the base font have been loaded locally (see PfLoadMetrics()), the extent are calculated internally; otherwise a request is sent to the font server.
The generic design of these routines allows for future expansion.
If you set PF_RECT in the flags argument, PfExtent() and PfExtentCx() 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.
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
PfAttach(), PfDetach(), PfExtentComponents(), PfExtentFractTextCharPositions(), PfExtentText(), PfExtentTextCharPositions(), PfExtentTextToRect(), PfExtentWideText(), PfFractionalExtentText(), PfGenerateFontName(), PfLoadMetrics(), PhPoint_t, PhRect_t
![]() |
![]() |
![]() |
![]() |