PfExtentComponents(), PfExtentComponentsCx()

Calculate the extent of a text string and invoke a callback

Synopsis:

#include <photon/Pf.h>
PhRect_t *PfExtentComponents(
              PhRect_t *extent,
              PhPoint_t const *pos,
              const char *font,
              const char *str,
              int len,
              void (*func)(PhRect_t *,
                           const char *,
                           const char *, int) );

#include <font_api.h>
pf_rect_t* PfExtentComponentsCx(
          struct _Pf_ctrl *context,
          pf_rect_t *extent,
          pf_point_t const *pos,
          const char *font,
          const char *string,
          int len,
          void(*func)
              (pf_rect_t const *,
               const char *,
               const char *,
               int) );

Arguments:

context
(PfExtentComponentsCx() only) A pointer to the font context to use, returned by PfAttachCx() or PfAttachDllCx().
extent
A pointer to a PhRect_t structure where the function stores the string's extent. For the interpretation of the members of this structure, see PfExtentText().
pos
NULL, or a pointer to a PhPoint_t structure that defines an offset that you want to apply to the extent.
font
The base font to use when calculating the extent. You should create this argument by calling PfGenerateFontName() or PfGenerateFontNameCx().
str
The UTF-8 multibyte string whose extent you want to determine.
len
The number of bytes in the string. If len is 0, the function assumes that it's strlen(str).
func
A function that you want to call for each component of the string.

The callback function is passed an extent rectangle, the filename of the font required, and the string and length of the character run.

Library:

PfExtentComponents()
ph
PfExtentComponentsCx()
font

Description:

These functions calculate the extent of a text string as per PfExtentText(), and also invoke a user callback function func for each component of the string (a run of characters sourced from a single font).

This facility is used by phrelay (see the QNX Neutrino Utilities Reference) to determine which font files have to be downloaded to the remote system in order to correctly render a string.

Classification:

Photon

PfExtentComponents()

Safety:
Interrupt handler No
Signal handler No
Thread No

PfExtentComponentsCx()

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

PfExtent(), PfExtentCx(), PfExtentText(), PfExtentTextToRect(), PfGenerateFontName(), PfGenerateFontNameCx(), PhPoint_t, PhRect_t

Fonts chapter of the Photon Programmer's Guide