Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

PfAttach(), PfAttachCx()

Attach to a font server

Synopsis:

#include <photon/Pf.h>
struct _Pf_ctrl *PfAttach( const char *device,
                           long size );

#include <font_api.h>
struct _Pf_ctrl* PfAttachCx( const char *device,
                             long  size );

Arguments:

device
The prefix name of the server; if this argument is NULL, the prefix is the value in the PHFONT environment variable, or /dev/phfont if this isn't set.
size
The size of an area in shared memory to set up between the task and the server for returning text bitmaps (normally required only by graphics drivers). The value determines the type of buffer the function creates:
0
no buffer
<0
allocate a heap buffer
-1
allocate a heap buffer using the value from the environment variable PHFONTMEM
>0
allocate a shared memory buffer

Library:

PfAttach()
ph
PfAttachCx()
font

Description:

These functions attach to the font server.

PhAttach() calls PfAttach() as part of the standard Photon initialization sequence. The font library automatically invokes PfAttach() when the library detects that the font server has been restarted. The font control structure pointer is stored in the global Photon control structure.

If you simply want to override the default font context, you can set the two environment variables (PHFONT and PHFONTMEM) to new values before performing standard Photon initialization, instead of calling this function directly.

If you want to use multiple font contexts, open them with PfAttachCx(), and then use the Cx versions of the font functions. PfAttachCx() allocates and returns a font context, and requests a font server connection. You need the font context returned by PfAttachCx() or PfAttachDllCx() to pass as the first argument to other font library Cx functions.

To detach from the font server, call the corresponding function PfDetach() or PfDetachCx().

Returns:

A pointer to an internal control structure if successful; NULL otherwise.

Examples:

PfAttachCx(): See the examples for PfConvertFontIDCx() and PfRenderCx().

Classification:

Photon

PfAttach()

Safety:
Interrupt handler No
Signal handler No
Thread No

PfAttachCx()

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

PfAttachDllCx(), PfAttachLocalDll(), PfDetach(), PfDetachCx(), PfExtentCx(), PfExtentTextCharPositionsCx(), PfGenerateFontNameCx(), PfGetOutlineCx(), PfRenderCx()

Fonts chapter of the Photon Programmer's Guide