diff options
Diffstat (limited to 'libXfont/src/fontfile')
-rw-r--r-- | libXfont/src/fontfile/Makefile.am | 2 | ||||
-rw-r--r-- | libXfont/src/fontfile/Makefile.in | 67 | ||||
-rw-r--r-- | libXfont/src/fontfile/bitsource.c | 6 | ||||
-rw-r--r-- | libXfont/src/fontfile/bufio.c | 8 | ||||
-rw-r--r-- | libXfont/src/fontfile/bunzip2.c | 6 | ||||
-rw-r--r-- | libXfont/src/fontfile/catalogue.c | 36 | ||||
-rw-r--r-- | libXfont/src/fontfile/decompress.c | 4 | ||||
-rw-r--r-- | libXfont/src/fontfile/dirfile.c | 8 | ||||
-rw-r--r-- | libXfont/src/fontfile/ffcheck.c | 188 | ||||
-rw-r--r-- | libXfont/src/fontfile/fileio.c | 5 | ||||
-rw-r--r-- | libXfont/src/fontfile/filewr.c | 2 | ||||
-rw-r--r-- | libXfont/src/fontfile/fontdir.c | 55 | ||||
-rw-r--r-- | libXfont/src/fontfile/fontfile.c | 85 | ||||
-rw-r--r-- | libXfont/src/fontfile/fontscale.c | 11 | ||||
-rw-r--r-- | libXfont/src/fontfile/gunzip.c | 8 | ||||
-rw-r--r-- | libXfont/src/fontfile/printerfont.c | 178 | ||||
-rw-r--r-- | libXfont/src/fontfile/register.c | 68 | ||||
-rw-r--r-- | libXfont/src/fontfile/renderers.c | 12 |
18 files changed, 144 insertions, 605 deletions
diff --git a/libXfont/src/fontfile/Makefile.am b/libXfont/src/fontfile/Makefile.am index 45d1dbaa4..05aded262 100644 --- a/libXfont/src/fontfile/Makefile.am +++ b/libXfont/src/fontfile/Makefile.am @@ -18,7 +18,6 @@ libfontfile_la_SOURCES = \ decompress.c \ defaults.c \ dirfile.c \ - ffcheck.c \ fileio.c \ filewr.c \ fontdir.c \ @@ -26,7 +25,6 @@ libfontfile_la_SOURCES = \ fontfile.c \ fontscale.c \ gunzip.c \ - printerfont.c \ register.c \ renderers.c \ catalogue.c diff --git a/libXfont/src/fontfile/Makefile.in b/libXfont/src/fontfile/Makefile.in index dca443eaa..90d04a5a6 100644 --- a/libXfont/src/fontfile/Makefile.in +++ b/libXfont/src/fontfile/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -47,17 +47,16 @@ LTLIBRARIES = $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = libfontfile_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am__libfontfile_la_SOURCES_DIST = bitsource.c bufio.c decompress.c \ - defaults.c dirfile.c ffcheck.c fileio.c filewr.c fontdir.c \ - fontencc.c fontfile.c fontscale.c gunzip.c printerfont.c \ - register.c renderers.c catalogue.c bunzip2.c + defaults.c dirfile.c fileio.c filewr.c fontdir.c fontencc.c \ + fontfile.c fontscale.c gunzip.c register.c renderers.c \ + catalogue.c bunzip2.c @X_BZIP2_FONT_COMPRESSION_TRUE@am__objects_1 = bunzip2.lo am_libfontfile_la_OBJECTS = bitsource.lo bufio.lo decompress.lo \ - defaults.lo dirfile.lo ffcheck.lo fileio.lo filewr.lo \ - fontdir.lo fontencc.lo fontfile.lo fontscale.lo gunzip.lo \ - printerfont.lo register.lo renderers.lo catalogue.lo \ - $(am__objects_1) + defaults.lo dirfile.lo fileio.lo filewr.lo fontdir.lo \ + fontencc.lo fontfile.lo fontscale.lo gunzip.lo register.lo \ + renderers.lo catalogue.lo $(am__objects_1) libfontfile_la_OBJECTS = $(am_libfontfile_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(top_builddir) -I$(top_builddir)/include/X11/fonts@am__isrc@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -I$(top_builddir)/include/X11/fonts depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -88,22 +87,18 @@ CHANGELOG_CMD = @CHANGELOG_CMD@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENCODINGSDIR = @ENCODINGSDIR@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ @@ -113,17 +108,24 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_CFLAGS = @OS_CFLAGS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -133,6 +135,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -146,8 +149,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -180,6 +182,7 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -192,6 +195,7 @@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ FONTENCDIR = @ENCODINGSDIR@ @@ -206,9 +210,9 @@ libfontfile_la_LIBADD = \ $(Z_LIBS) libfontfile_la_SOURCES = bitsource.c bufio.c decompress.c defaults.c \ - dirfile.c ffcheck.c fileio.c filewr.c fontdir.c fontencc.c \ - fontfile.c fontscale.c gunzip.c printerfont.c register.c \ - renderers.c catalogue.c $(am__append_1) + dirfile.c fileio.c filewr.c fontdir.c fontencc.c fontfile.c \ + fontscale.c gunzip.c register.c renderers.c catalogue.c \ + $(am__append_1) all: all-am .SUFFIXES: @@ -217,8 +221,8 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -267,7 +271,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decompress.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/defaults.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirfile.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffcheck.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileio.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filewr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fontdir.Plo@am__quote@ @@ -275,7 +278,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fontfile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fontscale.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gunzip.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printerfont.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/register.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/renderers.Plo@am__quote@ @@ -311,8 +313,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -324,8 +326,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -335,13 +337,12 @@ ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique diff --git a/libXfont/src/fontfile/bitsource.c b/libXfont/src/fontfile/bitsource.c index ae27de8fe..d828ce815 100644 --- a/libXfont/src/fontfile/bitsource.c +++ b/libXfont/src/fontfile/bitsource.c @@ -51,7 +51,7 @@ FontFileRegisterBitmapSource (FontPathElementPtr fpe) if (FontFileBitmapSources.count == FontFileBitmapSources.size) { newsize = FontFileBitmapSources.size + 4; - new = (FontPathElementPtr *) xrealloc (FontFileBitmapSources.fpe, newsize * sizeof *new); + new = realloc (FontFileBitmapSources.fpe, newsize * sizeof *new); if (!new) return FALSE; FontFileBitmapSources.size = newsize; @@ -73,7 +73,7 @@ FontFileUnregisterBitmapSource (FontPathElementPtr fpe) if (FontFileBitmapSources.count == 0) { FontFileBitmapSources.size = 0; - xfree (FontFileBitmapSources.fpe); + free (FontFileBitmapSources.fpe); FontFileBitmapSources.fpe = 0; } else @@ -99,7 +99,7 @@ FontFileEmptyBitmapSource(void) FontFileBitmapSources.count = 0; FontFileBitmapSources.size = 0; - xfree (FontFileBitmapSources.fpe); + free (FontFileBitmapSources.fpe); FontFileBitmapSources.fpe = 0; } diff --git a/libXfont/src/fontfile/bufio.c b/libXfont/src/fontfile/bufio.c index a5746e3bd..dd8d6e282 100644 --- a/libXfont/src/fontfile/bufio.c +++ b/libXfont/src/fontfile/bufio.c @@ -51,7 +51,7 @@ BufFileCreate (char *private, { BufFilePtr f; - f = (BufFilePtr) xalloc (sizeof *f); + f = malloc (sizeof *f); if (!f) return 0; f->private = private; @@ -125,7 +125,7 @@ BufFileRawClose (BufFilePtr f, int doClose) BufFilePtr BufFileOpenRead (int fd) { -#if defined(__UNIXOS2__) || defined (WIN32) +#if defined (WIN32) /* hv: I'd bet WIN32 has the same effect here */ setmode(fd,O_BINARY); #endif @@ -160,7 +160,7 @@ BufFileOpenWrite (int fd) { BufFilePtr f; -#if defined(__UNIXOS2__) || defined(WIN32) +#if defined(WIN32) /* hv: I'd bet WIN32 has the same effect here */ setmode(fd,O_BINARY); #endif @@ -201,6 +201,6 @@ BufFileClose (BufFilePtr f, int doClose) { int ret; ret = (*f->close) (f, doClose); - xfree (f); + free (f); return ret; } diff --git a/libXfont/src/fontfile/bunzip2.c b/libXfont/src/fontfile/bunzip2.c index 9964de6e9..d8b9321e1 100644 --- a/libXfont/src/fontfile/bunzip2.c +++ b/libXfont/src/fontfile/bunzip2.c @@ -54,7 +54,7 @@ BufFilePushBZIP2 (BufFilePtr f) { xzip_buf *x; - x = (xzip_buf *) xalloc (sizeof (xzip_buf)); + x = malloc (sizeof (xzip_buf)); if (!x) return NULL; bzero(&(x->z), sizeof(bz_stream)); @@ -64,7 +64,7 @@ BufFilePushBZIP2 (BufFilePtr f) 0, /* verbosity: 0 silent, 4 max */ 0); /* 0: go faster, 1: use less memory */ if (x->zstat != BZ_OK) { - xfree(x); + free(x); return NULL; } @@ -87,7 +87,7 @@ BufBzip2FileClose(BufFilePtr f, int flag) xzip_buf *x = (xzip_buf *)f->private; BZ2_bzDecompressEnd (&(x->z)); BufFileClose (x->f, flag); - xfree (x); + free (x); return 1; } diff --git a/libXfont/src/fontfile/catalogue.c b/libXfont/src/fontfile/catalogue.c index d49423617..3a04a754d 100644 --- a/libXfont/src/fontfile/catalogue.c +++ b/libXfont/src/fontfile/catalogue.c @@ -61,8 +61,7 @@ CatalogueAddFPE (CataloguePtr cat, FontPathElementPtr fpe) else cat->fpeAlloc *= 2; - new = xrealloc(cat->fpeList, - cat->fpeAlloc * sizeof(FontPathElementPtr)); + new = realloc(cat->fpeList, cat->fpeAlloc * sizeof(FontPathElementPtr)); if (new == NULL) return AllocError; @@ -115,8 +114,8 @@ CatalogueUnrefFPEs (FontPathElementPtr fpe) if (subfpe->refcount == 0) { FontFileFreeFPE (subfpe); - xfree(subfpe->name); - xfree(subfpe); + free(subfpe->name); + free(subfpe); } } @@ -150,7 +149,7 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan) dir = opendir(path); if (dir == NULL) { - xfree(cat); + free(cat); return BadFontPath; } @@ -180,7 +179,7 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan) len += strlen(attrib); } - subfpe = xalloc(sizeof *subfpe); + subfpe = malloc(sizeof *subfpe); if (subfpe == NULL) continue; @@ -190,10 +189,10 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan) * (which uses font->fpe->type) goes to CatalogueCloseFont. */ subfpe->type = fpe->type; subfpe->name_length = len; - subfpe->name = xalloc (len + 1); + subfpe->name = malloc (len + 1); if (subfpe == NULL) { - xfree(subfpe); + free(subfpe); continue; } @@ -207,15 +206,15 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan) if (FontFileInitFPE (subfpe) != Successful) { - xfree(subfpe->name); - xfree(subfpe); + free(subfpe->name); + free(subfpe); continue; } if (CatalogueAddFPE(cat, subfpe) != Successful) { FontFileFreeFPE (subfpe); - xfree(subfpe); + free(subfpe); continue; } } @@ -235,7 +234,7 @@ CatalogueInitFPE (FontPathElementPtr fpe) { CataloguePtr cat; - cat = (CataloguePtr) xalloc(sizeof *cat); + cat = malloc(sizeof *cat); if (cat == NULL) return AllocError; @@ -271,8 +270,8 @@ CatalogueFreeFPE (FontPathElementPtr fpe) return FontFileFreeFPE (fpe); CatalogueUnrefFPEs (fpe); - xfree(cat->fpeList); - xfree(cat); + free(cat->fpeList); + free(cat); return Successful; } @@ -356,8 +355,7 @@ CatalogueStartListFonts(pointer client, FontPathElementPtr fpe, CatalogueRescan (fpe, FALSE); - data = (LFWIDataPtr) xalloc (sizeof *data + - sizeof data->privates[0] * cat->fpeCount); + data = malloc (sizeof *data + sizeof data->privates[0] * cat->fpeCount); if (!data) return AllocError; data->privates = (pointer *) (data + 1); @@ -377,7 +375,7 @@ CatalogueStartListFonts(pointer client, FontPathElementPtr fpe, bail: for (j = 0; j < i; j++) /* FIXME: we have no way to free the per-fpe privates. */; - xfree (data); + free (data); return AllocError; } @@ -402,7 +400,7 @@ CatalogueListNextFontWithInfo(pointer client, FontPathElementPtr fpe, if (data->current == cat->fpeCount) { - xfree(data); + free(data); return BadFontName; } @@ -439,7 +437,7 @@ CatalogueListNextFontOrAlias(pointer client, FontPathElementPtr fpe, if (data->current == cat->fpeCount) { - xfree(data); + free(data); return BadFontName; } diff --git a/libXfont/src/fontfile/decompress.c b/libXfont/src/fontfile/decompress.c index a4c546871..cdfb49279 100644 --- a/libXfont/src/fontfile/decompress.c +++ b/libXfont/src/fontfile/decompress.c @@ -162,7 +162,7 @@ BufFilePushCompressed (BufFilePtr f) hsize = hsize_table[maxbits - 12]; extra = (1 << maxbits) * sizeof (char_type) + hsize * sizeof (unsigned short); - file = (CompressedFile *) xalloc (sizeof (CompressedFile) + extra); + file = malloc (sizeof (CompressedFile) + extra); if (!file) return 0; file->file = f; @@ -203,7 +203,7 @@ BufCompressedClose (BufFilePtr f, int doClose) file = (CompressedFile *) f->private; raw = file->file; - xfree (file); + free (file); BufFileClose (raw, doClose); return 1; } diff --git a/libXfont/src/fontfile/dirfile.c b/libXfont/src/fontfile/dirfile.c index 148993896..588464ffb 100644 --- a/libXfont/src/fontfile/dirfile.c +++ b/libXfont/src/fontfile/dirfile.c @@ -66,7 +66,7 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir) status; struct stat statb; static char format[24] = ""; -#if defined(__UNIXOS2__) || defined(WIN32) +#if defined(WIN32) int i; #endif @@ -76,7 +76,7 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir) return BadFontPath; /* Check for font directory attributes */ -#if !defined(__UNIXOS2__) && !defined(WIN32) +#if !defined(WIN32) if ((ptr = strchr(directory, ':'))) { #else /* OS/2 and WIN32 path might start with a drive letter, don't clip this */ @@ -118,7 +118,7 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir) MAXFONTFILENAMELEN-1, MAXFONTNAMELEN-1); while ((count = fscanf(file, format, file_name, font_name)) != EOF) { -#if defined(__UNIXOS2__) || defined(WIN32) +#if defined(WIN32) /* strip any existing trailing CR */ for (i=0; i<strlen(font_name); i++) { if (font_name[i]=='\r') font_name[i] = '\0'; @@ -378,7 +378,7 @@ lexAlias(FILE *file, char **lexToken) char *nbuf; nsize = tokenSize ? (tokenSize << 1) : 64; - nbuf = (char *) xrealloc(tokenBuf, nsize); + nbuf = realloc(tokenBuf, nsize); if (!nbuf) return EALLOC; tokenBuf = nbuf; diff --git a/libXfont/src/fontfile/ffcheck.c b/libXfont/src/fontfile/ffcheck.c deleted file mode 100644 index 70d117e46..000000000 --- a/libXfont/src/fontfile/ffcheck.c +++ /dev/null @@ -1,188 +0,0 @@ -/* $Xorg: ffcheck.c,v 1.4 2001/02/09 02:04:03 xorgcvs Exp $ */ - -/* - -Copyright 1991, 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. - -*/ -/* $XFree86: xc/lib/font/fontfile/ffcheck.c,v 1.15tsi Exp $ */ - -/* - * Author: Keith Packard, MIT X Consortium - */ -/* $NCDXorg: @(#)fontfile.c,v 1.6 1991/07/02 17:00:46 lemke Exp $ */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <X11/fonts/fntfilst.h> -#include <X11/fonts/bitmap.h> -#include <X11/fonts/fontmod.h> - -/* - * Map FPE functions to renderer functions - */ - - -/* Here we must check the client to see if it has a context attached to - * it that allows us to access the printer fonts - */ - -static int -FontFileCheckOpenFont (pointer client, FontPathElementPtr fpe, Mask flags, - char *name, int namelen, - fsBitmapFormat format, fsBitmapFormatMask fmask, - XID id, FontPtr *pFont, char **aliasName, - FontPtr non_cachable_font) -{ - if (XpClientIsBitmapClient(client)) - return (FontFileOpenFont (client, fpe, flags, name, namelen, format, - fmask, id, pFont, aliasName, non_cachable_font)); - return BadFontName; -} - -static int -FontFileCheckListFonts (pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, FontNamesPtr names) -{ - if (XpClientIsBitmapClient(client)) - return FontFileListFonts (client, fpe, pat, len, max, names); - return BadFontName; -} - -static int -FontFileCheckStartListFontsWithInfo(pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, - pointer *privatep) -{ - if (XpClientIsBitmapClient(client)) - return FontFileStartListFontsWithInfo(client, fpe, pat, len, - max, privatep); - return BadFontName; -} - -static int -FontFileCheckListNextFontWithInfo(pointer client, FontPathElementPtr fpe, - char **namep, int *namelenp, - FontInfoPtr *pFontInfo, - int *numFonts, pointer private) -{ - if (XpClientIsBitmapClient(client)) - return FontFileListNextFontWithInfo(client, fpe, namep, namelenp, - pFontInfo, numFonts, private); - return BadFontName; -} - -static int -FontFileCheckStartListFontsAndAliases(pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, - pointer *privatep) -{ - if (XpClientIsBitmapClient(client)) - return FontFileStartListFontsAndAliases(client, fpe, pat, len, - max, privatep); - return BadFontName; -} - -static int -FontFileCheckListNextFontOrAlias(pointer client, FontPathElementPtr fpe, - char **namep, int *namelenp, - char **resolvedp, int *resolvedlenp, - pointer private) -{ - if (XpClientIsBitmapClient(client)) - return FontFileListNextFontOrAlias(client, fpe, namep, namelenp, - resolvedp, resolvedlenp, private); - return BadFontName; -} - -/* Font renderers to initialize when not linked into something like - Xorg that provides its own module configuration options */ -static const FontModule builtinFontModuleList[] = { -#ifdef XFONT_SPEEDO - { - SpeedoRegisterFontFileFunctions, - "speedo", - NULL - }, -#endif -#ifdef XFONT_TYPE1 - { - Type1RegisterFontFileFunctions, - "type1", - NULL - }, -#endif -#ifdef XFONT_FREETYPE - { - FreeTypeRegisterFontFileFunctions, - "freetype", - NULL - }, -#endif - /* List terminator - must be last entry */ - { NULL, NULL, NULL } -}; - -void -FontFileCheckRegisterFpeFunctions (void) -{ - const FontModule *fmlist = builtinFontModuleList; - -#ifdef XFONT_BITMAP - /* bitmap is always builtin to libXfont now */ - BitmapRegisterFontFileFunctions (); -#endif - -#ifdef LOADABLEFONTS - if (FontModuleList) { - fmlist = FontModuleList; - } -#endif - - if (fmlist) { - int i; - - for (i = 0; fmlist[i].name; i++) { - if (fmlist[i].initFunc) { - fmlist[i].initFunc(); - } - } - } - - RegisterFPEFunctions(FontFileNameCheck, - FontFileInitFPE, - FontFileFreeFPE, - FontFileResetFPE, - FontFileCheckOpenFont, - FontFileCloseFont, - FontFileCheckListFonts, - FontFileCheckStartListFontsWithInfo, - FontFileCheckListNextFontWithInfo, - NULL, - NULL, - NULL, - FontFileCheckStartListFontsAndAliases, - FontFileCheckListNextFontOrAlias, - FontFileEmptyBitmapSource); -} diff --git a/libXfont/src/fontfile/fileio.c b/libXfont/src/fontfile/fileio.c index 3733148a5..3e2f98a2b 100644 --- a/libXfont/src/fontfile/fileio.c +++ b/libXfont/src/fontfile/fileio.c @@ -57,12 +57,7 @@ FontFileOpen (const char *name) return 0; } len = strlen (name); -#ifndef __UNIXOS2__ if (len > 2 && !strcmp (name + len - 2, ".Z")) { -#else - if (len > 2 && (!strcmp (name + len - 4, ".pcz") || - !strcmp (name + len - 2, ".Z"))) { -#endif cooked = BufFilePushCompressed (raw); if (!cooked) { BufFileClose (raw, TRUE); diff --git a/libXfont/src/fontfile/filewr.c b/libXfont/src/fontfile/filewr.c index d076f166a..f9c53a2be 100644 --- a/libXfont/src/fontfile/filewr.c +++ b/libXfont/src/fontfile/filewr.c @@ -42,7 +42,7 @@ FontFileOpenWrite (const char *name) { int fd; -#if defined(WIN32) || defined(__UNIXOS2__) || defined(__CYGWIN__) +#if defined(WIN32) || defined(__CYGWIN__) fd = open (name, O_CREAT|O_TRUNC|O_RDWR|O_BINARY, 0666); #else fd = creat (name, 0666); diff --git a/libXfont/src/fontfile/fontdir.c b/libXfont/src/fontfile/fontdir.c index 00c751153..8b446a975 100644 --- a/libXfont/src/fontfile/fontdir.c +++ b/libXfont/src/fontfile/fontdir.c @@ -51,7 +51,7 @@ FontFileInitTable (FontTablePtr table, int size) return FALSE; if (size) { - table->entries = (FontEntryPtr) xalloc(sizeof(FontEntryRec) * size); + table->entries = malloc(sizeof(FontEntryRec) * size); if (!table->entries) return FALSE; } @@ -70,32 +70,28 @@ FontFileFreeEntry (FontEntryPtr entry) int i; if (entry->name.name) - xfree(entry->name.name); + free(entry->name.name); entry->name.name = NULL; switch (entry->type) { case FONT_ENTRY_SCALABLE: - xfree (entry->u.scalable.fileName); + free (entry->u.scalable.fileName); extra = entry->u.scalable.extra; for (i = 0; i < extra->numScaled; i++) if (extra->scaled[i].vals.ranges) - xfree (extra->scaled[i].vals.ranges); - xfree (extra->scaled); - xfree (extra); + free (extra->scaled[i].vals.ranges); + free (extra->scaled); + free (extra); break; case FONT_ENTRY_BITMAP: - xfree (entry->u.bitmap.fileName); + free (entry->u.bitmap.fileName); entry->u.bitmap.fileName = NULL; break; case FONT_ENTRY_ALIAS: - xfree (entry->u.alias.resolved); + free (entry->u.alias.resolved); entry->u.alias.resolved = NULL; break; -#ifdef NOTYET - case FONT_ENTRY_BC: - break; -#endif } } @@ -106,7 +102,7 @@ FontFileFreeTable (FontTablePtr table) for (i = 0; i < table->used; i++) FontFileFreeEntry (&table->entries[i]); - xfree (table->entries); + free (table->entries); } FontDirectoryPtr @@ -118,7 +114,7 @@ FontFileMakeDir(char *dirName, int size) char *attrib; int attriblen; -#if !defined(__UNIXOS2__) && !defined(WIN32) +#if !defined(WIN32) attrib = strchr(dirName, ':'); #else /* OS/2 uses the colon in the drive letter descriptor, skip this */ @@ -136,19 +132,19 @@ FontFileMakeDir(char *dirName, int size) if (dirlen) /* leave out slash for builtins */ #endif needslash = 1; - dir = (FontDirectoryPtr) xalloc(sizeof *dir + dirlen + needslash + 1 + - (attriblen ? attriblen + 1 : 0)); + dir = malloc(sizeof *dir + dirlen + needslash + 1 + + (attriblen ? attriblen + 1 : 0)); if (!dir) return (FontDirectoryPtr)0; if (!FontFileInitTable (&dir->scalable, 0)) { - xfree (dir); + free (dir); return (FontDirectoryPtr)0; } if (!FontFileInitTable (&dir->nonScalable, size)) { FontFileFreeTable (&dir->scalable); - xfree (dir); + free (dir); return (FontDirectoryPtr)0; } dir->directory = (char *) (dir + 1); @@ -172,7 +168,7 @@ FontFileFreeDir (FontDirectoryPtr dir) { FontFileFreeTable (&dir->scalable); FontFileFreeTable (&dir->nonScalable); - xfree(dir); + free(dir); } FontEntryPtr @@ -186,8 +182,7 @@ FontFileAddEntry(FontTablePtr table, FontEntryPtr prototype) return (FontEntryPtr) 0; /* "cannot" happen */ if (table->used == table->size) { newsize = table->size + 100; - entry = (FontEntryPtr) xrealloc(table->entries, - newsize * sizeof(FontEntryRec)); + entry = realloc(table->entries, newsize * sizeof(FontEntryRec)); if (!entry) return (FontEntryPtr)0; table->size = newsize; @@ -195,7 +190,7 @@ FontFileAddEntry(FontTablePtr table, FontEntryPtr prototype) } entry = &table->entries[table->used]; *entry = *prototype; - entry->name.name = (char *) xalloc(prototype->name.length + 1); + entry->name.name = malloc(prototype->name.length + 1); if (!entry->name.name) return (FontEntryPtr)0; memcpy (entry->name.name, prototype->name.name, prototype->name.length); @@ -439,7 +434,7 @@ FontFileSaveString (char *s) { char *n; - n = (char *) xalloc (strlen (s) + 1); + n = malloc (strlen (s) + 1); if (!n) return 0; strcpy (n, s); @@ -695,7 +690,7 @@ FontFileAddFontFile (FontDirectoryPtr dir, char *fontName, char *fileName) return FALSE; if (!(bitmap = FontFileAddEntry (&dir->nonScalable, &entry))) { - xfree (entry.u.bitmap.fileName); + free (entry.u.bitmap.fileName); return FALSE; } } @@ -723,7 +718,7 @@ FontFileAddFontFile (FontDirectoryPtr dir, char *fontName, char *fileName) { existing->u.scalable.extra->defaults = vals; - xfree (existing->u.scalable.fileName); + free (existing->u.scalable.fileName); if (!(existing->u.scalable.fileName = FontFileSaveString (fileName))) return FALSE; } @@ -738,10 +733,10 @@ FontFileAddFontFile (FontDirectoryPtr dir, char *fontName, char *fileName) } if (!(entry.u.scalable.fileName = FontFileSaveString (fileName))) return FALSE; - extra = (FontScalableExtraPtr) xalloc (sizeof (FontScalableExtraRec)); + extra = malloc (sizeof (FontScalableExtraRec)); if (!extra) { - xfree (entry.u.scalable.fileName); + free (entry.u.scalable.fileName); return FALSE; } bzero((char *)&extra->defaults, sizeof(extra->defaults)); @@ -791,8 +786,8 @@ FontFileAddFontFile (FontDirectoryPtr dir, char *fontName, char *fileName) entry.u.scalable.extra = extra; if (!(scalable = FontFileAddEntry (&dir->scalable, &entry))) { - xfree (extra); - xfree (entry.u.scalable.fileName); + free (extra); + free (entry.u.scalable.fileName); return FALSE; } if (vals.values_supplied & SIZE_SPECIFY_MASK) @@ -826,7 +821,7 @@ FontFileAddFontAlias (FontDirectoryPtr dir, char *aliasName, char *fontName) return FALSE; if (!FontFileAddEntry (&dir->nonScalable, &entry)) { - xfree (entry.u.alias.resolved); + free (entry.u.alias.resolved); return FALSE; } return TRUE; diff --git a/libXfont/src/fontfile/fontfile.c b/libXfont/src/fontfile/fontfile.c index f900f7508..a738c4d34 100644 --- a/libXfont/src/fontfile/fontfile.c +++ b/libXfont/src/fontfile/fontfile.c @@ -36,11 +36,33 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include <config.h> #endif -#include <X11/fonts/fntfilst.h> +#include <X11/fonts/fntfilst.h> +#include <X11/keysym.h> #ifdef WIN32 #include <ctype.h> #endif +static unsigned char +ISOLatin1ToLower(unsigned char source) +{ + if (source >= XK_A && source <= XK_Z) + return source + (XK_a - XK_A); + if (source >= XK_Agrave && source <= XK_Odiaeresis) + return source + (XK_agrave - XK_Agrave); + if (source >= XK_Ooblique && source <= XK_Thorn) + return source + (XK_oslash - XK_Ooblique); + return source; +} + +_X_HIDDEN void +CopyISOLatin1Lowered(char *dest, char *source, int length) +{ + int i; + for (i = 0; i < length; i++, source++, dest++) + *dest = ISOLatin1ToLower(*source); + *dest = '\0'; +} + /* * Map FPE functions to renderer functions */ @@ -55,7 +77,7 @@ int FontFileNameCheck (char *name) { #ifndef NCD -#if defined(__UNIXOS2__) || defined(WIN32) +#if defined(WIN32) /* OS/2 uses D:/... as a path name for fonts, so accept this as a valid * path if it starts with a letter and a colon. Same applies for WIN32 */ @@ -303,17 +325,6 @@ FontFileOpenFont (pointer client, FontPathElementPtr fpe, Mask flags, entry->u.alias.resolved, aliasName, &vals); ret = FontNameAlias; break; -#ifdef NOTYET - case FONT_ENTRY_BC: - bc = &entry->u.bc; - entry = bc->entry; - ret = (*scalable->renderer->OpenScalable) - (fpe, pFont, flags, entry, &bc->vals, format, fmask, - non_cachable_font); - if (ret == Successful && *pFont) - (*pFont)->fpe = fpe; - break; -#endif default: ret = BadFontName; } @@ -325,7 +336,7 @@ FontFileOpenFont (pointer client, FontPathElementPtr fpe, Mask flags, if (ret != BadFontName) { - if (ranges) xfree(ranges); + if (ranges) free(ranges); return ret; } @@ -476,7 +487,7 @@ FontFileOpenFont (pointer client, FontPathElementPtr fpe, Mask flags, ret = BadFontName; if (ranges) - xfree(ranges); + free(ranges); return ret; } @@ -730,7 +741,7 @@ _FontFileListFonts (pointer client, FontPathElementPtr fpe, scaleNames = MakeFontNamesRecord (0); if (!scaleNames) { - if (ranges) xfree(ranges); + if (ranges) free(ranges); return AllocError; } FontFileFindNamesInScalableDir (&dir->scalable, &zeroName, max, @@ -747,7 +758,7 @@ _FontFileListFonts (pointer client, FontPathElementPtr fpe, scaleNames = MakeFontNamesRecord (0); if (!scaleNames) { - if (ranges) xfree(ranges); + if (ranges) free(ranges); return AllocError; } FontFileFindNamesInScalableDir (&dir->nonScalable, &zeroName, @@ -760,7 +771,7 @@ _FontFileListFonts (pointer client, FontPathElementPtr fpe, &max); FreeFontNames (scaleNames); - if (ranges) xfree(ranges); + if (ranges) free(ranges); } else { @@ -802,13 +813,13 @@ FontFileStartListFonts(pointer client, FontPathElementPtr fpe, LFWIDataPtr data; int ret; - data = (LFWIDataPtr) xalloc (sizeof *data); + data = malloc (sizeof *data); if (!data) return AllocError; data->names = MakeFontNamesRecord (0); if (!data->names) { - xfree (data); + free (data); return AllocError; } ret = _FontFileListFonts (client, fpe, pat, len, @@ -816,7 +827,7 @@ FontFileStartListFonts(pointer client, FontPathElementPtr fpe, if (ret != Successful) { FreeFontNames (data->names); - xfree (data); + free (data); return ret; } data->current = 0; @@ -900,23 +911,6 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe, *namelenp = strlen (*namep); ret = FontNameAlias; break; -#ifdef NOTYET - case FONT_ENTRY_BC: - /* no LFWI for this yet */ - bc = &entry->u.bc; - entry = bc->entry; - /* Make a new scaled instance */ - if (strlen(dir->directory) + strlen(scalable->fileName) >= - sizeof(fileName)) { - ret = BadFontName; - } else { - strcpy (fileName, dir->directory); - strcat (fileName, scalable->fileName); - ret = (*scalable->renderer->GetInfoScalable) - (fpe, *pFontInfo, entry, tmpName, fileName, &bc->vals); - } - break; -#endif default: ret = BadFontName; } @@ -928,7 +922,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe, if (ret != BadFontName) { - if (ranges) xfree(ranges); + if (ranges) free(ranges); return ret; } @@ -1004,11 +998,6 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe, } else { -#ifdef NOTDEF - /* no special case yet */ - ret = FontFileMatchBitmapSource (fpe, pFont, flags, entry, &vals, format, fmask, noSpecificSize); - if (ret != Successful) -#endif { char origName[MAXFONTNAMELEN]; @@ -1034,7 +1023,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe, (fpe, *pFontInfo, entry, fileName); } if (ranges) { - xfree(ranges); + free(ranges); ranges = NULL; } } @@ -1048,7 +1037,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe, ret = BadFontName; if (ranges) - xfree(ranges); + free(ranges); return ret; } @@ -1066,7 +1055,7 @@ FontFileListNextFontWithInfo(pointer client, FontPathElementPtr fpe, if (data->current == data->names->nnames) { FreeFontNames (data->names); - xfree (data); + free (data); return BadFontName; } name = data->names->names[data->current]; @@ -1102,7 +1091,7 @@ FontFileListNextFontOrAlias(pointer client, FontPathElementPtr fpe, if (data->current == data->names->nnames) { FreeFontNames (data->names); - xfree (data); + free (data); return BadFontName; } name = data->names->names[data->current]; diff --git a/libXfont/src/fontfile/fontscale.c b/libXfont/src/fontfile/fontscale.c index 8e9de513d..8002dde81 100644 --- a/libXfont/src/fontfile/fontscale.c +++ b/libXfont/src/fontfile/fontscale.c @@ -35,13 +35,7 @@ in this Software without prior written authorization from The Open Group. #include <config.h> #endif #include <X11/fonts/fntfilst.h> -#ifdef _XOPEN_SOURCE #include <math.h> -#else -#define _XOPEN_SOURCE /* to get prototype for hypot on some systems */ -#include <math.h> -#undef _XOPEN_SOURCE -#endif Bool FontFileAddScaledInstance (FontEntryPtr entry, FontScalablePtr vals, @@ -57,8 +51,7 @@ FontFileAddScaledInstance (FontEntryPtr entry, FontScalablePtr vals, if (extra->numScaled == extra->sizeScaled) { newsize = extra->sizeScaled + 4; - new = (FontScaledPtr) xrealloc (extra->scaled, - newsize * sizeof (FontScaledRec)); + new = realloc (extra->scaled, newsize * sizeof (FontScaledRec)); if (!new) return FALSE; extra->sizeScaled = newsize; @@ -113,7 +106,7 @@ FontFileRemoveScaledInstance (FontEntryPtr entry, FontPtr pFont) if (extra->scaled[i].pFont == pFont) { if (extra->scaled[i].vals.ranges) - xfree (extra->scaled[i].vals.ranges); + free (extra->scaled[i].vals.ranges); extra->numScaled--; for (; i < extra->numScaled; i++) extra->scaled[i] = extra->scaled[i+1]; diff --git a/libXfont/src/fontfile/gunzip.c b/libXfont/src/fontfile/gunzip.c index 8c9c317aa..6cf192bb8 100644 --- a/libXfont/src/fontfile/gunzip.c +++ b/libXfont/src/fontfile/gunzip.c @@ -29,7 +29,7 @@ BufFilePushZIP (BufFilePtr f) { xzip_buf *x; - x = (xzip_buf *) xalloc (sizeof (xzip_buf)); + x = malloc (sizeof (xzip_buf)); if (!x) return 0; /* these are just for raw calloc/free */ x->z.zalloc = Z_NULL; @@ -46,7 +46,7 @@ BufFilePushZIP (BufFilePtr f) zlib header checking [undocumented, for gzip compatibility only?] */ x->zstat = inflateInit2(&(x->z), -MAX_WBITS); if (x->zstat != Z_OK) { - xfree(x); + free(x); return 0; } @@ -57,7 +57,7 @@ BufFilePushZIP (BufFilePtr f) x->z.avail_in = 0; if (BufCheckZipHeader(x->f)) { - xfree(x); + free(x); return 0; } @@ -74,7 +74,7 @@ BufZipFileClose(BufFilePtr f, int flag) xzip_buf *x = (xzip_buf *)f->private; inflateEnd (&(x->z)); BufFileClose (x->f, flag); - xfree (x); + free (x); return 1; } diff --git a/libXfont/src/fontfile/printerfont.c b/libXfont/src/fontfile/printerfont.c deleted file mode 100644 index 0b6c19c62..000000000 --- a/libXfont/src/fontfile/printerfont.c +++ /dev/null @@ -1,178 +0,0 @@ -/* $Xorg: printerfont.c,v 1.4 2001/02/09 02:04:03 xorgcvs Exp $ */ - -/* - -Copyright 1991, 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. - -*/ -/* $XFree86: xc/lib/font/fontfile/printerfont.c,v 1.5tsi Exp $ */ - -/* - * Author: Keith Packard, MIT X Consortium - */ -/* $NCDXorg: @(#)fontfile.c,v 1.6 1991/07/02 17:00:46 lemke Exp $ */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <X11/fonts/fntfilst.h> - -/* - * Map FPE functions to renderer functions - */ - -#define PRINTERPATHPREFIX "PRINTER:" - -/* STUB -int XpClientIsPrintClient(client,fpe) -pointer client; -FontPathElementPtr fpe; -{ return 1; } - */ - -static int -PrinterFontNameCheck (char *name) -{ - if (strncmp(name,PRINTERPATHPREFIX,strlen(PRINTERPATHPREFIX)) != 0) - return 0; - name += strlen(PRINTERPATHPREFIX); -#ifndef NCD - return *name == '/'; -#else - return ((strcmp(name, "built-ins") == 0) || (*name == '/')); -#endif -} - -static int -PrinterFontInitFPE (FontPathElementPtr fpe) -{ - int status; - FontDirectoryPtr dir; - char * name; - - name = fpe->name + strlen(PRINTERPATHPREFIX); - status = FontFileReadDirectory (name, &dir); - if (status == Successful) - { - if (dir->nonScalable.used > 0) - if (!FontFileRegisterBitmapSource (fpe)) - { - FontFileFreeFPE (fpe); - return AllocError; - } - fpe->private = (pointer) dir; - } - return status; -} - -/* Here we must check the client to see if it has a context attached to - * it that allows us to access the printer fonts - */ - -static int -PrinterFontOpenFont (pointer client, FontPathElementPtr fpe, Mask flags, - char *name, int namelen, - fsBitmapFormat format, fsBitmapFormatMask fmask, - XID id, FontPtr *pFont, char **aliasName, - FontPtr non_cachable_font) -{ - if (XpClientIsPrintClient(client,fpe)) - return (FontFileOpenFont (client, fpe, flags, name, namelen, format, - fmask, id, pFont, aliasName, non_cachable_font)); - return BadFontName; -} - -static int -PrinterFontListFonts (pointer client, FontPathElementPtr fpe, char *pat, - int len, int max, FontNamesPtr names) -{ - if (XpClientIsPrintClient(client,fpe)) - return FontFileListFonts (client, fpe, pat, len, max, names); - return BadFontName; -} - -static int -PrinterFontStartListFontsWithInfo(pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, - pointer *privatep) -{ - if (XpClientIsPrintClient(client,fpe)) - return FontFileStartListFontsWithInfo(client, fpe, pat, len, - max, privatep); - return BadFontName; -} - -static int -PrinterFontListNextFontWithInfo(pointer client, FontPathElementPtr fpe, - char **namep, int *namelenp, - FontInfoPtr *pFontInfo, - int *numFonts, pointer private) -{ - if (XpClientIsPrintClient(client,fpe)) - return FontFileListNextFontWithInfo(client, fpe, namep, namelenp, - pFontInfo, numFonts, private); - return BadFontName; -} - -static int -PrinterFontStartListFontsAndAliases(pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, - pointer *privatep) -{ - if (XpClientIsPrintClient(client,fpe)) - return FontFileStartListFontsAndAliases(client, fpe, pat, len, - max, privatep); - return BadFontName; -} - -static int -PrinterFontListNextFontOrAlias(pointer client, FontPathElementPtr fpe, - char **namep, int *namelenp, - char **resolvedp, int *resolvedlenp, - pointer private) -{ - if (XpClientIsPrintClient(client,fpe)) - return FontFileListNextFontOrAlias(client, fpe, namep, namelenp, - resolvedp, resolvedlenp, private); - return BadFontName; -} - -void -PrinterFontRegisterFpeFunctions (void) -{ - RegisterFPEFunctions(PrinterFontNameCheck, - PrinterFontInitFPE, - FontFileFreeFPE, - FontFileResetFPE, - PrinterFontOpenFont, - FontFileCloseFont, - PrinterFontListFonts, - PrinterFontStartListFontsWithInfo, - PrinterFontListNextFontWithInfo, - NULL, - NULL, - NULL, - PrinterFontStartListFontsAndAliases, - PrinterFontListNextFontOrAlias, - FontFileEmptyBitmapSource); -} diff --git a/libXfont/src/fontfile/register.c b/libXfont/src/fontfile/register.c index 5b70df76a..1a63cb331 100644 --- a/libXfont/src/fontfile/register.c +++ b/libXfont/src/fontfile/register.c @@ -1,5 +1,3 @@ -/* $Xorg: register.c,v 1.4 2001/02/09 02:04:03 xorgcvs Exp $ */ - /* Copyright 1994, 1998 The Open Group @@ -25,13 +23,6 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/font/fontfile/register.c,v 1.14 2001/01/17 19:43:30 dawes Exp $ */ - -/* - * This is in a separate source file so that small programs - * such as mkfontdir that want to use the fontfile utilities don't - * end up dragging in code from all the renderers, which is not small. - */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -42,7 +33,6 @@ in this Software without prior written authorization from The Open Group. #include <X11/fonts/fontmisc.h> #include <X11/fonts/fntfilst.h> #include <X11/fonts/bitmap.h> -#include <X11/fonts/fontmod.h> /* * Translate monolithic build symbols to modular build symbols. @@ -51,72 +41,20 @@ in this Software without prior written authorization from The Open Group. * with other packages. */ -#ifndef CRAY -# ifdef BUILD_SPEEDO -# define XFONT_SPEEDO 1 -# endif -# ifdef BUILD_TYPE1 -# define XFONT_TYPE1 1 -# endif -#endif - #ifdef BUILD_FREETYPE # define XFONT_FREETYPE 1 #endif -/* Font renderers to initialize when not linked into something like - Xorg that provides its own module configuration options */ -static const FontModule builtinFontModuleList[] = { -#ifdef XFONT_SPEEDO - { - SpeedoRegisterFontFileFunctions, - "speedo", - NULL - }, -#endif -#ifdef XFONT_TYPE1 - { - Type1RegisterFontFileFunctions, - "type1", - NULL - }, -#endif -#ifdef XFONT_FREETYPE - { - FreeTypeRegisterFontFileFunctions, - "freetype", - NULL - }, -#endif - /* List terminator - must be last entry */ - { NULL, NULL, NULL } -}; - void FontFileRegisterFpeFunctions(void) { - const FontModule *fmlist = builtinFontModuleList; - #ifdef XFONT_BITMAP /* bitmap is always builtin to libXfont now */ BitmapRegisterFontFileFunctions (); #endif - -#ifdef LOADABLEFONTS - if (FontModuleList) { - fmlist = FontModuleList; - } -#endif - - if (fmlist) { - int i; - - for (i = 0; fmlist[i].name; i++) { - if (fmlist[i].initFunc) { - fmlist[i].initFunc(); - } - } - } +#ifdef XFONT_FREETYPE + FreeTypeRegisterFontFileFunctions(); +#endif FontFileRegisterLocalFpeFunctions (); CatalogueRegisterLocalFpeFunctions (); diff --git a/libXfont/src/fontfile/renderers.c b/libXfont/src/fontfile/renderers.c index f110ba817..bf82c1c1e 100644 --- a/libXfont/src/fontfile/renderers.c +++ b/libXfont/src/fontfile/renderers.c @@ -1,5 +1,3 @@ -/* $Xorg: renderers.c,v 1.4 2001/02/09 02:04:03 xorgcvs Exp $ */ - /* Copyright 1991, 1998 The Open Group @@ -62,13 +60,13 @@ FontFilePriorityRegisterRenderer (FontRendererPtr renderer, int priority) rendererGeneration = serverGeneration; renderers.number = 0; if (renderers.renderers) - xfree(renderers.renderers); + free(renderers.renderers); renderers.renderers = NULL; } for (i = 0; i < renderers.number; i++) { - if (!strcmp (renderers.renderers[i].renderer->fileSuffix, - renderer->fileSuffix)) { + if (!strcasecmp (renderers.renderers[i].renderer->fileSuffix, + renderer->fileSuffix)) { if(renderers.renderers[i].priority >= priority) { if(renderers.renderers[i].priority == priority) { if (rendererGeneration == 1) @@ -84,7 +82,7 @@ FontFilePriorityRegisterRenderer (FontRendererPtr renderer, int priority) } if(i >= renderers.number) { - new = xrealloc (renderers.renderers, sizeof(*new) * (i + 1)); + new = realloc (renderers.renderers, sizeof(*new) * (i + 1)); if (!new) return FALSE; renderers.renderers = new; @@ -108,7 +106,7 @@ FontFileMatchRenderer (char *fileName) { r = renderers.renderers[i].renderer; if (fileLen >= r->fileSuffixLen && - !strcmp (fileName + fileLen - r->fileSuffixLen, r->fileSuffix)) + !strcasecmp (fileName + fileLen - r->fileSuffixLen, r->fileSuffix)) { return r; } |