PfAttachDllCx()

Attach to a local font server

Synopsis:

#include <font_api.h>

struct _Pf_ctrl* PfAttachDllCx( fontdll_t dll,
                                long size );

Arguments:

dll
An opaque structure that describes a local font server DLL, returned by PfAttachLocalDll().
size
The size of render buffer allocated (the area in memory used by the font server to return rendered bitmaps). The value determines the type of buffer allocated:

Library:

font

Description:

This routine allocates a font context structure, and connects to the local font server referred to by dll.

Returns:

Font context
Success
NULL
Failure

Errors:

ENOMEM
Insufficient resources
EACCES
shm_open() error.
EEXIST
shm_open() error.
EINTR
shm_open() error.
ELOOP
shm_open() error.
EMFILE
shm_open() error.
ENAMETOOLONG
shm_open() error.
ENFILE
shm_open() error.
ENOENT
shm_open() error.
ENOSPC
shm_open() error.
ENOSYS
shm_open() error.
EBADF
ftruncate() error.
EFBIG
ftruncate() error.
EINTR
ftruncate() error.
EINVAL
ftruncate() error.
EIO
ftruncate() error.
ENOSYS
ftruncate() error.
ENOTSUP
ftruncate() error.
EROFS
ftruncate() error.
EACCES
mmap() error.
EBADF
mmap() error.
EINVAL
mmap() error.
ENODEV
mmap() error.
ENOMEM
mmap() error.
ENXIO
mmap() error.
ENOTSUP
Platform does not support this operation.

Examples:

#include <font_api.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char const * argv[])
{  fontdll_t dll;

   if((dll = PfAttachLocalDll(NULL, NULL)) != NULL)
   {  struct _Pf_ctrl * pf;

      if((pf = PfAttachDllCx(dll, 0)) != NULL)
      {  if(PfAllocRenderCx(pf, 32000) == 0)
         {  char const * name;
            long size = 0L;

            if(PfAllocDetailsCx(pf, &name, &size) == 0)
            {  if(name != NULL)
                 printf("shmem name %s, size %ld bytes.\n", name, size);
               else
                 printf("heap buffer size %d bytes.\n", abs(size));
            }
         }

         PfDetachCx(pf);
      }

      if((pf = PfAttachDllCx(dll, 0)) != NULL)
      {  if(PfAllocRenderCx(pf, -32000) == 0)
         {  char const * name;
            long size = 0L;

            if(PfAllocDetailsCx(pf, &name, &size) == 0)
            {  if(name != NULL)
                 printf("shmem name %s, size %ld bytes.\n", name, size);
               else
                 printf("heap buffer size %d bytes.\n", abs(size));
            }
         }

         PfDetachCx(pf);
      }

      PfDetachLocalDll(dll);
   }

   return(0);
}

Classification:

Photon

Safety:
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes

See also:

PfAttachLocalDll()

Fonts chapter of the Photon Programmer's Guide