Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Xext/xf86bigfont.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,11 @@ XFree86BigfontExtensionInit()
+ (unsigned int) (65536.0 / (RAND_MAX + 1.0) * rand());
/* fprintf(stderr, "signature = 0x%08X\n", signature); */

#ifdef XFONT2
FontShmdescIndex = xfont2_allocate_font_private_index();
#else

@rofl0r rofl0r Nov 15, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since all xfont2 specific functions seem to behave identically, except for the name, i'd add a xfont2_compat.h which looks like

#ifdef XFONT2
#define AllocateFontPrivateIndex xfont2_allocate_font_private_index
...
#endif

that way the ifdefs are in a single place and not littered all over the code.
(one could also use function-like macros)

FontShmdescIndex = AllocateFontPrivateIndex();
#endif

#if !defined(CSRG_BASED) && !defined(__CYGWIN__)
pagesize = SHMLBA;
Expand Down Expand Up @@ -511,7 +515,11 @@ ProcXF86BigfontQueryFont(ClientPtr client)
}
if (pDesc && !badSysCall) {
*(CARD32 *) (pCI + nCharInfos) = signature;
#ifdef XFONT2
if (!xfont2_font_set_private(pFont, FontShmdescIndex, pDesc)) {
#else
if (!FontSetPrivate(pFont, FontShmdescIndex, pDesc)) {
#endif
shmdealloc(pDesc);
return BadAlloc;
}
Expand Down
14 changes: 13 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ DEFAULT_FONT_PATH="${FONTDIR}/misc/,${FONTDIR}/100dpi/,${FONTDIR}/75dpi/"
AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]),
[ FONTPATH="$withval" ],
[ FONTPATH="${DEFAULT_FONT_PATH}" ])
AC_ARG_ENABLE(libXfont2, AS_HELP_STRING([--enable-libXfont2],
[Build with libXfont2 (default: disabled)]),
[XFONT2=$enableval], [XFONT2=no])

dnl Extensions.
AC_ARG_ENABLE(xres, AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
Expand Down Expand Up @@ -319,9 +322,18 @@ XEXT_INC='-I$(top_srcdir)/Xext'
XEXT_LIB='$(top_builddir)/Xext/libXext.la'
XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'

AM_CONDITIONAL(DEBUG, test "x$DEBUGGING" = xyes)

if test "x$XFONT2" = xyes; then
AC_DEFINE(XFONT2, 1, [Build with libXfont2])
XFONT_LIB="xfont2"
else
XFONT_LIB="xfont"
fi

dnl Core modules for most extensions, et al.
REQUIRED_MODULES="[randrproto >= 1.2] renderproto [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto xextproto xproto xtrans xf86bigfontproto [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto inputproto [kbproto >= 1.0.3]"
REQUIRED_LIBS="xfont fontenc"
REQUIRED_LIBS="$XFONT_LIB fontenc"

AM_CONDITIONAL(SCREENSAVER, [test "x$SCREENSAVER" = xyes])
if test "x$SCREENSAVER" = xyes; then
Expand Down
4 changes: 4 additions & 0 deletions dix/dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,11 @@ ProcQueryTextExtents(register ClientPtr client)
return (BadLength);
length--;
}
#ifdef XFONT2
if (!xfont2_query_text_extents(pFont, length, (unsigned char *) &stuff[1], &info))
#else
if (!QueryTextExtents(pFont, length, (unsigned char *) &stuff[1], &info))
#endif
return (BadAlloc);
reply.type = X_Reply;
reply.length = 0;
Expand Down
Loading