[PATCH] Switch to the libXfont_2 API.
Keith Packard
keithp at keithp.com
Wed Sep 2 00:22:54 PDT 2015
This new libXfont API eliminates exposing internal X server symbols to
the font library, replacing those with a struct full of the entire API
needed to use that library.
Signed-off-by: Keith Packard <keithp at keithp.com>
---
configure.ac | 2 +-
dix/dixfonts.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++--------
2 files changed, 59 insertions(+), 10 deletions(-)
diff --git a/configure.ac b/configure.ac
index 1f39331..446938a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -794,7 +794,7 @@ LIBEGL="egl"
LIBGBM="gbm >= 10.2.0"
LIBGL="gl >= 7.1.0"
LIBXEXT="xext >= 1.0.99.4"
-LIBXFONT="xfont >= 1.4.2"
+LIBXFONT="xfont_2 >= 2.0.0"
LIBXI="xi >= 1.2.99.1"
LIBXTST="xtst >= 1.0.99.2"
LIBPCIACCESS="pciaccess >= 0.12.901"
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 300bf04..dfa72e2 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1804,22 +1804,78 @@ DeleteClientFontStuff(ClientPtr client)
}
}
+#include <X11/fonts/libxfont.h>
+
+static int
+register_fpe_funcs(const font_fpe_funcs_rec *funcs)
+{
+ return RegisterFPEFunctions(funcs->name_func,
+ funcs->init_func,
+ funcs->free_func,
+ funcs->reset_func,
+ funcs->open_func,
+ funcs->close_func,
+ funcs->list_func,
+ funcs->start_lfwi_func,
+ funcs->next_lfwi_func,
+ funcs->wakeup_func,
+ funcs->client_died,
+ funcs->load_glyphs,
+ funcs->start_list_alias_func,
+ funcs->next_list_alias_func,
+ funcs->set_path_func);
+}
+
+static unsigned long
+get_server_generation(void)
+{
+ return serverGeneration;
+}
+
+static void *
+get_server_client(void)
+{
+ return serverClient;
+}
+
+static const font_client_funcs_rec font_client_funcs = {
+ .version = FONT_CLIENT_FUNCS_VERSION,
+ .client_auth_generation = client_auth_generation,
+ .client_signal = ClientSignal,
+ .delete_font_client_id = DeleteFontClientID,
+ .verrorf = VErrorF,
+ .find_old_font = find_old_font,
+ .get_client_resolutions = GetClientResolutions,
+ .get_default_point_size = GetDefaultPointSize,
+ .get_new_font_client_id = GetNewFontClientID,
+ .get_time_in_millis = GetTimeInMillis,
+ .init_fs_handlers = init_fs_handlers,
+ .register_fpe_funcs = register_fpe_funcs,
+ .remove_fs_handlers = remove_fs_handlers,
+ .get_server_client = get_server_client,
+ .set_font_authorizations = set_font_authorizations,
+ .store_font_client_font = StoreFontClientFont,
+ .make_atom = MakeAtom,
+ .valid_atom = ValidAtom,
+ .name_for_atom = NameForAtom,
+ .get_server_generation = get_server_generation,
+};
+
void
InitFonts(void)
{
patternCache = MakeFontPatternCache();
+ font_register_client_funcs(&font_client_funcs);
register_fpe_functions();
}
-_X_EXPORT
int
GetDefaultPointSize(void)
{
return 120;
}
-_X_EXPORT
FontResolutionPtr
GetClientResolutions(int *num)
{
@@ -1852,7 +1908,6 @@ GetClientResolutions(int *num)
* should be called (only once!) by each type of fpe when initialized
*/
-_X_EXPORT
int
RegisterFPEFunctions(NameCheckFunc name_func,
InitFpeFunc init_func,
@@ -1923,28 +1978,24 @@ find_old_font(XID id)
return (FontPtr) pFont;
}
-_X_EXPORT
Font
GetNewFontClientID(void)
{
return FakeClientID(0);
}
-_X_EXPORT
int
StoreFontClientFont(FontPtr pfont, Font id)
{
return AddResource(id, RT_NONE, (void *) pfont);
}
-_X_EXPORT
void
DeleteFontClientID(Font id)
{
FreeResource(id, RT_NONE);
}
-_X_EXPORT
int
client_auth_generation(ClientPtr client)
{
@@ -1954,7 +2005,6 @@ client_auth_generation(ClientPtr client)
static int fs_handlers_installed = 0;
static unsigned int last_server_gen;
-_X_EXPORT
int
init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler)
{
@@ -1973,7 +2023,6 @@ init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler)
return Successful;
}
-_X_EXPORT
void
remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler,
Bool all)
--
2.5.0
More information about the xorg-devel
mailing list