Commit 05a793f5 authored by Keith Packard's avatar Keith Packard Committed by Adam Jackson

dix: Switch to the libXfont2 API (v2)

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.

v2: Use libXfont2 instead of libXfont_2
Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
parent 950ffb8d
......@@ -437,7 +437,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
#ifdef HAS_SHM
if (pDesc && !badSysCall) {
*(CARD32 *) (pCI + nCharInfos) = signature;
if (!FontSetPrivate(pFont, FontShmdescIndex, pDesc)) {
if (!xfont2_font_set_private(pFont, FontShmdescIndex, pDesc)) {
shmdealloc(pDesc);
return BadAlloc;
}
......@@ -721,7 +721,7 @@ XFree86BigfontExtensionInit(void)
+ (unsigned int) (65536.0 / (RAND_MAX + 1.0) * rand());
/* fprintf(stderr, "signature = 0x%08X\n", signature); */
FontShmdescIndex = AllocateFontPrivateIndex();
FontShmdescIndex = xfont2_allocate_font_private_index();
#if !defined(CSRG_BASED) && !defined(__CYGWIN__)
pagesize = SHMLBA;
......
......@@ -833,7 +833,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="xfont2 >= 2.0.0"
LIBXI="xi >= 1.2.99.1"
LIBXTST="xtst >= 1.0.99.2"
LIBPCIACCESS="pciaccess >= 0.12.901"
......
......@@ -108,7 +108,7 @@ int ProcInitialConnection();
#include "windowstr.h"
#include <X11/fonts/fontstruct.h>
#include <X11/fonts/fontutil.h>
#include <X11/fonts/libxfont2.h>
#include "dixfontstr.h"
#include "gcstruct.h"
#include "selection.h"
......@@ -1285,7 +1285,7 @@ ProcQueryTextExtents(ClientPtr client)
return BadLength;
length--;
}
if (!QueryTextExtents(pFont, length, (unsigned char *) &stuff[1], &info))
if (!xfont2_query_text_extents(pFont, length, (unsigned char *) &stuff[1], &info))
return BadAlloc;
reply = (xQueryTextExtentsReply) {
.type = X_Reply,
......
This diff is collapsed.
......@@ -96,7 +96,7 @@ Equipment Corporation.
#include "selection.h"
#include <X11/fonts/font.h>
#include <X11/fonts/fontstruct.h>
#include <X11/fonts/fontutil.h>
#include <X11/fonts/libxfont2.h>
#include "opaque.h"
#include "servermd.h"
#include "hotplug.h"
......@@ -196,7 +196,7 @@ dix_main(int argc, char *argv[], char *envp[])
InitAtoms();
InitEvents();
InitGlyphCaching();
xfont2_init_glyph_caching();
dixResetRegistry();
InitFonts();
InitCallbackManager();
......
......@@ -55,7 +55,7 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
privates = calloc(glamor_font_screen_count, sizeof (glamor_font_t));
if (!privates)
return NULL;
FontSetPrivate(font, glamor_font_private_index, privates);
xfont2_font_set_private(font, glamor_font_private_index, privates);
}
glamor_font = &privates[screen->myNum];
......@@ -201,7 +201,7 @@ glamor_unrealize_font(ScreenPtr screen, FontPtr font)
return TRUE;
free(privates);
FontSetPrivate(font, glamor_font_private_index, NULL);
xfont2_font_set_private(font, glamor_font_private_index, NULL);
return TRUE;
}
......@@ -214,7 +214,7 @@ glamor_font_init(ScreenPtr screen)
return TRUE;
if (glamor_font_generation != serverGeneration) {
glamor_font_private_index = AllocateFontPrivateIndex();
glamor_font_private_index = xfont2_allocate_font_private_index();
if (glamor_font_private_index == -1)
return FALSE;
glamor_font_screen_count = 0;
......
......@@ -46,6 +46,7 @@
#include "dmxlog.h"
#include <X11/fonts/fontstruct.h>
#include <X11/fonts/libxfont2.h>
#include "dixfont.h"
#include "dixstruct.h"
......@@ -447,7 +448,7 @@ dmxRealizeFont(ScreenPtr pScreen, FontPtr pFont)
dmxFontPrivPtr pFontPriv;
if (!(pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex))) {
FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
xfont2_font_set_private(pFont, dmxFontPrivateIndex, NULL);
pFontPriv = malloc(sizeof(dmxFontPrivRec));
if (!pFontPriv)
return FALSE;
......@@ -460,7 +461,7 @@ dmxRealizeFont(ScreenPtr pScreen, FontPtr pFont)
pFontPriv->refcnt = 0;
}
FontSetPrivate(pFont, dmxFontPrivateIndex, (void *) pFontPriv);
xfont2_font_set_private(pFont, dmxFontPrivateIndex, (void *) pFontPriv);
if (dmxScreen->beDisplay) {
if (!dmxBELoadFont(pScreen, pFont))
......@@ -504,7 +505,7 @@ dmxUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
if (!pFontPriv->refcnt) {
MAXSCREENSFREE(pFontPriv->font);
free(pFontPriv);
FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
xfont2_font_set_private(pFont, dmxFontPrivateIndex, NULL);
}
else if (pFontPriv->font[pScreen->myNum]) {
if (dmxScreen->beDisplay)
......@@ -563,7 +564,7 @@ dmxUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
) {
MAXSCREENSFREE(pFontPriv->font);
free(pFontPriv);
FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
xfont2_font_set_private(pFont, dmxFontPrivateIndex, NULL);
}
}
}
......
......@@ -58,6 +58,8 @@
#include "mipointer.h"
#include "micmap.h"
#include <X11/fonts/libxfont2.h>
extern Bool dmxCloseScreen(ScreenPtr pScreen);
static Bool dmxSaveScreen(ScreenPtr pScreen, int what);
......@@ -187,7 +189,7 @@ dmxScreenInit(ScreenPtr pScreen, int argc, char *argv[])
if (dmxGeneration != serverGeneration) {
/* Allocate font private index */
dmxFontPrivateIndex = AllocateFontPrivateIndex();
dmxFontPrivateIndex = xfont2_allocate_font_private_index();
if (dmxFontPrivateIndex == -1)
return FALSE;
......
......@@ -251,7 +251,6 @@ cat > sdksyms.c << EOF
#define _FONTPROTO_H
#include "dixfont.h"
#include "dixfontstr.h"
#include "dixfontstubs.h"
#include "dixgrabs.h"
#include "dixstruct.h"
#include "exevents.h"
......
......@@ -23,6 +23,7 @@ is" without express or implied warranty.
#include "regionstr.h"
#include <X11/fonts/font.h>
#include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
#include "scrnintstr.h"
#include "Xnest.h"
......@@ -42,7 +43,7 @@ xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont)
int i;
const char *name;
FontSetPrivate(pFont, xnestFontPrivateIndex, NULL);
xfont2_font_set_private(pFont, xnestFontPrivateIndex, NULL);
name_atom = MakeAtom("FONT", 4, True);
value_atom = 0L;
......@@ -65,7 +66,7 @@ xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont)
return False;
priv = (void *) malloc(sizeof(xnestPrivFont));
FontSetPrivate(pFont, xnestFontPrivateIndex, priv);
xfont2_font_set_private(pFont, xnestFontPrivateIndex, priv);
xnestFontPriv(pFont)->font_struct = XLoadQueryFont(xnestDisplay, name);
......@@ -82,7 +83,7 @@ xnestUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
if (xnestFontStruct(pFont))
XFreeFont(xnestDisplay, xnestFontStruct(pFont));
free(xnestFontPriv(pFont));
FontSetPrivate(pFont, xnestFontPrivateIndex, NULL);
xfont2_font_set_private(pFont, xnestFontPrivateIndex, NULL);
}
return True;
}
......@@ -26,6 +26,7 @@ is" without express or implied warranty.
#include "servermd.h"
#include "mi.h"
#include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
#include "Xnest.h"
......@@ -72,7 +73,7 @@ InitOutput(ScreenInfo * screen_info, int argc, char *argv[])
break;
}
xnestFontPrivateIndex = AllocateFontPrivateIndex();
xnestFontPrivateIndex = xfont2_allocate_font_private_index();
if (!xnestNumScreens)
xnestNumScreens = 1;
......
......@@ -29,7 +29,6 @@ SOFTWARE.
#include "closure.h"
#include <X11/fonts/fontstruct.h>
#include <X11/fonts/fontproto.h>
#include <X11/fonts/fontutil.h>
#define NullDIXFontProp ((DIXFontPropPtr)0)
......@@ -98,16 +97,11 @@ extern _X_EXPORT void InitFonts(void);
extern _X_EXPORT void FreeFonts(void);
extern _X_EXPORT FontPtr find_old_font(XID /*id */ );
#define GetGlyphs dixGetGlyphs
extern _X_EXPORT void dixGetGlyphs(FontPtr /*font */ ,
unsigned long /*count */ ,
unsigned char * /*chars */ ,
FontEncoding /*fontEncoding */ ,
unsigned long * /*glyphcount */ ,
CharInfoPtr * /*glyphs */ );
extern _X_EXPORT void register_fpe_functions(void);
extern _X_EXPORT void GetGlyphs(FontPtr /*font */ ,
unsigned long /*count */ ,
unsigned char * /*chars */ ,
FontEncoding /*fontEncoding */ ,
unsigned long * /*glyphcount */ ,
CharInfoPtr * /*glyphs */ );
#endif /* DIXFONT_H */
......@@ -27,6 +27,7 @@ SOFTWARE.
#include "servermd.h"
#include "dixfont.h"
#include <X11/fonts/fontstruct.h>
#include <X11/fonts/libxfont2.h>
#include "closure.h"
#include <X11/Xproto.h> /* for xQueryFontReply */
......
#ifndef DIXFONTSTUBS_H
#define DIXFONTSTUBS_H 1
/*
* libXfont stubs replacements
* This header exists solely for the purpose of sdksyms generation;
* source code should #include "dixfonts.h" instead, which pulls in these
* declarations from <X11/fonts/fontproto.h>
*/
extern _X_EXPORT int client_auth_generation(ClientPtr client);
extern _X_EXPORT void DeleteFontClientID(Font id);
extern _X_EXPORT int GetDefaultPointSize(void);
extern _X_EXPORT Font GetNewFontClientID(void);
extern _X_EXPORT int init_fs_handlers(FontPathElementPtr fpe,
BlockHandlerProcPtr block_handler);
extern _X_EXPORT int RegisterFPEFunctions(NameCheckFunc name_func,
InitFpeFunc init_func,
FreeFpeFunc free_func,
ResetFpeFunc reset_func,
OpenFontFunc open_func,
CloseFontFunc close_func,
ListFontsFunc list_func,
StartLfwiFunc start_lfwi_func,
NextLfwiFunc next_lfwi_func,
WakeupFpeFunc wakeup_func,
ClientDiedFunc client_died,
LoadGlyphsFunc load_glyphs,
StartLaFunc start_list_alias_func,
NextLaFunc next_list_alias_func,
SetPathFunc set_path_func);
extern _X_EXPORT void remove_fs_handlers(FontPathElementPtr fpe,
BlockHandlerProcPtr blockHandler,
Bool all);
extern _X_EXPORT int StoreFontClientFont(FontPtr pfont, Font id);
#endif
......@@ -53,7 +53,7 @@ SOFTWARE.
#include <X11/Xproto.h>
#include "misc.h"
#include <X11/fonts/fontstruct.h>
#include <X11/fonts/fontutil.h>
#include <X11/fonts/libxfont2.h>
#include "dixfontstr.h"
#include "gcstruct.h"
#include "windowstr.h"
......@@ -186,13 +186,13 @@ miImageGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int ngly
void *pglyphBase /* start of array of glyphs */
)
{
ExtentInfoRec info; /* used by QueryGlyphExtents() */
ExtentInfoRec info; /* used by xfont2_query_glyph_extents() */
ChangeGCVal gcvals[3];
int oldAlu, oldFS;
unsigned long oldFG;
xRectangle backrect;
QueryGlyphExtents(pGC->font, ppci, (unsigned long) nglyph, &info);
xfont2_query_glyph_extents(pGC->font, ppci, (unsigned long) nglyph, &info);
if (info.overallWidth >= 0) {
backrect.x = x;
......
......@@ -32,7 +32,7 @@
#include <X11/fonts/font.h>
#include "dixfontstr.h"
#include <X11/fonts/fontstruct.h>
#include <X11/fonts/fontutil.h>
#include <X11/fonts/libxfont2.h>
#include "mi.h"
#include "regionstr.h"
#include "globals.h"
......@@ -1249,7 +1249,7 @@ damageDamageChars(DrawablePtr pDrawable,
ExtentInfoRec extents;
BoxRec box;
QueryGlyphExtents(font, charinfo, n, &extents);
xfont2_query_glyph_extents(font, charinfo, n, &extents);
if (imageblt) {
if (extents.overallWidth > extents.overallRight)
extents.overallRight = extents.overallWidth;
......
......@@ -80,7 +80,7 @@ __stdcall unsigned long GetTickCount(void);
#include <X11/Xtrans/Xtrans.h>
#include "input.h"
#include "dixfont.h"
#include <X11/fonts/fontutil.h>
#include <X11/fonts/libxfont2.h>
#include "osdep.h"
#include "extension.h"
#ifdef X_POSIX_C_SOURCE
......@@ -798,7 +798,7 @@ ProcessCommandLine(int argc, char *argv[])
DPMSDisabledSwitch = TRUE;
#endif
else if (strcmp(argv[i], "-deferglyphs") == 0) {
if (++i >= argc || !ParseGlyphCachingMode(argv[i]))
if (++i >= argc || !xfont2_parse_glyph_caching_mode(argv[i]))
UseMsg();
}
else if (strcmp(argv[i], "-f") == 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment