diff options
Diffstat (limited to 'nx-X11/lib/Xfontcache')
-rw-r--r-- | nx-X11/lib/Xfontcache/FontCache.c | 209 | ||||
-rw-r--r-- | nx-X11/lib/Xfontcache/Imakefile | 42 | ||||
-rw-r--r-- | nx-X11/lib/Xfontcache/Xfontcache-def.cpp | 9 | ||||
-rw-r--r-- | nx-X11/lib/Xfontcache/Xfontcache.man | 137 |
4 files changed, 397 insertions, 0 deletions
diff --git a/nx-X11/lib/Xfontcache/FontCache.c b/nx-X11/lib/Xfontcache/FontCache.c new file mode 100644 index 000000000..7561f6605 --- /dev/null +++ b/nx-X11/lib/Xfontcache/FontCache.c @@ -0,0 +1,209 @@ +/*- + * Copyright (c) 1998-1999 Shunsuke Akiyama <akiyama@jp.FreeBSD.org>. + * All rights reserved. + * Copyright (c) 1998-1999 X-TrueType Server Project, All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Id: FontCache.c,v 1.8 1999/01/31 12:52:49 akiyama Exp $ + */ +/* $XFree86: FontCache.c,v 1.3 2002/10/16 00:37:28 dawes Exp $ */ + +/* THIS IS NOT AN X CONSORTIUM STANDARD */ + +#define NEED_EVENTS +#define NEED_REPLIES +#include <X11/Xlibint.h> +#include <X11/extensions/fontcachstr.h> +#include <X11/extensions/Xext.h> +#include <X11/extensions/extutil.h> + +static XExtensionInfo _fontcache_info_data; +static XExtensionInfo *fontcache_info = &_fontcache_info_data; +static char *fontcache_extension_name = FONTCACHENAME; + +#define FontCacheCheckExtension(dpy,i,val) \ + XextCheckExtension (dpy, i, fontcache_extension_name, val) + +/***************************************************************************** + * * + * private utility routines * + * * + *****************************************************************************/ + +static int close_display(Display *, XExtCodes *); + +static /* const */ XExtensionHooks fontcache_extension_hooks = { + NULL, /* create_gc */ + NULL, /* copy_gc */ + NULL, /* flush_gc */ + NULL, /* free_gc */ + NULL, /* create_font */ + NULL, /* free_font */ + close_display, /* close_display */ + NULL, /* wire_to_event */ + NULL, /* event_to_wire */ + NULL, /* error */ + NULL, /* error_string */ +}; + +static XEXT_GENERATE_FIND_DISPLAY (find_display, fontcache_info, + fontcache_extension_name, + &fontcache_extension_hooks, + 0, NULL) + +static XEXT_GENERATE_CLOSE_DISPLAY (close_display, fontcache_info) + + +/***************************************************************************** + * * + * public Font-Misc Extension routines * + * * + *****************************************************************************/ + +Bool +FontCacheQueryExtension(Display *dpy, int *event_basep, int *error_basep) +{ + XExtDisplayInfo *info = find_display (dpy); + + if (XextHasExtension(info)) { + *event_basep = info->codes->first_event; + *error_basep = info->codes->first_error; + return True; + } else { + return False; + } +} + +Bool +FontCacheQueryVersion(Display *dpy, int *majorVersion, int *minorVersion) +{ + XExtDisplayInfo *info = find_display (dpy); + xFontCacheQueryVersionReply rep; + xFontCacheQueryVersionReq *req; + + FontCacheCheckExtension (dpy, info, False); + + LockDisplay(dpy); + GetReq(FontCacheQueryVersion, req); + req->reqType = info->codes->major_opcode; + req->fontcacheReqType = X_FontCacheQueryVersion; + if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + *majorVersion = rep.majorVersion; + *minorVersion = rep.minorVersion; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +FontCacheGetCacheSettings(Display *dpy, FontCacheSettings *cacheinfo) +{ + XExtDisplayInfo *info = find_display (dpy); + xFontCacheGetCacheSettingsReply rep; + xFontCacheGetCacheSettingsReq *req; + + FontCacheCheckExtension (dpy, info, False); + + LockDisplay(dpy); + GetReq(FontCacheGetCacheSettings, req); + req->reqType = info->codes->major_opcode; + req->fontcacheReqType = X_FontCacheGetCacheSettings; + if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + /* XXX */ + cacheinfo->himark = rep.himark; + cacheinfo->lowmark = rep.lowmark; + cacheinfo->balance = rep.balance; + /* XXX */ + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +FontCacheChangeCacheSettings(Display *dpy, FontCacheSettings *cacheinfo) +{ + XExtDisplayInfo *info = find_display (dpy); + xFontCacheChangeCacheSettingsReq *req; + + FontCacheCheckExtension (dpy, info, False); + + LockDisplay(dpy); + GetReq(FontCacheChangeCacheSettings, req); + req->reqType = info->codes->major_opcode; + req->fontcacheReqType = X_FontCacheChangeCacheSettings; + /* XXX */ + req->himark = cacheinfo->himark; + req->lowmark = cacheinfo->lowmark; + req->balance = cacheinfo->balance; + /* XXX */ + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +FontCacheGetCacheStatistics(Display *dpy, FontCacheStatistics *cachestats) +{ + XExtDisplayInfo *info = find_display (dpy); + xFontCacheGetCacheStatisticsReply rep; + xFontCacheGetCacheStatisticsReq *req; + + FontCacheCheckExtension (dpy, info, False); + + LockDisplay(dpy); + GetReq(FontCacheGetCacheStatistics, req); + req->reqType = info->codes->major_opcode; + req->fontcacheReqType = X_FontCacheGetCacheStatistics; + if (!_XReply(dpy, (xReply *)&rep, + (SIZEOF(xFontCacheGetCacheStatisticsReply)-SIZEOF(xReply))>>2, + xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + /* XXX */ + cachestats->purge_runs = rep.purge_runs; + cachestats->purge_stat = rep.purge_stat; + cachestats->balance = rep.balance; + cachestats->f.hits = rep.f_hits; + cachestats->f.misshits = rep.f_misshits; + cachestats->f.purged = rep.f_purged; + cachestats->f.usage = rep.f_usage; + cachestats->v.hits = rep.v_hits; + cachestats->v.misshits = rep.v_misshits; + cachestats->v.purged = rep.v_purged; + cachestats->v.usage = rep.v_usage; + /* XXX */ + UnlockDisplay(dpy); + SyncHandle(); + return True; +} diff --git a/nx-X11/lib/Xfontcache/Imakefile b/nx-X11/lib/Xfontcache/Imakefile new file mode 100644 index 000000000..dd0e57831 --- /dev/null +++ b/nx-X11/lib/Xfontcache/Imakefile @@ -0,0 +1,42 @@ +XCOMM Id: Imakefile,v 1.3 1999/01/31 12:54:33 akiyama Exp $ + + + +XCOMM $XFree86: xc/lib/Xfontcache/Imakefile,v 1.5 2003/10/13 21:49:21 herrb Exp $ + +#define DoNormalLib NormalLibXfontcache +#define DoSharedLib SharedLibXfontcache +#define DoExtraLib SharedLibXfontcache +#define DoDebugLib DebugLibXfontcache +#define DoProfileLib ProfileLibXfontcache +#define LibName Xfontcache +#define SoRev SOXFONTCACHEREV +#define LibHeaders NO + +#include <Threads.tmpl> + +#ifdef SharedXfontcacheReqs + REQUIREDLIBS = SharedXfontcacheReqs +#endif + + FONTCACHESRCS = FontCache.c + FONTCACHEOBJS = FontCache.o + +#if Malloc0ReturnsNull +ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL +#endif + + DEFINES = $(ALLOC_DEFINES) + SRCS = $(FONTCACHESRCS) + OBJS = $(FONTCACHEOBJS) + LINTLIBS = $(LINTXLIB) + +#include <Library.tmpl> + +MANSUFFIX=$(LIBMANSUFFIX) +InstallManPage(LibName,$(LIBMANDIR)) +#if ExpandManNames +InstallManPageAliases(LibName,$(LIBMANDIR),FontCacheQueryExtension FontCacheQueryVersion FontCacheGetCacheSettings FontCacheChangeCacheSettings FontCacheGetCacheStatistics) +#endif + +DependTarget() diff --git a/nx-X11/lib/Xfontcache/Xfontcache-def.cpp b/nx-X11/lib/Xfontcache/Xfontcache-def.cpp new file mode 100644 index 000000000..26b141aed --- /dev/null +++ b/nx-X11/lib/Xfontcache/Xfontcache-def.cpp @@ -0,0 +1,9 @@ +LIBRARY Xfontcache +VERSION LIBRARY_VERSION +EXPORTS + FontCacheChangeCacheSettings + FontCacheGetCacheSettings + FontCacheGetCacheStatistics + FontCacheQueryExtension + FontCacheQueryVersion +/* $XFree86$ */ diff --git a/nx-X11/lib/Xfontcache/Xfontcache.man b/nx-X11/lib/Xfontcache/Xfontcache.man new file mode 100644 index 000000000..473a4e306 --- /dev/null +++ b/nx-X11/lib/Xfontcache/Xfontcache.man @@ -0,0 +1,137 @@ +.\" +.\" $XFree86: xc/lib/Xfontcache/Xfontcache.man,v 1.1 2003/10/13 21:19:28 herrb Exp $ +.\" +.\" Copyright (C) 2003 The XFree86 Project, Inc. All Rights Reserved. +.\" +.\" Permission is hereby granted, free of charge, to any person obtaining +.\" a copy of this software and associated documentation files (the +.\" "Software"), to deal in the Software without restriction, including +.\" without limitation the rights to use, copy, modify, merge, publish, +.\" distribute, sublicense, and/or sell copies of the Software, and to +.\" permit persons to whom the Software is furnished to do so, subject to +.\" the following conditions: +.\" +.\" 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 NON-INFRINGEMENT. +.\" IN NO EVENT SHALL THE XFREE86 PROJECT 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 XFree86 Project +.\" 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 XFree86 Project. +.\" +.TH Xfontcache __libmansuffix__ __vendorversion__ +.SH NAME +Xfontcache \- X-TrueType font cache extension client library +.SH SYNOPSIS +.B #include <X11/extension/FontCache.h> +.PP +.nf +.ta .5i 2i +typedef struct { + long himark; + long lowmark; + long balance; +} FontCacheSettings, *FontCacheSettingsPtr; + +struct cacheinfo { + long hits; + long misshits; + long purged; + long usage; +}; + +typedef struct { + long purge_runs; + long purge_stat; + long balance; + struct cacheinfo f; + struct cacheinfo v; +} FontCacheStatistics, *FontCacheStatisticsPtr; +.fi +.HP +Bool FontCacheQueryExtension(Display *\fIdpy\fP, +int *\fIevent_basep\fP, int *\fIerror_basep\fP\^); +.HP +Status FontCacheQueryVersion(Display *\fIdpy\fP, int *\fImajor_versionp\fP, +int *\fIminor_versionp\fP\^); +.HP +Status FontCacheGetCacheSettings(Display *\fIdpy\fP, +FontCacheSettings *\fIcache info\fP); +.HP +Status FontCacheChangeCacheSettings(Display *\fIdpy\fP, +FontCacheSettings *\fIcache info\fP); +.HP +Status FontCacheGetCacheStatistics(Display *\fIdpy\fP, +FontCacheStatistics *\fIcache statistics info\fP); +.PP +.SH DESCRIPTION +.B FontCache +is an extension that is used by X-TrueType to cache informations about +fonts. +.\" XXXX This should be filled in +.PP +.B FontCacheQueryExtension +returns +.B True +if the +.I FontCache +extension is available on the given display. +A client must call +.B FontCacheQueryExtension +before calling any other Xfontcache function in order +to negotiate a compatible protocol version; otherwise the client will +get undefined behavior (Xfontcache may or may not work). +.PP +.B FontCacheQueryVersion +returns +.B True +if the request succeeded; the values of the major and minor protocol +versions supported by the server are returned in +.I major_versionp +and +.I minor_versionp . +.PP +.B FontCacheGetCacheSettings +should be documented here. +Returns +.B True +on success or +.B False +on failure. +.PP +.B FontCacheChangeCacheSettings +should be documented here. +Returns +.B True +on success or +.B False +on failure. +.PP +.B FontCacheGetCacheStatistics +should be documented here. +Returns +.B True +on success or +.B False +on failure. +.SH "ERRORS" +.B FontCacheChangeCacheSettings +will return +.I BadValue +if passed an illegal parameters for lowmark, himark or balance fields. +.SH "SEE ALSO" +X(__miscmansuffix__) +.SH AUTHOR +Akio Morita, X-TrueType team, Nozomi Ytow. +.SH STABILITY +This API is considered as experimental. The Xfontcache library major +revision may be incremented whenever incompatible changes are done to +the API without notice. Use with care. |