Unverified Commit cc24d8ba authored by Mihai Moldovan's avatar Mihai Moldovan

Merge branch 'sunweaver-pr/switch-to-libXfont2-API' into 3.6.x

parents 9e2588e5 c4c54854
...@@ -19,6 +19,10 @@ USRLIBDIR ?= $(NXLIBDIR)/X11 ...@@ -19,6 +19,10 @@ USRLIBDIR ?= $(NXLIBDIR)/X11
INCLUDEDIR ?= $(PREFIX)/include INCLUDEDIR ?= $(PREFIX)/include
CONFIGURE ?= ./configure CONFIGURE ?= ./configure
# use Xfont2 if available in the build env
FONT_DEFINES ?= $(shell pkg-config --modversion xfont2 1>/dev/null 2>/dev/null && echo "-DHAS_XFONT2")
XFONTLIB ?= $(shell pkg-config --modversion xfont2 1>/dev/null 2>/dev/null && echo "-lXfont2" || echo "-lXfont")
NX_VERSION_MAJOR=$(shell ./version.sh 1) NX_VERSION_MAJOR=$(shell ./version.sh 1)
NX_VERSION_MINOR=$(shell ./version.sh 2) NX_VERSION_MINOR=$(shell ./version.sh 2)
NX_VERSION_MICRO=$(shell ./version.sh 3) NX_VERSION_MICRO=$(shell ./version.sh 3)
...@@ -75,7 +79,8 @@ build-full: ...@@ -75,7 +79,8 @@ build-full:
cd nxcompshad && autoconf && (${CONFIGURE}) && ${MAKE} cd nxcompshad && autoconf && (${CONFIGURE}) && ${MAKE}
./mesa-quilt push -a ./mesa-quilt push -a
cd nx-X11 && ${MAKE} World USRLIBDIR=$(USRLIBDIR) SHLIBDIR=$(SHLIBDIR)
cd nx-X11 && ${MAKE} World USRLIBDIR=$(USRLIBDIR) SHLIBDIR=$(SHLIBDIR) FONT_DEFINES=$(FONT_DEFINES) XFONTLIB=$(XFONTLIB)
cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE} cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE}
......
...@@ -15,7 +15,7 @@ Build-Depends: ...@@ -15,7 +15,7 @@ Build-Depends:
libxmltok1-dev, libxmltok1-dev,
libxml2-dev, libxml2-dev,
libxpm-dev, libxpm-dev,
libxfont1-dev | libxfont-dev (>= 1.4.2), libxfont-dev (>= 1.4.2),
libxdmcp-dev, libxdmcp-dev,
libxdamage-dev, libxdamage-dev,
libxext-dev, libxext-dev,
......
...@@ -564,6 +564,9 @@ X_BYTE_ORDER = ByteOrder ...@@ -564,6 +564,9 @@ X_BYTE_ORDER = ByteOrder
#ifndef HasFfs #ifndef HasFfs
#define HasFfs YES #define HasFfs YES
#endif #endif
#ifndef HasXfont2
#define HasXfont2 NO
#endif
#ifndef GzipLibrary /* if OS config didn't define it, assume it's -lz */ #ifndef GzipLibrary /* if OS config didn't define it, assume it's -lz */
#define GzipLibrary -lz #define GzipLibrary -lz
#endif #endif
......
...@@ -70,3 +70,11 @@ GLX_DEFINES = GlxDefines ...@@ -70,3 +70,11 @@ GLX_DEFINES = GlxDefines
#ifdef XorgVersion #ifdef XorgVersion
#include <xorg.tmpl> #include <xorg.tmpl>
#endif #endif
#if HasXfont2
FONT_DEFINES = -DHAS_XFONT2
XFONTLIB = -lXfont2
#else
FONT_DEFINES =
XFONTLIB = -lXfont
#endif
...@@ -390,6 +390,12 @@ ...@@ -390,6 +390,12 @@
#define BuildXKBlib YES #define BuildXKBlib YES
/* /*
* If you want to build against libXfont2, rather than libXfont(1), uncomment this.
*
#define HasXfont2 YES
*/
/*
* If you are running NetBSD 0.9C or later, and have the aperture driver * If you are running NetBSD 0.9C or later, and have the aperture driver
* installed, uncomment this. * installed, uncomment this.
* *
......
...@@ -424,6 +424,10 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8 ...@@ -424,6 +424,10 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8
# define BuildXKBlib YES # define BuildXKBlib YES
#endif #endif
#ifndef HasXfont2
# define HasXfont2 NO
#endif
#ifndef BuildScreenSaverExt #ifndef BuildScreenSaverExt
# define BuildScreenSaverExt YES # define BuildScreenSaverExt YES
#endif #endif
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
* Server Master Makefile * Server Master Makefile
*/ */
NULL =
#include <Server.tmpl> #include <Server.tmpl>
/* On most systems the linker requires the libraries in dependency order. /* On most systems the linker requires the libraries in dependency order.
...@@ -216,14 +218,17 @@ NX_XCOMP_HEADERS = \ ...@@ -216,14 +218,17 @@ NX_XCOMP_HEADERS = \
../../../nxcomp/NX.h \ ../../../nxcomp/NX.h \
../../../nxcomp/NXpack.h \ ../../../nxcomp/NXpack.h \
../../../nxcomp/NXproto.h \ ../../../nxcomp/NXproto.h \
../../../nxcomp/NXvars.h ../../../nxcomp/NXvars.h \
$(NULL)
NX_XCOMPSHAD_HEADERS = \ NX_XCOMPSHAD_HEADERS = \
../../../nxcompshad/Shadow.h ../../../nxcompshad/Shadow.h \
$(NULL)
NX_HEADERS = \ NX_HEADERS = \
$(NX_XCOMP_HEADERS) \ $(NX_XCOMP_HEADERS) \
$(NX_XCOMPSHAD_HEADERS) $(NX_XCOMPSHAD_HEADERS) \
$(NULL)
BuildIncludes($(NX_HEADERS),nx,..) BuildIncludes($(NX_HEADERS),nx,..)
...@@ -243,7 +248,8 @@ NXAGENTOBJS = hw/nxagent/miinitext.o \ ...@@ -243,7 +248,8 @@ NXAGENTOBJS = hw/nxagent/miinitext.o \
hw/nxagent/NXglxext.o \ hw/nxagent/NXglxext.o \
hw/nxagent/NXmiexpose.o \ hw/nxagent/NXmiexpose.o \
hw/nxagent/NXresource.o \ hw/nxagent/NXresource.o \
hw/nxagent/NXdamage.o hw/nxagent/NXdamage.o \
$(NULL)
#elif !defined(Win32Architecture) #elif !defined(Win32Architecture)
NXAGENTOBJS = hw/nxagent/miinitext.o \ NXAGENTOBJS = hw/nxagent/miinitext.o \
hw/nxagent/NXwindow.o \ hw/nxagent/NXwindow.o \
...@@ -260,7 +266,8 @@ NXAGENTOBJS = hw/nxagent/miinitext.o \ ...@@ -260,7 +266,8 @@ NXAGENTOBJS = hw/nxagent/miinitext.o \
hw/nxagent/NXxvdisp.o \ hw/nxagent/NXxvdisp.o \
hw/nxagent/NXmiexpose.o \ hw/nxagent/NXmiexpose.o \
hw/nxagent/NXresource.o \ hw/nxagent/NXresource.o \
hw/nxagent/NXdamage.o hw/nxagent/NXdamage.o \
$(NULL)
#else #else
NXAGENTOBJS = hw/nxagent/miinitext.o \ NXAGENTOBJS = hw/nxagent/miinitext.o \
hw/nxagent/NXwindow.o \ hw/nxagent/NXwindow.o \
...@@ -278,7 +285,8 @@ NXAGENTOBJS = hw/nxagent/miinitext.o \ ...@@ -278,7 +285,8 @@ NXAGENTOBJS = hw/nxagent/miinitext.o \
hw/nxagent/NXmiexpose.o \ hw/nxagent/NXmiexpose.o \
hw/nxagent/NXresource.o \ hw/nxagent/NXresource.o \
hw/nxagent/NXdamage.o \ hw/nxagent/NXdamage.o \
dix/main.o dix/main.o \
$(NULL)
#endif #endif
XPMLIB = -lXpm XPMLIB = -lXpm
...@@ -313,16 +321,29 @@ NXAGENTNXLIBS = -L/usr/sfw/lib \ ...@@ -313,16 +321,29 @@ NXAGENTNXLIBS = -L/usr/sfw/lib \
-lrt \ -lrt \
-lXcomp \ -lXcomp \
-lXcompshad \ -lXcompshad \
-lXrender -lXfixes -lXfont -lXcomposite -lXinerama -lXdmcp \ -lXrender \
-lNX_X11 -lXext -lXfixes \
$(XFONTLIB) \
-lXcomposite \
-lXinerama \
-lXdmcp \
-lNX_X11 \
-lXext \
$(NULL)
#elif defined(cygwinArchitecture) #elif defined(cygwinArchitecture)
NXAGENTNXLIBS = -L../../../nxcomp \ NXAGENTNXLIBS = -L../../../nxcomp \
-L../../../nx-X11/exports/lib \ -L../../../nx-X11/exports/lib \
-L../../../nxcompshad \ -L../../../nxcompshad \
-lXcomp \ -lXcomp \
-lXcompshad \ -lXcompshad \
-lXrender -lXfixes -lXfont -lXcomposite -lXdmcp \ -lXrender \
-lNX_X11 -lXext -lXfixes \
$(XFONTLIB) \
-lXcomposite \
-lXdmcp \
-lNX_X11 \
-lXext \
$(NULL)
#elif defined(OpenBSDArchitecture) #elif defined(OpenBSDArchitecture)
NXAGENTNXLIBS = -L../../../nxcomp \ NXAGENTNXLIBS = -L../../../nxcomp \
-L../../../nx-X11/exports/lib \ -L../../../nx-X11/exports/lib \
...@@ -330,16 +351,30 @@ NXAGENTNXLIBS = -L../../../nxcomp \ ...@@ -330,16 +351,30 @@ NXAGENTNXLIBS = -L../../../nxcomp \
-lkvm \ -lkvm \
-lXcomp \ -lXcomp \
-lXcompshad \ -lXcompshad \
-lXrender -lXfixes -lXfont -lXcomposite -lXinerama -lXdmcp \ -lXrender \
-lNX_X11 -lXext -lXfixes \
$(XFONTLIB) \
-lXcomposite \
-lXinerama \
-lXdmcp \
-lNX_X11 \
-lXext \
$(NULL)
#else #else
NXAGENTNXLIBS = -L../../../nxcomp \ NXAGENTNXLIBS = -L../../../nxcomp \
-L../../../nx-X11/exports/lib \ -L../../../nx-X11/exports/lib \
-L../../../nxcompshad \ -L../../../nxcompshad \
-lXcomp \ -lXcomp \
-lXcompshad \ -lXcompshad \
-lXrender -lXfixes -lXfont -lXcomposite -lXinerama -lXdmcp \ -lXrender \
-lNX_X11 -lXext -lXfixes \
$(XFONTLIB) \
-lXcomposite \
-lXinerama \
-lXdmcp \
-lNX_X11 \
-lXext \
$(NULL)
#endif #endif
#endif #endif
......
...@@ -119,7 +119,7 @@ LintLibraryTarget(ext,$(SRCS)) ...@@ -119,7 +119,7 @@ LintLibraryTarget(ext,$(SRCS))
NormalLintTarget($(SRCS)) NormalLintTarget($(SRCS))
#if BuildXF86BigfontExt #if BuildXF86BigfontExt
SpecialCObjectRule(xf86bigfont,$(ICONFIGFILES),$(SHM_DEFINES)) SpecialCObjectRule(xf86bigfont,$(ICONFIGFILES),$(SHM_DEFINES) $(FONT_DEFINES))
#endif #endif
#if BuildXCSecurity #if BuildXCSecurity
SpecialCObjectRule(security,$(ICONFIGFILES),$(POLICYFILEDEF)) SpecialCObjectRule(security,$(ICONFIGFILES),$(POLICYFILEDEF))
......
...@@ -75,6 +75,10 @@ ...@@ -75,6 +75,10 @@
#define _XF86BIGFONT_SERVER_ #define _XF86BIGFONT_SERVER_
#include <nx-X11/extensions/xf86bigfproto.h> #include <nx-X11/extensions/xf86bigfproto.h>
#ifdef HAS_XFONT2
# include <X11/fonts/libxfont2.h>
#endif /* HAS_XFONT2 */
static void XF86BigfontResetProc( static void XF86BigfontResetProc(
ExtensionEntry * /* extEntry */ ExtensionEntry * /* extEntry */
); );
...@@ -186,7 +190,11 @@ XFree86BigfontExtensionInit() ...@@ -186,7 +190,11 @@ XFree86BigfontExtensionInit()
+ (unsigned int) (65536.0/(RAND_MAX+1.0) * rand()); + (unsigned int) (65536.0/(RAND_MAX+1.0) * rand());
/* fprintf(stderr, "signature = 0x%08X\n", signature); */ /* fprintf(stderr, "signature = 0x%08X\n", signature); */
#ifdef HAS_XFONT2
FontShmdescIndex = xfont2_allocate_font_private_index();
#else
FontShmdescIndex = AllocateFontPrivateIndex(); FontShmdescIndex = AllocateFontPrivateIndex();
#endif /* HAS_XFONT2 */
#if !defined(CSRG_BASED) && !defined(__CYGWIN__) #if !defined(CSRG_BASED) && !defined(__CYGWIN__)
pagesize = SHMLBA; pagesize = SHMLBA;
...@@ -526,7 +534,11 @@ ProcXF86BigfontQueryFont( ...@@ -526,7 +534,11 @@ ProcXF86BigfontQueryFont(
#ifdef HAS_SHM #ifdef HAS_SHM
if (pDesc && !badSysCall) { if (pDesc && !badSysCall) {
*(CARD32 *)(pCI + nCharInfos) = signature; *(CARD32 *)(pCI + nCharInfos) = signature;
#ifdef HAS_XFONT2
if (!xfont2_font_set_private(pFont, FontShmdescIndex, pDesc)) {
#else
if (!FontSetPrivate(pFont, FontShmdescIndex, pDesc)) { if (!FontSetPrivate(pFont, FontShmdescIndex, pDesc)) {
#endif /* HAS_XFONT2 */
shmdealloc(pDesc); shmdealloc(pDesc);
return BadAlloc; return BadAlloc;
} }
......
...@@ -133,7 +133,9 @@ LintLibraryTarget(dix,$(SRCS) $(XPSRC)) ...@@ -133,7 +133,9 @@ LintLibraryTarget(dix,$(SRCS) $(XPSRC))
NormalLintTarget($(SRCS) $(XPSRC)) NormalLintTarget($(SRCS) $(XPSRC))
SpecialCObjectRule(globals,$(ICONFIGFILES),$(SITE_DEFINES)) SpecialCObjectRule(globals,$(ICONFIGFILES),$(SITE_DEFINES))
SpecialCObjectRule(main,$(ICONFIGFILES),$(VENDOR_DEFINES)) SpecialCObjectRule(main,$(ICONFIGFILES),$(VENDOR_DEFINES) $(FONT_DEFINES))
SpecialCObjectRule(dispatch,$(ICONFIGFILES),$(FONT_DEFINES))
SpecialCObjectRule(dixfonts,$(ICONFIGFILES),$(FONT_DEFINES))
SpecialCObjectRule(pixmap,$(ICONFIGFILES),$(_NOOP_)) SpecialCObjectRule(pixmap,$(ICONFIGFILES),$(_NOOP_))
SpecialCObjectRule(privates,$(ICONFIGFILES),$(_NOOP_)) SpecialCObjectRule(privates,$(ICONFIGFILES),$(_NOOP_))
SpecialCObjectRule(window,$(ICONFIGFILES),$(QUARTZ_DEFINES)) SpecialCObjectRule(window,$(ICONFIGFILES),$(QUARTZ_DEFINES))
......
...@@ -86,6 +86,11 @@ int ProcInitialConnection(); ...@@ -86,6 +86,11 @@ int ProcInitialConnection();
#include "windowstr.h" #include "windowstr.h"
#include <X11/fonts/fontstruct.h> #include <X11/fonts/fontstruct.h>
#ifdef HAS_XFONT2
# include <X11/fonts/libxfont2.h>
#else
# include <X11/fonts/fontutil.h>
#endif /* HAS_XFONT2 */
#include "dixfontstr.h" #include "dixfontstr.h"
#include "gcstruct.h" #include "gcstruct.h"
#include "selection.h" #include "selection.h"
...@@ -1399,7 +1404,11 @@ ProcQueryTextExtents(register ClientPtr client) ...@@ -1399,7 +1404,11 @@ ProcQueryTextExtents(register ClientPtr client)
return(BadLength); return(BadLength);
length--; length--;
} }
#ifdef HAS_XFONT2
if (!xfont2_query_text_extents(pFont, length, (unsigned char *)&stuff[1], &info))
#else
if (!QueryTextExtents(pFont, length, (unsigned char *)&stuff[1], &info)) if (!QueryTextExtents(pFont, length, (unsigned char *)&stuff[1], &info))
#endif /* HAS_XFONT2 */
return(BadAlloc); return(BadAlloc);
reply.type = X_Reply; reply.type = X_Reply;
reply.length = 0; reply.length = 0;
...@@ -3364,7 +3373,6 @@ ProcSetFontPath(register ClientPtr client) ...@@ -3364,7 +3373,6 @@ ProcSetFontPath(register ClientPtr client)
unsigned long nbytes, total; unsigned long nbytes, total;
long nfonts; long nfonts;
int n, result; int n, result;
int error;
REQUEST(xSetFontPathReq); REQUEST(xSetFontPathReq);
REQUEST_AT_LEAST_SIZE(xSetFontPathReq); REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
...@@ -3382,13 +3390,9 @@ ProcSetFontPath(register ClientPtr client) ...@@ -3382,13 +3390,9 @@ ProcSetFontPath(register ClientPtr client)
} }
if (total >= 4) if (total >= 4)
return(BadLength); return(BadLength);
result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1], result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1]);
&error);
if (!result) if (!result)
{
result = client->noClientException; result = client->noClientException;
client->errorValue = error;
}
return (result); return (result);
} }
......
...@@ -95,6 +95,12 @@ Equipment Corporation. ...@@ -95,6 +95,12 @@ Equipment Corporation.
#include "colormapst.h" #include "colormapst.h"
#include "cursorstr.h" #include "cursorstr.h"
#include <X11/fonts/font.h> #include <X11/fonts/font.h>
#include <X11/fonts/fontstruct.h>
#ifdef HAS_XFONT2
# include <X11/fonts/libxfont2.h>
#else
# include <X11/fonts/fontutil.h>
#endif /* HAS_XFONT2 */
#include "opaque.h" #include "opaque.h"
#include "servermd.h" #include "servermd.h"
#include "site.h" #include "site.h"
...@@ -252,7 +258,11 @@ main(int argc, char *argv[], char *envp[]) ...@@ -252,7 +258,11 @@ main(int argc, char *argv[], char *envp[])
InitAtoms(); InitAtoms();
InitEvents(); InitEvents();
#ifdef HAS_XFONT2
xfont2_init_glyph_caching();
#else
InitGlyphCaching(); InitGlyphCaching();
#endif /* of HAS_XFONT2 */
ResetClientPrivates(); ResetClientPrivates();
ResetScreenPrivates(); ResetScreenPrivates();
ResetWindowPrivates(); ResetWindowPrivates();
...@@ -261,8 +271,8 @@ main(int argc, char *argv[], char *envp[]) ...@@ -261,8 +271,8 @@ main(int argc, char *argv[], char *envp[])
ResetPixmapPrivates(); ResetPixmapPrivates();
#endif #endif
ResetColormapPrivates(); ResetColormapPrivates();
ResetFontPrivateIndex();
ResetDevicePrivateIndex(); ResetDevicePrivateIndex();
InitFonts();
InitCallbackManager(); InitCallbackManager();
InitVisualWrap(); InitVisualWrap();
InitOutput(&screenInfo, argc, argv); InitOutput(&screenInfo, argc, argv);
...@@ -294,9 +304,8 @@ main(int argc, char *argv[], char *envp[]) ...@@ -294,9 +304,8 @@ main(int argc, char *argv[], char *envp[])
FatalError("failed to initialize core devices"); FatalError("failed to initialize core devices");
ReserveClientIds(serverClient); ReserveClientIds(serverClient);
InitFonts();
if (loadableFonts) { if (loadableFonts) {
SetFontPath(0, 0, (unsigned char *)defaultFontPath, &error); SetFontPath(serverClient, 0, (unsigned char *)defaultFontPath);
} else { } else {
if (SetDefaultFontPath(defaultFontPath) != Success) if (SetDefaultFontPath(defaultFontPath) != Success)
ErrorF("failed to set default font path '%s'\n", ErrorF("failed to set default font path '%s'\n",
......
/*
Copyright 1990, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/*
* Author: Keith Packard, MIT X Consortium
*/
/*
* Derived from libXfont1's utilbitmap.c (available via fontmisc.h).
*/
/* Utility functions for reformating font bitmaps */
static const unsigned char _reverse_byte[0x100] = {
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
};
/*
* Invert bit order within each BYTE of an array.
*/
void
nxagentBitOrderInvert(unsigned char *buf, int nbytes)
{
const unsigned char *rev = _reverse_byte;
for (; --nbytes >= 0; buf++)
*buf = rev[*buf];
}
/*
* Invert byte order within each 16-bits of an array.
*/
void
nxagentTwoByteSwap(unsigned char *buf, int nbytes)
{
unsigned char c;
for (; nbytes > 0; nbytes -= 2, buf += 2)
{
c = buf[0];
buf[0] = buf[1];
buf[1] = c;
}
}
/*
* Invert byte order within each 32-bits of an array.
*/
void
nxagentFourByteSwap(unsigned char *buf, int nbytes)
{
unsigned char c;
for (; nbytes > 0; nbytes -= 4, buf += 4)
{
c = buf[0];
buf[0] = buf[3];
buf[3] = c;
c = buf[1];
buf[1] = buf[2];
buf[2] = c;
}
}
...@@ -41,6 +41,7 @@ is" without express or implied warranty. ...@@ -41,6 +41,7 @@ is" without express or implied warranty.
#include "dixstruct.h" #include "dixstruct.h"
#include <X11/fonts/font.h> #include <X11/fonts/font.h>
#include <X11/fonts/fontstruct.h> #include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
#include "misc.h" #include "misc.h"
#include "miscstruct.h" #include "miscstruct.h"
#include "opaque.h" #include "opaque.h"
...@@ -495,7 +496,11 @@ Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont) ...@@ -495,7 +496,11 @@ Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont)
const char *name; const char *name;
char *origName = (char*) pScreen; char *origName = (char*) pScreen;
#ifdef HAS_XFONT2
xfont2_font_set_private(pFont, nxagentFontPrivateIndex, NULL);
#else
FontSetPrivate(pFont, nxagentFontPrivateIndex, NULL); FontSetPrivate(pFont, nxagentFontPrivateIndex, NULL);
#endif /* HAS_XFONT2 */
if (requestingClient && XpClientIsPrintClient(requestingClient, NULL)) if (requestingClient && XpClientIsPrintClient(requestingClient, NULL))
return True; return True;
...@@ -540,7 +545,11 @@ Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont) ...@@ -540,7 +545,11 @@ Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont)
} }
priv = (void *)malloc(sizeof(nxagentPrivFont)); priv = (void *)malloc(sizeof(nxagentPrivFont));
#ifdef HAS_XFONT2
xfont2_font_set_private(pFont, nxagentFontPrivateIndex, priv);
#else
FontSetPrivate(pFont, nxagentFontPrivateIndex, priv); FontSetPrivate(pFont, nxagentFontPrivateIndex, priv);
#endif /* HAS_XFONT2 */
nxagentFontPriv(pFont) -> mirrorID = 0; nxagentFontPriv(pFont) -> mirrorID = 0;
...@@ -688,7 +697,11 @@ Bool nxagentUnrealizeFont(ScreenPtr pScreen, FontPtr pFont) ...@@ -688,7 +697,11 @@ Bool nxagentUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
FreeResource(nxagentFontPriv(pFont) -> mirrorID, RT_NONE); FreeResource(nxagentFontPriv(pFont) -> mirrorID, RT_NONE);
free(nxagentFontPriv(pFont)); free(nxagentFontPriv(pFont));
#ifdef HAS_XFONT2
xfont2_font_set_private(pFont, nxagentFontPrivateIndex, NULL);
#else
FontSetPrivate(pFont, nxagentFontPrivateIndex, NULL); FontSetPrivate(pFont, nxagentFontPrivateIndex, NULL);
#endif /* HAS_XFONT2 */
} }
return True; return True;
......
...@@ -98,9 +98,9 @@ int nxagentAlphaCompat = 0; ...@@ -98,9 +98,9 @@ int nxagentAlphaCompat = 0;
* displays having different byte order. * displays having different byte order.
*/ */
extern void BitOrderInvert(unsigned char *, int); extern void nxagentBitOrderInvert(unsigned char *, int);
extern void TwoByteSwap(unsigned char *, register int); extern void nxagentTwoByteSwap(unsigned char *, register int);
extern void FourByteSwap(register unsigned char *, register int); extern void nxagentFourByteSwap(register unsigned char *, register int);
/* /*
* Store the last visual used to unpack * Store the last visual used to unpack
...@@ -206,7 +206,7 @@ int nxagentImageReformat(char *base, int nbytes, int bpp, int order) ...@@ -206,7 +206,7 @@ int nxagentImageReformat(char *base, int nbytes, int bpp, int order)
"bits per pixel [%d] byte order [%d].\n", nbytes, bpp, order); "bits per pixel [%d] byte order [%d].\n", nbytes, bpp, order);
#endif #endif
BitOrderInvert((unsigned char *) base, nbytes); nxagentBitOrderInvert((unsigned char *) base, nbytes);
} }
#if IMAGE_BYTE_ORDER != BITMAP_BIT_ORDER && BITMAP_SCANLINE_UNIT != 8 #if IMAGE_BYTE_ORDER != BITMAP_BIT_ORDER && BITMAP_SCANLINE_UNIT != 8
...@@ -231,7 +231,7 @@ int nxagentImageReformat(char *base, int nbytes, int bpp, int order) ...@@ -231,7 +231,7 @@ int nxagentImageReformat(char *base, int nbytes, int bpp, int order)
"bits per pixel [%d] byte order [%d].\n", nbytes, bpp, order); "bits per pixel [%d] byte order [%d].\n", nbytes, bpp, order);
#endif #endif
TwoByteSwap((unsigned char *) base, nbytes); nxagentTwoByteSwap((unsigned char *) base, nbytes);
} }
break; break;
...@@ -245,7 +245,7 @@ int nxagentImageReformat(char *base, int nbytes, int bpp, int order) ...@@ -245,7 +245,7 @@ int nxagentImageReformat(char *base, int nbytes, int bpp, int order)
"bits per pixel [%d] byte order [%d].\n", nbytes, bpp, order); "bits per pixel [%d] byte order [%d].\n", nbytes, bpp, order);
#endif #endif
FourByteSwap((unsigned char *) base, nbytes); nxagentFourByteSwap((unsigned char *) base, nbytes);
} }
break; break;
...@@ -1152,7 +1152,7 @@ FIXME: Should use an unpack resource here. ...@@ -1152,7 +1152,7 @@ FIXME: Should use an unpack resource here.
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentPutSubImage: Display image order is [%d] bitmap order is [%d].\n", fprintf(stderr, "nxagentPutSubImage: Display image order is [%d] bitmap order is [%d].\n",
ImageByteOrder(nxagentDisplay), BitmapBitOrder(nxagentDisplay)); ImageByteOrder(nxagentDisplay), nxagentBitmapBitOrder(nxagentDisplay));
#endif #endif
/* /*
......
...@@ -26,6 +26,7 @@ SRCS = \ ...@@ -26,6 +26,7 @@ SRCS = \
NXmitrap.c \ NXmitrap.c \
Args.c \ Args.c \
Binder.c \ Binder.c \
BitmapUtils.c \
Colormap.c \ Colormap.c \
Cursor.c \ Cursor.c \
Dialog.c \ Dialog.c \
...@@ -87,6 +88,7 @@ OBJS = \ ...@@ -87,6 +88,7 @@ OBJS = \
NXmitrap.o \ NXmitrap.o \
Args.o \ Args.o \
Binder.o \ Binder.o \
BitmapUtils.o \
Colormap.o \ Colormap.o \
Cursor.o \ Cursor.o \
Dialog.o \ Dialog.o \
...@@ -255,7 +257,11 @@ all:: $(OBJS) ...@@ -255,7 +257,11 @@ all:: $(OBJS)
LinkSourceFile(stubs.c,$(SERVERSRC)/Xi) LinkSourceFile(stubs.c,$(SERVERSRC)/Xi)
LinkSourceFile(xpstubs.c,$(SERVERSRC)/dix) LinkSourceFile(xpstubs.c,$(SERVERSRC)/dix)
SpecialCObjectRule(Init,$(ICONFIGFILES),$(_NOOP_)) SpecialCObjectRule(Init,$(ICONFIGFILES),$(FONT_DEFINES))
SpecialCObjectRule(Font,$(ICONFIGFILES),$(FONT_DEFINES))
SpecialCObjectRule(NXdamage,$(ICONFIGFILES),$(FONT_DEFINES))
SpecialCObjectRule(NXdispatch,$(ICONFIGFILES),$(FONT_DEFINES))
SpecialCObjectRule(NXdixfonts,$(ICONFIGFILES),$(FONT_DEFINES))
LinkSourceFile(miinitext.c,$(SERVERSRC)/mi) LinkSourceFile(miinitext.c,$(SERVERSRC)/mi)
SpecialCObjectRule(miinitext,$(ICONFIGFILES), $(_NOOP_)) SpecialCObjectRule(miinitext,$(ICONFIGFILES), $(_NOOP_))
......
...@@ -51,6 +51,7 @@ is" without express or implied warranty. ...@@ -51,6 +51,7 @@ is" without express or implied warranty.
#include "servermd.h" #include "servermd.h"
#include "mi.h" #include "mi.h"
#include <X11/fonts/fontstruct.h> #include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
#include "Agent.h" #include "Agent.h"
#include "Display.h" #include "Display.h"
...@@ -367,7 +368,11 @@ FIXME: These variables, if not removed at all because have probably ...@@ -367,7 +368,11 @@ FIXME: These variables, if not removed at all because have probably
nxagentWindowPrivateIndex = AllocateWindowPrivateIndex(); nxagentWindowPrivateIndex = AllocateWindowPrivateIndex();
nxagentGCPrivateIndex = AllocateGCPrivateIndex(); nxagentGCPrivateIndex = AllocateGCPrivateIndex();
RT_NX_GC = CreateNewResourceType(nxagentDestroyNewGCResourceType); RT_NX_GC = CreateNewResourceType(nxagentDestroyNewGCResourceType);
#ifdef HAS_XFONT2
nxagentFontPrivateIndex = xfont2_allocate_font_private_index();
#else
nxagentFontPrivateIndex = AllocateFontPrivateIndex(); nxagentFontPrivateIndex = AllocateFontPrivateIndex();
#endif /* HAS_XFONT2 */
RT_NX_FONT = CreateNewResourceType(nxagentDestroyNewFontResourceType); RT_NX_FONT = CreateNewResourceType(nxagentDestroyNewFontResourceType);
nxagentClientPrivateIndex = AllocateClientPrivateIndex(); nxagentClientPrivateIndex = AllocateClientPrivateIndex();
nxagentPixmapPrivateIndex = AllocatePixmapPrivateIndex(); nxagentPixmapPrivateIndex = AllocatePixmapPrivateIndex();
......
...@@ -210,14 +210,22 @@ doOpenFont(ClientPtr client, OFclosurePtr c) ...@@ -210,14 +210,22 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
if (c->current_fpe < c->num_fpes) if (c->current_fpe < c->num_fpes)
{ {
fpe = c->fpe_list[c->current_fpe]; fpe = c->fpe_list[c->current_fpe];
#ifdef HAS_XFONT2
(*fpe_functions[fpe->type]->client_died) ((void *) client, fpe);
#else
(*fpe_functions[fpe->type].client_died) ((void *) client, fpe); (*fpe_functions[fpe->type].client_died) ((void *) client, fpe);
#endif /* HAS_XFONT2 */
} }
err = Successful; err = Successful;
goto bail; goto bail;
} }
while (c->current_fpe < c->num_fpes) { while (c->current_fpe < c->num_fpes) {
fpe = c->fpe_list[c->current_fpe]; fpe = c->fpe_list[c->current_fpe];
#ifdef HAS_XFONT2
err = (*fpe_functions[fpe->type]->open_font)
#else
err = (*fpe_functions[fpe->type].open_font) err = (*fpe_functions[fpe->type].open_font)
#endif /* HAS_XFONT2 */
((void *) client, fpe, c->flags, ((void *) client, fpe, c->flags,
c->fontname, c->fnamelen, FontFormat, c->fontname, c->fnamelen, FontFormat,
BitmapFormatMaskByte | BitmapFormatMaskByte |
...@@ -314,7 +322,11 @@ doOpenFont(ClientPtr client, OFclosurePtr c) ...@@ -314,7 +322,11 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
} }
} }
if (patternCache && pfont != c->non_cachable_font) if (patternCache && pfont != c->non_cachable_font)
#ifdef HAS_XFONT2
xfont2_cache_font_pattern(patternCache, nxagentOrigFontName, nxagentOrigFontNameLen,
#else
CacheFontPattern(patternCache, nxagentOrigFontName, nxagentOrigFontNameLen, CacheFontPattern(patternCache, nxagentOrigFontName, nxagentOrigFontNameLen,
#endif /* HAS_XFONT2 */
pfont); pfont);
bail: bail:
if (err != Successful && c->client != serverClient) { if (err != Successful && c->client != serverClient) {
...@@ -359,7 +371,11 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) ...@@ -359,7 +371,11 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
if (c->current.current_fpe < c->num_fpes) if (c->current.current_fpe < c->num_fpes)
{ {
fpe = c->fpe_list[c->current.current_fpe]; fpe = c->fpe_list[c->current.current_fpe];
#ifdef HAS_XFONT2
(*fpe_functions[fpe->type]->client_died) ((void *) client, fpe);
#else
(*fpe_functions[fpe->type].client_died) ((void *) client, fpe); (*fpe_functions[fpe->type].client_died) ((void *) client, fpe);
#endif /* HAS_XFONT2 */
} }
err = Successful; err = Successful;
goto bail; goto bail;
...@@ -372,11 +388,19 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) ...@@ -372,11 +388,19 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
fpe = c->fpe_list[c->current.current_fpe]; fpe = c->fpe_list[c->current.current_fpe];
err = Successful; err = Successful;
#ifdef HAS_XFONT2
if (!fpe_functions[fpe->type]->start_list_fonts_and_aliases)
#else
if (!fpe_functions[fpe->type].start_list_fonts_and_aliases) if (!fpe_functions[fpe->type].start_list_fonts_and_aliases)
#endif /* HAS_XFONT2 */
{ {
/* This FPE doesn't support/require list_fonts_and_aliases */ /* This FPE doesn't support/require list_fonts_and_aliases */
#ifdef HAS_XFONT2
err = (*fpe_functions[fpe->type]->list_fonts)
#else
err = (*fpe_functions[fpe->type].list_fonts) err = (*fpe_functions[fpe->type].list_fonts)
#endif /* HAS_XFONT2 */
((void *) c->client, fpe, c->current.pattern, ((void *) c->client, fpe, c->current.pattern,
c->current.patlen, c->current.max_names - c->names->nnames, c->current.patlen, c->current.max_names - c->names->nnames,
c->names); c->names);
...@@ -408,7 +432,11 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) ...@@ -408,7 +432,11 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
the FPEs. */ the FPEs. */
if (!c->current.list_started) { if (!c->current.list_started) {
#ifdef HAS_XFONT2
err = (*fpe_functions[fpe->type]->start_list_fonts_and_aliases)
#else
err = (*fpe_functions[fpe->type].start_list_fonts_and_aliases) err = (*fpe_functions[fpe->type].start_list_fonts_and_aliases)
#endif /* HAS_XFONT2 */
((void *) c->client, fpe, c->current.pattern, ((void *) c->client, fpe, c->current.pattern,
c->current.patlen, c->current.max_names - c->names->nnames, c->current.patlen, c->current.max_names - c->names->nnames,
&c->current.private); &c->current.private);
...@@ -427,7 +455,11 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) ...@@ -427,7 +455,11 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
if (err == Successful) { if (err == Successful) {
char *tmpname; char *tmpname;
name = 0; name = 0;
#ifdef HAS_XFONT2
err = (*fpe_functions[fpe->type]->list_next_font_or_alias)
#else
err = (*fpe_functions[fpe->type].list_next_font_or_alias) err = (*fpe_functions[fpe->type].list_next_font_or_alias)
#endif /* HAS_XFONT2 */
((void *) c->client, fpe, &name, &namelen, &tmpname, ((void *) c->client, fpe, &name, &namelen, &tmpname,
&resolvedlen, c->current.private); &resolvedlen, c->current.private);
if (err == Suspended) { if (err == Suspended) {
...@@ -458,11 +490,19 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) ...@@ -458,11 +490,19 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
if (c->haveSaved) if (c->haveSaved)
{ {
if (c->savedName) if (c->savedName)
#ifdef HAS_XFONT2
(void)xfont2_add_font_names_name(c->names, c->savedName,
#else
(void)AddFontNamesName(c->names, c->savedName, (void)AddFontNamesName(c->names, c->savedName,
#endif /* HAS_XFONT2 */
c->savedNameLen); c->savedNameLen);
} }
else else
#ifdef HAS_XFONT2
(void)xfont2_add_font_names_name(c->names, name, namelen);
#else
(void)AddFontNamesName(c->names, name, namelen); (void)AddFontNamesName(c->names, name, namelen);
#endif /* HAS_XFONT2 */
} }
/* /*
...@@ -487,7 +527,11 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) ...@@ -487,7 +527,11 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
int tmpnamelen; int tmpnamelen;
tmpname = 0; tmpname = 0;
#ifdef HAS_XFONT2
(void) (*fpe_functions[fpe->type]->list_next_font_or_alias)
#else
(void) (*fpe_functions[fpe->type].list_next_font_or_alias) (void) (*fpe_functions[fpe->type].list_next_font_or_alias)
#endif /* HAS_XFONT2 */
((void *) c->client, fpe, &tmpname, &tmpnamelen, ((void *) c->client, fpe, &tmpname, &tmpnamelen,
&tmpname, &tmpnamelen, c->current.private); &tmpname, &tmpnamelen, c->current.private);
if (--aliascount <= 0) if (--aliascount <= 0)
...@@ -621,7 +665,11 @@ bail: ...@@ -621,7 +665,11 @@ bail:
FreeFPE(c->fpe_list[i]); FreeFPE(c->fpe_list[i]);
free(c->fpe_list); free(c->fpe_list);
if (c->savedName) free(c->savedName); if (c->savedName) free(c->savedName);
#ifdef HAS_XFONT2
xfont2_free_font_names(names);
#else
FreeFontNames(names); FreeFontNames(names);
#endif /* HAS_XFONT2 */
free(c); free(c);
if (resolved) free(resolved); if (resolved) free(resolved);
return TRUE; return TRUE;
...@@ -651,7 +699,11 @@ ListFonts(ClientPtr client, unsigned char *pattern, unsigned length, ...@@ -651,7 +699,11 @@ ListFonts(ClientPtr client, unsigned char *pattern, unsigned length,
free(c); free(c);
return BadAlloc; return BadAlloc;
} }
#ifdef HAS_XFONT2
c->names = xfont2_make_font_names_record(max_names < nxagentMaxFontNames ? max_names : nxagentMaxFontNames);
#else
c->names = MakeFontNamesRecord(max_names < nxagentMaxFontNames ? max_names : nxagentMaxFontNames); c->names = MakeFontNamesRecord(max_names < nxagentMaxFontNames ? max_names : nxagentMaxFontNames);
#endif /* HAS_XFONT2 */
if (!c->names) if (!c->names)
{ {
free(c->fpe_list); free(c->fpe_list);
...@@ -699,7 +751,11 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) ...@@ -699,7 +751,11 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
if (c->current.current_fpe < c->num_fpes) if (c->current.current_fpe < c->num_fpes)
{ {
fpe = c->fpe_list[c->current.current_fpe]; fpe = c->fpe_list[c->current.current_fpe];
#ifdef HAS_XFONT2
(*fpe_functions[fpe->type]->client_died) ((void *) client, fpe);
#else
(*fpe_functions[fpe->type].client_died) ((void *) client, fpe); (*fpe_functions[fpe->type].client_died) ((void *) client, fpe);
#endif /* HAS_XFONT2 */
} }
err = Successful; err = Successful;
goto bail; goto bail;
...@@ -713,7 +769,11 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) ...@@ -713,7 +769,11 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
err = Successful; err = Successful;
if (!c->current.list_started) if (!c->current.list_started)
{ {
#ifdef HAS_XFONT2
err = (*fpe_functions[fpe->type]->start_list_fonts_with_info)
#else
err = (*fpe_functions[fpe->type].start_list_fonts_with_info) err = (*fpe_functions[fpe->type].start_list_fonts_with_info)
#endif /* HAS_XFONT2 */
(client, fpe, c->current.pattern, c->current.patlen, (client, fpe, c->current.pattern, c->current.patlen,
c->current.max_names, &c->current.private); c->current.max_names, &c->current.private);
if (err == Suspended) if (err == Suspended)
...@@ -735,7 +795,11 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) ...@@ -735,7 +795,11 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
{ {
name = 0; name = 0;
pFontInfo = &fontInfo; pFontInfo = &fontInfo;
#ifdef HAS_XFONT2
err = (*fpe_functions[fpe->type]->list_next_font_with_info)
#else
err = (*fpe_functions[fpe->type].list_next_font_with_info) err = (*fpe_functions[fpe->type].list_next_font_with_info)
#endif /* HAS_XFONT2 */
(client, fpe, &name, &namelen, &pFontInfo, (client, fpe, &name, &namelen, &pFontInfo,
&numFonts, c->current.private); &numFonts, c->current.private);
if (err == Suspended) if (err == Suspended)
...@@ -775,7 +839,11 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) ...@@ -775,7 +839,11 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
tmpname = 0; tmpname = 0;
tmpFontInfo = &fontInfo; tmpFontInfo = &fontInfo;
(void) (*fpe_functions[fpe->type].list_next_font_with_info) #ifdef HAS_XFONT2
(void) (*fpe_functions[fpe->type]->list_next_font_with_info)
#else
(void) (*fpe_functions[fpe->type].list_next_font_with_info)
#endif /* HAS_XFONT2 */
(client, fpe, &tmpname, &tmpnamelen, &tmpFontInfo, (client, fpe, &tmpname, &tmpnamelen, &tmpFontInfo,
&numFonts, c->current.private); &numFonts, c->current.private);
if (--aliascount <= 0) if (--aliascount <= 0)
...@@ -1028,7 +1096,11 @@ nxdoListFontsAndAliases(client, fss) ...@@ -1028,7 +1096,11 @@ nxdoListFontsAndAliases(client, fss)
if (c->current.current_fpe < c->num_fpes) if (c->current.current_fpe < c->num_fpes)
{ {
fpe = c->fpe_list[c->current.current_fpe]; fpe = c->fpe_list[c->current.current_fpe];
#ifdef HAS_XFONT2
(*fpe_functions[fpe->type]->client_died) ((void *) client, fpe);
#else
(*fpe_functions[fpe->type].client_died) ((void *) client, fpe); (*fpe_functions[fpe->type].client_died) ((void *) client, fpe);
#endif /* HAS_XFONT2 */
} }
err = Successful; err = Successful;
goto bail; goto bail;
...@@ -1041,11 +1113,19 @@ nxdoListFontsAndAliases(client, fss) ...@@ -1041,11 +1113,19 @@ nxdoListFontsAndAliases(client, fss)
fpe = c->fpe_list[c->current.current_fpe]; fpe = c->fpe_list[c->current.current_fpe];
err = Successful; err = Successful;
#ifdef HAS_XFONT2
if (!fpe_functions[fpe->type]->start_list_fonts_and_aliases)
#else
if (!fpe_functions[fpe->type].start_list_fonts_and_aliases) if (!fpe_functions[fpe->type].start_list_fonts_and_aliases)
#endif /* HAS_XFONT2 */
{ {
/* This FPE doesn't support/require list_fonts_and_aliases */ /* This FPE doesn't support/require list_fonts_and_aliases */
#ifdef HAS_XFONT2
err = (*fpe_functions[fpe->type]->list_fonts)
#else
err = (*fpe_functions[fpe->type].list_fonts) err = (*fpe_functions[fpe->type].list_fonts)
#endif /* HAS_XFONT2 */
((void *) c->client, fpe, c->current.pattern, ((void *) c->client, fpe, c->current.pattern,
c->current.patlen, c->current.max_names - c->names->nnames, c->current.patlen, c->current.max_names - c->names->nnames,
c->names); c->names);
...@@ -1077,7 +1157,11 @@ nxdoListFontsAndAliases(client, fss) ...@@ -1077,7 +1157,11 @@ nxdoListFontsAndAliases(client, fss)
the FPEs. */ the FPEs. */
if (!c->current.list_started) { if (!c->current.list_started) {
#ifdef HAS_XFONT2
err = (*fpe_functions[fpe->type]->start_list_fonts_and_aliases)
#else
err = (*fpe_functions[fpe->type].start_list_fonts_and_aliases) err = (*fpe_functions[fpe->type].start_list_fonts_and_aliases)
#endif /* HAS_XFONT2 */
((void *) c->client, fpe, c->current.pattern, ((void *) c->client, fpe, c->current.pattern,
c->current.patlen, c->current.max_names - c->names->nnames, c->current.patlen, c->current.max_names - c->names->nnames,
&c->current.private); &c->current.private);
...@@ -1099,7 +1183,11 @@ nxdoListFontsAndAliases(client, fss) ...@@ -1099,7 +1183,11 @@ nxdoListFontsAndAliases(client, fss)
if (err == Successful) { if (err == Successful) {
char *tmpname; char *tmpname;
name = 0; name = 0;
#ifdef HAS_XFONT2
err = (*fpe_functions[fpe->type]->list_next_font_or_alias)
#else
err = (*fpe_functions[fpe->type].list_next_font_or_alias) err = (*fpe_functions[fpe->type].list_next_font_or_alias)
#endif /* HAS_XFONT2 */
((void *) c->client, fpe, &name, &namelen, &tmpname, ((void *) c->client, fpe, &name, &namelen, &tmpname,
&resolvedlen, c->current.private); &resolvedlen, c->current.private);
if (err == Suspended) { if (err == Suspended) {
...@@ -1170,7 +1258,11 @@ nxdoListFontsAndAliases(client, fss) ...@@ -1170,7 +1258,11 @@ nxdoListFontsAndAliases(client, fss)
int tmpnamelen; int tmpnamelen;
tmpname = 0; tmpname = 0;
#ifdef HAS_XFONT2
(void) (*fpe_functions[fpe->type]->list_next_font_or_alias)
#else
(void) (*fpe_functions[fpe->type].list_next_font_or_alias) (void) (*fpe_functions[fpe->type].list_next_font_or_alias)
#endif /* HAS_XFONT2 */
((void *) c->client, fpe, &tmpname, &tmpnamelen, ((void *) c->client, fpe, &tmpname, &tmpnamelen,
&tmpname, &tmpnamelen, c->current.private); &tmpname, &tmpnamelen, c->current.private);
if (--aliascount <= 0) if (--aliascount <= 0)
...@@ -1281,7 +1373,11 @@ finish: ...@@ -1281,7 +1373,11 @@ finish:
FreeFPE(c->fpe_list[i]); FreeFPE(c->fpe_list[i]);
free(c->fpe_list); free(c->fpe_list);
if (c->savedName) free(c->savedName); if (c->savedName) free(c->savedName);
#ifdef HAS_XFONT2
xfont2_free_font_names(c->names);
#else
FreeFontNames(c->names); FreeFontNames(c->names);
#endif /* HAS_XFONT2 */
free(c); free(c);
free(fss); free(fss);
if (resolved) free(resolved); if (resolved) free(resolved);
...@@ -1333,7 +1429,11 @@ nxOpenFont(client, fid, flags, lenfname, pfontname) ...@@ -1333,7 +1429,11 @@ nxOpenFont(client, fid, flags, lenfname, pfontname)
** having to create another instance of a font that already exists. ** having to create another instance of a font that already exists.
*/ */
#ifdef HAS_XFONT2
cached = xfont2_find_cached_font_pattern(patternCache, pfontname, lenfname);
#else
cached = FindCachedFontPattern(patternCache, pfontname, lenfname); cached = FindCachedFontPattern(patternCache, pfontname, lenfname);
#endif /* HAS_XFONT2 */
if (cached && cached->info.cachable) if (cached && cached->info.cachable)
{ {
if (!AddResource(fid, RT_FONT, (void *) cached)) if (!AddResource(fid, RT_FONT, (void *) cached))
...@@ -1357,7 +1457,11 @@ nxOpenFont(client, fid, flags, lenfname, pfontname) ...@@ -1357,7 +1457,11 @@ nxOpenFont(client, fid, flags, lenfname, pfontname)
free(fss); free(fss);
return BadAlloc; return BadAlloc;
} }
#ifdef HAS_XFONT2
c->names = xfont2_make_font_names_record(100);
#else
c->names = MakeFontNamesRecord(100); c->names = MakeFontNamesRecord(100);
#endif /* HAS_XFONT2 */
if (!c->names) if (!c->names)
{ {
free(c->fpe_list); free(c->fpe_list);
......
...@@ -132,10 +132,10 @@ static void nxagentPrintFormat(XRenderPictFormat *pFormat); ...@@ -132,10 +132,10 @@ static void nxagentPrintFormat(XRenderPictFormat *pFormat);
extern const CARD8 glyphDepths[]; extern const CARD8 glyphDepths[];
/* /*
* From NXdispatch.c. * From BitmapUtils.c.
*/ */
extern void BitOrderInvert(unsigned char *data, int nbytes); extern void nxagentBitOrderInvert(unsigned char *data, int nbytes);
/* /*
* Other functions defined here. * Other functions defined here.
...@@ -2266,7 +2266,7 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, ...@@ -2266,7 +2266,7 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi,
if (glyphDepths[glyphSet -> fdepth] == 1 && if (glyphDepths[glyphSet -> fdepth] == 1 &&
nxagentServerOrder() != BitmapBitOrder(nxagentDisplay)) nxagentServerOrder() != BitmapBitOrder(nxagentDisplay))
{ {
BitOrderInvert ((unsigned char *) normalizedImages, sizeImages); nxagentBitOrderInvert ((unsigned char *) normalizedImages, sizeImages);
} }
} }
else else
......
...@@ -29,11 +29,21 @@ SOFTWARE. ...@@ -29,11 +29,21 @@ SOFTWARE.
#include "closure.h" #include "closure.h"
#include <X11/fonts/fontstruct.h> #include <X11/fonts/fontstruct.h>
#ifdef HAS_XFONT2
# include <X11/fonts/libxfont2.h>
#else
# include <X11/fonts/fontutil.h>
#endif /* HAS XFONT2 */
#define NullDIXFontProp ((DIXFontPropPtr)0) #define NullDIXFontProp ((DIXFontPropPtr)0)
typedef struct _DIXFontProp *DIXFontPropPtr; typedef struct _DIXFontProp *DIXFontPropPtr;
#ifdef HAS_XFONT2
xfont2_fpe_funcs_rec const **fpe_functions;
#else
extern FPEFunctions *fpe_functions; extern FPEFunctions *fpe_functions;
#endif /* HAS_XFONT2 */
extern int FontToXError(int /*err*/); extern int FontToXError(int /*err*/);
...@@ -100,8 +110,7 @@ extern int ImageText(ClientPtr /*client*/, ...@@ -100,8 +110,7 @@ extern int ImageText(ClientPtr /*client*/,
extern int SetFontPath(ClientPtr /*client*/, extern int SetFontPath(ClientPtr /*client*/,
int /*npaths*/, int /*npaths*/,
unsigned char * /*paths*/, unsigned char * /*paths*/);
int * /*error*/);
extern int SetDefaultFontPath(char * /*path*/); extern int SetDefaultFontPath(char * /*path*/);
...@@ -125,14 +134,25 @@ extern void InitFonts(void); ...@@ -125,14 +134,25 @@ extern void InitFonts(void);
extern void FreeFonts(void); extern void FreeFonts(void);
#ifdef HAS_XFONT2
extern void GetGlyphs(FontPtr /*font */ ,
unsigned long /*count */ ,
unsigned char * /*chars */ ,
FontEncoding /*fontEncoding */ ,
unsigned long * /*glyphcount */ ,
CharInfoPtr * /*glyphs */ );
#else
extern FontPtr find_old_font(XID /*id*/); extern FontPtr find_old_font(XID /*id*/);
extern void GetGlyphs(FontPtr /*font*/, #define GetGlyphs dixGetGlyphs
unsigned long /*count*/, extern void dixGetGlyphs(FontPtr /*font*/,
unsigned char * /*chars*/, unsigned long /*count*/,
FontEncoding /*fontEncoding*/, unsigned char * /*chars*/,
unsigned long * /*glyphcount*/, FontEncoding /*fontEncoding*/,
CharInfoPtr * /*glyphs*/); unsigned long * /*glyphcount*/,
CharInfoPtr * /*glyphs*/);
extern void register_fpe_functions(void);
extern void QueryGlyphExtents(FontPtr /*pFont*/, extern void QueryGlyphExtents(FontPtr /*pFont*/,
CharInfoPtr * /*charinfo*/, CharInfoPtr * /*charinfo*/,
...@@ -143,6 +163,7 @@ extern Bool QueryTextExtents(FontPtr /*pFont*/, ...@@ -143,6 +163,7 @@ extern Bool QueryTextExtents(FontPtr /*pFont*/,
unsigned long /*count*/, unsigned long /*count*/,
unsigned char * /*chars*/, unsigned char * /*chars*/,
ExtentInfoPtr /*info*/); ExtentInfoPtr /*info*/);
#endif /* HAS_XFONT2 */
extern Bool ParseGlyphCachingMode(char * /*str*/); extern Bool ParseGlyphCachingMode(char * /*str*/);
...@@ -150,6 +171,4 @@ extern void InitGlyphCaching(void); ...@@ -150,6 +171,4 @@ extern void InitGlyphCaching(void);
extern void SetGlyphCachingMode(int /*newmode*/); extern void SetGlyphCachingMode(int /*newmode*/);
extern void register_fpe_functions(void);
#endif /* DIXFONT_H */ #endif /* DIXFONT_H */
...@@ -27,6 +27,9 @@ SOFTWARE. ...@@ -27,6 +27,9 @@ SOFTWARE.
#include "servermd.h" #include "servermd.h"
#include "dixfont.h" #include "dixfont.h"
#include <X11/fonts/fontstruct.h> #include <X11/fonts/fontstruct.h>
#ifdef HAS_XFONT2
# include <X11/fonts/libxfont2.h>
#endif /* HAS_XFONT2 */
#include "closure.h" #include "closure.h"
#include <nx-X11/Xproto.h> /* for xQueryFontReply */ #include <nx-X11/Xproto.h> /* for xQueryFontReply */
......
...@@ -179,6 +179,9 @@ NormalLibraryTarget(cbrt,cbrt.o) ...@@ -179,6 +179,9 @@ NormalLibraryTarget(cbrt,cbrt.o)
SpecialCObjectRule(miinitext,$(ICONFIGFILES),$(EXT_DEFINES)) SpecialCObjectRule(miinitext,$(ICONFIGFILES),$(EXT_DEFINES))
SpecialCObjectRule(miscrinit,$(ICONFIGFILES),$(EXT_DEFINES)) SpecialCObjectRule(miscrinit,$(ICONFIGFILES),$(EXT_DEFINES))
SpecialCObjectRule(miglblt,$(ICONFIGFILES),$(FONT_DEFINES))
SpecialCObjectRule(mipolytext,$(ICONFIGFILES),$(FONT_DEFINES))
#ifdef ItsyCompilerBug #ifdef ItsyCompilerBug
SpecialCObjectRule(mipolycon,$(_NOOP_),-O0) SpecialCObjectRule(mipolycon,$(_NOOP_),-O0)
#endif #endif
......
...@@ -55,6 +55,11 @@ SOFTWARE. ...@@ -55,6 +55,11 @@ SOFTWARE.
#include <nx-X11/Xproto.h> #include <nx-X11/Xproto.h>
#include "misc.h" #include "misc.h"
#include <X11/fonts/fontstruct.h> #include <X11/fonts/fontstruct.h>
#ifdef HAS_XFONT2
# include <X11/fonts/libxfont2.h>
#else
# include <X11/fonts/fontutil.h>
#endif /* HAS_XFONT2 */
#include "dixfontstr.h" #include "dixfontstr.h"
#include "gcstruct.h" #include "gcstruct.h"
#include "windowstr.h" #include "windowstr.h"
...@@ -203,13 +208,18 @@ miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) ...@@ -203,13 +208,18 @@ miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
CharInfoPtr *ppci; /* array of character info */ CharInfoPtr *ppci; /* array of character info */
void *pglyphBase; /* start of array of glyphs */ void *pglyphBase; /* start of array of glyphs */
{ {
ExtentInfoRec info; /* used by QueryGlyphExtents() */ ExtentInfoRec info; /* used by xfont2_query_glyph_extents (libXfont2)
resp. QueryGlyphExtents() (libXfont1) */
XID gcvals[3]; XID gcvals[3];
int oldAlu, oldFS; int oldAlu, oldFS;
unsigned long oldFG; unsigned long oldFG;
xRectangle backrect; xRectangle backrect;
#ifdef HAS_XFONT2
xfont2_query_glyph_extents(pGC->font, ppci, (unsigned long) nglyph, &info);
#else
QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info); QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
#endif /* HAS_XFONT2 */
if (info.overallWidth >= 0) if (info.overallWidth >= 0)
{ {
......
...@@ -22,6 +22,8 @@ NormalLibraryTarget(damage,$(OBJS)) ...@@ -22,6 +22,8 @@ NormalLibraryTarget(damage,$(OBJS))
LintLibraryTarget(damage,$(SRCS)) LintLibraryTarget(damage,$(SRCS))
NormalLintTarget($(SRCS)) NormalLintTarget($(SRCS))
SpecialCObjectRule(damage,$(ICONFIGFILES),$(FONT_DEFINES))
#endif #endif
DependTarget() DependTarget()
......
...@@ -34,6 +34,11 @@ ...@@ -34,6 +34,11 @@
#include <X11/fonts/font.h> #include <X11/fonts/font.h>
#include "dixfontstr.h" #include "dixfontstr.h"
#include <X11/fonts/fontstruct.h> #include <X11/fonts/fontstruct.h>
#ifdef HAS_XFONT2
# include <X11/fonts/libxfont2.h>
#else
# include <X11/fonts/fontutil.h>
#endif /* HAS_XFONT2 */
#include "mi.h" #include "mi.h"
#include "regionstr.h" #include "regionstr.h"
#include "globals.h" #include "globals.h"
...@@ -1297,7 +1302,11 @@ damageDamageChars (DrawablePtr pDrawable, ...@@ -1297,7 +1302,11 @@ damageDamageChars (DrawablePtr pDrawable,
ExtentInfoRec extents; ExtentInfoRec extents;
BoxRec box; BoxRec box;
#ifdef HAS_XFONT2
xfont2_query_glyph_extents(font, charinfo, n, &extents);
#else
QueryGlyphExtents(font, charinfo, n, &extents); QueryGlyphExtents(font, charinfo, n, &extents);
#endif /* HAS_XFONT2 */
if (imageblt) if (imageblt)
{ {
if (extents.overallWidth > extents.overallRight) if (extents.overallWidth > extents.overallRight)
......
...@@ -248,7 +248,7 @@ SpecialCObjectRule(connection,$(ICONFIGFILES),$(SOCK_DEFINES) $(XDMCP_DEFINES)) ...@@ -248,7 +248,7 @@ SpecialCObjectRule(connection,$(ICONFIGFILES),$(SOCK_DEFINES) $(XDMCP_DEFINES))
SpecialCObjectRule(osinit,$(ICONFIGFILES),$(ADM_DEFINES)) SpecialCObjectRule(osinit,$(ICONFIGFILES),$(ADM_DEFINES))
SpecialCObjectRule(WaitFor,$(ICONFIGFILES),$(EXT_DEFINES)) SpecialCObjectRule(WaitFor,$(ICONFIGFILES),$(EXT_DEFINES))
SpecialCObjectRule(io,$(ICONFIGFILES),$(EXT_DEFINES)) SpecialCObjectRule(io,$(ICONFIGFILES),$(EXT_DEFINES))
SpecialCObjectRule(utils,$(ICONFIGFILES),$(XDMCP_DEFINES) $(EXT_DEFINES) $(ERROR_DEFINES) $(PAM_DEFINES)) SpecialCObjectRule(utils,$(ICONFIGFILES),$(XDMCP_DEFINES) $(EXT_DEFINES) $(ERROR_DEFINES) $(PAM_DEFINES) $(FONT_DEFINES))
#if defined(SparcArchitecture) && HasGcc && !HasGcc2 #if defined(SparcArchitecture) && HasGcc && !HasGcc2
oscolor.o: oscolor.c $(ICONFIGFILES) oscolor.o: oscolor.c $(ICONFIGFILES)
$(RM) $@ $(RM) $@
......
...@@ -96,6 +96,11 @@ OR PERFORMANCE OF THIS SOFTWARE. ...@@ -96,6 +96,11 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <nx-X11/Xtrans/Xtrans.h> #include <nx-X11/Xtrans/Xtrans.h>
#include "input.h" #include "input.h"
#include "dixfont.h" #include "dixfont.h"
#ifdef HAS_XFONT2
# include <X11/fonts/libxfont2.h>
#else
# include <X11/fonts/fontutil.h>
#endif /* HAS_XFONT2 */
#include "osdep.h" #include "osdep.h"
#ifdef X_POSIX_C_SOURCE #ifdef X_POSIX_C_SOURCE
#define _POSIX_C_SOURCE X_POSIX_C_SOURCE #define _POSIX_C_SOURCE X_POSIX_C_SOURCE
...@@ -797,7 +802,11 @@ ProcessCommandLine(int argc, char *argv[]) ...@@ -797,7 +802,11 @@ ProcessCommandLine(int argc, char *argv[])
#endif #endif
else if ( strcmp( argv[i], "-deferglyphs") == 0) else if ( strcmp( argv[i], "-deferglyphs") == 0)
{ {
#ifdef HAS_XFONT2
if(++i >= argc || !!xfont2_parse_glyph_caching_mode(argv[i]))
#else
if(++i >= argc || !ParseGlyphCachingMode(argv[i])) if(++i >= argc || !ParseGlyphCachingMode(argv[i]))
#endif /* HAS_XFONT2 */
UseMsg(); UseMsg();
} }
else if ( strcmp( argv[i], "-f") == 0) else if ( strcmp( argv[i], "-f") == 0)
......
...@@ -38,7 +38,11 @@ BuildRequires: pkgconfig(pixman-1) >= 0.13.2 ...@@ -38,7 +38,11 @@ BuildRequires: pkgconfig(pixman-1) >= 0.13.2
BuildRequires: pkgconfig(x11) BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xext) BuildRequires: pkgconfig(xext)
BuildRequires: pkgconfig(xpm) BuildRequires: pkgconfig(xpm)
#%%if 0%%{?suse_version} >= 42XX
#BuildRequires: pkgconfig(xfont2)
#%%else
BuildRequires: pkgconfig(xfont) >= 1.4.2 BuildRequires: pkgconfig(xfont) >= 1.4.2
#%%endif
BuildRequires: pkgconfig(xdmcp) BuildRequires: pkgconfig(xdmcp)
BuildRequires: pkgconfig(xdamage) BuildRequires: pkgconfig(xdamage)
BuildRequires: pkgconfig(xcomposite) BuildRequires: pkgconfig(xcomposite)
...@@ -74,7 +78,11 @@ BuildRequires: pixman-devel >= 0.13.2 ...@@ -74,7 +78,11 @@ BuildRequires: pixman-devel >= 0.13.2
BuildRequires: libX11-devel BuildRequires: libX11-devel
BuildRequires: libXext-devel BuildRequires: libXext-devel
BuildRequires: libXpm-devel BuildRequires: libXpm-devel
%if 0%{?fedora} >= 24 || 0%{?rhel} >= 8
BuildRequires: libXfont2-devel
%else
BuildRequires: libXfont-devel >= 1.4.2 BuildRequires: libXfont-devel >= 1.4.2
%endif
BuildRequires: libXdmcp-devel BuildRequires: libXdmcp-devel
BuildRequires: libXdamage-devel BuildRequires: libXdamage-devel
BuildRequires: libXcomposite-devel BuildRequires: libXcomposite-devel
......
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