1 #ifdef HAVE_CONFIG_H
2 #include <config.h>
3 #endif
4 
5 #include	"libxfontint.h"
6 
7 static xfont2_client_funcs_rec const *_f;
8 
9 int
client_auth_generation(ClientPtr client)10 client_auth_generation(ClientPtr client)
11 {
12     if (_f)
13 	return _f->client_auth_generation(client);
14     return 0;
15 }
16 
17 Bool
ClientSignal(ClientPtr client)18 ClientSignal(ClientPtr client)
19 {
20     if (_f)
21 	return _f->client_signal(client);
22     return TRUE;
23 }
24 
25 void
DeleteFontClientID(Font id)26 DeleteFontClientID(Font id)
27 {
28     if (_f)
29 	_f->delete_font_client_id(id);
30 }
31 
32 void
ErrorF(const char * f,...)33 ErrorF(const char *f, ...)
34 {
35     if (_f) {
36 	va_list	ap;
37 	va_start(ap, f);
38 	_f->verrorf(f, ap);
39 	va_end(ap);
40     }
41 }
42 
43 FontPtr
find_old_font(FSID id)44 find_old_font(FSID id)
45 {
46     if (_f)
47 	return _f->find_old_font(id);
48     return (FontPtr)NULL;
49 }
50 
51 FontResolutionPtr
GetClientResolutions(int * num)52 GetClientResolutions(int *num)
53 {
54     if (_f)
55 	return _f->get_client_resolutions(num);
56     return (FontResolutionPtr) 0;
57 }
58 
59 int
GetDefaultPointSize(void)60 GetDefaultPointSize(void)
61 {
62     if (_f)
63 	return _f->get_default_point_size();
64     return 12;
65 }
66 
67 Font
GetNewFontClientID(void)68 GetNewFontClientID(void)
69 {
70     if (_f)
71 	return _f->get_new_font_client_id();
72     return (Font)0;
73 }
74 
75 unsigned long
GetTimeInMillis(void)76 GetTimeInMillis (void)
77 {
78     if (_f)
79 	return _f->get_time_in_millis();
80     return 0;
81 }
82 
83 int
init_fs_handlers2(FontPathElementPtr fpe,FontBlockHandlerProcPtr block_handler)84 init_fs_handlers2(FontPathElementPtr fpe,
85                  FontBlockHandlerProcPtr block_handler)
86 {
87     if (_f)
88 	return _f->init_fs_handlers(fpe, block_handler);
89     return Successful;
90 }
91 
92 int
register_fpe_funcs(const xfont2_fpe_funcs_rec * funcs)93 register_fpe_funcs(const xfont2_fpe_funcs_rec *funcs)
94 {
95     if (_f)
96 	return _f->register_fpe_funcs(funcs);
97     return 0;
98 }
99 
100 void
remove_fs_handlers2(FontPathElementPtr fpe,FontBlockHandlerProcPtr blockHandler,Bool all)101 remove_fs_handlers2(FontPathElementPtr fpe,
102 		    FontBlockHandlerProcPtr blockHandler,
103 		    Bool all)
104 {
105     if (_f)
106 	_f->remove_fs_handlers(fpe, blockHandler, all);
107 }
108 
109 void *
__GetServerClient(void)110 __GetServerClient(void)
111 {
112     if (_f)
113 	return _f->get_server_client();
114     return NULL;
115 }
116 
117 int
set_font_authorizations(char ** authorizations,int * authlen,ClientPtr client)118 set_font_authorizations(char **authorizations, int *authlen, ClientPtr client)
119 {
120     if (_f)
121 	return _f->set_font_authorizations(authorizations, authlen, client);
122     return 0;
123 }
124 
125 int
StoreFontClientFont(FontPtr pfont,Font id)126 StoreFontClientFont(FontPtr pfont, Font id)
127 {
128     if (_f)
129 	return _f->store_font_client_font(pfont, id);
130     return 0;
131 }
132 
133 Atom
MakeAtom(const char * string,unsigned len,int makeit)134 MakeAtom(const char *string, unsigned len, int makeit)
135 {
136     if (_f && _f->make_atom)
137 	return _f->make_atom(string, len, makeit);
138     return __libxfont_internal__MakeAtom(string, len, makeit);
139 }
140 
141 int
ValidAtom(Atom atom)142 ValidAtom(Atom atom)
143 {
144     if (_f && _f->valid_atom)
145 	return _f->valid_atom(atom);
146     return __libxfont_internal__ValidAtom(atom);
147 }
148 
149 const char *
NameForAtom(Atom atom)150 NameForAtom(Atom atom)
151 {
152     if (_f && _f->name_for_atom)
153 	return _f->name_for_atom(atom);
154     return __libxfont_internal__NameForAtom(atom);
155 }
156 
157 unsigned long
__GetServerGeneration(void)158 __GetServerGeneration (void)
159 {
160     if (_f)
161 	return _f->get_server_generation();
162     return 1;
163 }
164 
165 
166 int
add_fs_fd(int fd,FontFdHandlerProcPtr handler,void * data)167 add_fs_fd(int fd, FontFdHandlerProcPtr handler, void *data)
168 {
169     if (_f)
170 	return _f->add_fs_fd(fd, handler, data);
171     return 0;
172 }
173 
174 void
remove_fs_fd(int fd)175 remove_fs_fd(int fd)
176 {
177     if (_f)
178 	_f->remove_fs_fd(fd);
179 }
180 
181 void
adjust_fs_wait_for_delay(void * wt,unsigned long newdelay)182 adjust_fs_wait_for_delay(void *wt, unsigned long newdelay)
183 {
184     if (_f)
185 	_f->adjust_fs_wait_for_delay(wt, newdelay);
186 }
187 
188 int
xfont2_init(xfont2_client_funcs_rec const * client_funcs)189 xfont2_init(xfont2_client_funcs_rec const *client_funcs)
190 {
191     _f = client_funcs;
192 
193     ResetFontPrivateIndex();
194 
195     register_fpe_functions();
196 
197     return Successful;
198 }
199