Assign a context to a local font server
#include <font_api.h> int PfAssignDllCx( struct _Pf_ctrl * context, fontdll_t dll );
font
This function assigns the dll to the font context, context.
/* A PtHook example. Initializes a client level font server * instance for any application that invokes PtInit(), and has * knowledge of this hook. */ #include <font_api.h> #include <photon/PhProto.h> #include <stdlib.h> #include <unistd.h> static fontdll_t dll; extern struct _Ph_ctrl *_Ph_; static void cleanup_hook(void) { PfAssignDllCx(_Ph_->font, NULL); PfDetachLocalDll(dll); dll = NULL; } int PtHook(void * data) { if(data != NULL) { if((dll = PfAttachLocalDll(NULL, NULL)) == NULL) return(0); else { if(PfAssignDllCx(_Ph_->font, dll) == -1) { PfDetachLocalDll(dll); return(0); } else { if(access("/dev/fontsleuthctrl", F_OK) == 0) if(PfAttachSleuthMonitorDll(dll, -1) == -1) { PfAssignDllCx(_Ph_->font, NULL); PfDetachLocalDll(dll); return(0); } if(atexit(cleanup_hook) != 0) { PfAssignDllCx(_Ph_->font, NULL); PfDetachLocalDll(dll); return(0); } } } } else return(0); return(1); }
Photon
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |
PfAttachCx(), PfAttachDllCx(), PfAttachLocalDll()
Fonts chapter of the Photon Programmer's Guide