summaryrefslogtreecommitdiff
path: root/src/fontfile
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-14 16:48:50 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-14 16:48:50 +0000
commit4349bf0fa125e2a1c32b0b49c974ff5fa588cdbe (patch)
tree2e4b857f2103cfbcdfcfd53b47334166e139a273 /src/fontfile
parent3795e9702b3b3a6fe0594d09cdd110adeb5e42f9 (diff)
Diffstat (limited to 'src/fontfile')
-rw-r--r--src/fontfile/bitsource.c28
-rw-r--r--src/fontfile/bufio.c74
-rw-r--r--src/fontfile/decompress.c35
-rw-r--r--src/fontfile/defaults.c7
-rw-r--r--src/fontfile/dirfile.c87
-rw-r--r--src/fontfile/ffcheck.c139
-rw-r--r--src/fontfile/fileio.c14
-rw-r--r--src/fontfile/filewr.c11
-rw-r--r--src/fontfile/fontdir.c233
-rw-r--r--src/fontfile/fontfile.c194
-rw-r--r--src/fontfile/fontscale.c43
-rw-r--r--src/fontfile/gunzip.c36
-rw-r--r--src/fontfile/printerfont.c113
-rw-r--r--src/fontfile/register.c39
-rw-r--r--src/fontfile/renderers.c71
15 files changed, 588 insertions, 536 deletions
diff --git a/src/fontfile/bitsource.c b/src/fontfile/bitsource.c
index ac77875..0230535 100644
--- a/src/fontfile/bitsource.c
+++ b/src/fontfile/bitsource.c
@@ -25,6 +25,7 @@ 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/bitsource.c,v 1.4 2001/12/14 19:56:49 dawes Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
@@ -35,8 +36,7 @@ in this Software without prior written authorization from The Open Group.
BitmapSourcesRec FontFileBitmapSources;
Bool
-FontFileRegisterBitmapSource (fpe)
- FontPathElementPtr fpe;
+FontFileRegisterBitmapSource (FontPathElementPtr fpe)
{
FontPathElementPtr *new;
int i;
@@ -59,8 +59,7 @@ FontFileRegisterBitmapSource (fpe)
}
void
-FontFileUnregisterBitmapSource (fpe)
- FontPathElementPtr fpe;
+FontFileUnregisterBitmapSource (FontPathElementPtr fpe)
{
int i;
@@ -90,7 +89,7 @@ FontFileUnregisterBitmapSource (fpe)
* The bitmap sources in the new path will be registered by the init_func.
*/
void
-FontFileEmptyBitmapSource()
+FontFileEmptyBitmapSource(void)
{
if (FontFileBitmapSources.count == 0)
return;
@@ -102,16 +101,15 @@ FontFileEmptyBitmapSource()
}
int
-FontFileMatchBitmapSource (fpe, pFont, flags, entry, zeroPat, vals, format, fmask, noSpecificSize)
- FontPathElementPtr fpe;
- FontPtr *pFont;
- int flags;
- FontEntryPtr entry;
- FontNamePtr zeroPat;
- FontScalablePtr vals;
- fsBitmapFormat format;
- fsBitmapFormatMask fmask;
- Bool noSpecificSize;
+FontFileMatchBitmapSource (FontPathElementPtr fpe,
+ FontPtr *pFont,
+ int flags,
+ FontEntryPtr entry,
+ FontNamePtr zeroPat,
+ FontScalablePtr vals,
+ fsBitmapFormat format,
+ fsBitmapFormatMask fmask,
+ Bool noSpecificSize)
{
int source;
FontEntryPtr zero;
diff --git a/src/fontfile/bufio.c b/src/fontfile/bufio.c
index 40293c5..19d61bf 100644
--- a/src/fontfile/bufio.c
+++ b/src/fontfile/bufio.c
@@ -27,6 +27,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/font/fontfile/bufio.c,v 3.10 2002/05/31 18:45:49 dawes Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
@@ -37,16 +38,13 @@ from The Open Group.
#include <fontmisc.h>
#include <bufio.h>
#include <errno.h>
-#ifdef X_NOT_STDC_ENV
-extern int errno;
-#endif
BufFilePtr
-BufFileCreate (private, io, skip, close)
- char *private;
- int (*io)();
- int (*skip)();
- int (*close)();
+BufFileCreate (char *private,
+ int (*input)(BufFilePtr),
+ int (*output)(int, BufFilePtr),
+ int (*skip)(BufFilePtr, int),
+ int (*close)(BufFilePtr, int))
{
BufFilePtr f;
@@ -56,17 +54,18 @@ BufFileCreate (private, io, skip, close)
f->private = private;
f->bufp = f->buffer;
f->left = 0;
- f->io = io;
+ f->input = input;
+ f->output = output;
f->skip = skip;
+ f->eof = 0;
f->close = close;
return f;
}
-#define FileDes(f) ((int) (f)->private)
+#define FileDes(f) ((int)(long) (f)->private)
static int
-BufFileRawFill (f)
- BufFilePtr f;
+BufFileRawFill (BufFilePtr f)
{
int left;
@@ -81,9 +80,7 @@ BufFileRawFill (f)
}
static int
-BufFileRawSkip (f, count)
- BufFilePtr f;
- int count;
+BufFileRawSkip (BufFilePtr f, int count)
{
int curoff;
int fileoff;
@@ -115,8 +112,7 @@ BufFileRawSkip (f, count)
}
static int
-BufFileRawClose (f, doClose)
- BufFilePtr f;
+BufFileRawClose (BufFilePtr f, int doClose)
{
if (doClose)
close (FileDes (f));
@@ -124,16 +120,17 @@ BufFileRawClose (f, doClose)
}
BufFilePtr
-BufFileOpenRead (fd)
- int fd;
+BufFileOpenRead (int fd)
{
- return BufFileCreate ((char *) fd, BufFileRawFill, BufFileRawSkip, BufFileRawClose);
+#ifdef __UNIXOS2__
+ /* hv: I'd bet WIN32 has the same effect here */
+ setmode(fd,O_BINARY);
+#endif
+ return BufFileCreate ((char *)(long) fd, BufFileRawFill, 0, BufFileRawSkip, BufFileRawClose);
}
static int
-BufFileRawFlush (c, f)
- int c;
- BufFilePtr f;
+BufFileRawFlush (int c, BufFilePtr f)
{
int cnt;
@@ -148,22 +145,22 @@ BufFileRawFlush (c, f)
}
BufFilePtr
-BufFileOpenWrite (fd)
- int fd;
+BufFileOpenWrite (int fd)
{
BufFilePtr f;
- f = BufFileCreate ((char *) fd, BufFileRawFlush, 0, BufFileFlush);
+#ifdef __UNIXOS2__
+ /* hv: I'd bet WIN32 has the same effect here */
+ setmode(fd,O_BINARY);
+#endif
+ f = BufFileCreate ((char *)(long) fd, 0, BufFileRawFlush, 0, BufFileFlush);
f->bufp = f->buffer;
f->left = BUFFILESIZE;
return f;
}
int
-BufFileRead (f, b, n)
- BufFilePtr f;
- char *b;
- int n;
+BufFileRead (BufFilePtr f, char *b, int n)
{
int c, cnt;
cnt = n;
@@ -177,10 +174,7 @@ BufFileRead (f, b, n)
}
int
-BufFileWrite (f, b, n)
- BufFilePtr f;
- char *b;
- int n;
+BufFileWrite (BufFilePtr f, char *b, int n)
{
int cnt;
cnt = n;
@@ -192,18 +186,15 @@ BufFileWrite (f, b, n)
}
int
-BufFileFlush (f)
- BufFilePtr f;
+BufFileFlush (BufFilePtr f, int doClose)
{
if (f->bufp != f->buffer)
- return (*f->io) (BUFFILEEOF, f);
+ return (*f->output) (BUFFILEEOF, f);
return 0;
}
int
-BufFileClose (f, doClose)
- BufFilePtr f;
- int doClose;
+BufFileClose (BufFilePtr f, int doClose)
{
int ret;
ret = (*f->close) (f, doClose);
@@ -212,8 +203,7 @@ BufFileClose (f, doClose)
}
void
-BufFileFree (f)
- BufFilePtr f;
+BufFileFree (BufFilePtr f)
{
xfree (f);
}
diff --git a/src/fontfile/decompress.c b/src/fontfile/decompress.c
index aef4461..187254d 100644
--- a/src/fontfile/decompress.c
+++ b/src/fontfile/decompress.c
@@ -45,6 +45,7 @@ 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/decompress.c,v 1.5 2001/12/14 19:56:50 dawes Exp $ */
/*
* decompress - cat a compressed file
*/
@@ -88,8 +89,6 @@ static char_type magic_header[] = { "\037\235" }; /* 1F 9D */
# define MAXCODE(n_bits) ((1 << (n_bits)) - 1)
#endif /* COMPATIBLE */
-static code_int getcode();
-
/*
* the next two codes should not be changed lightly, as they must not
* lie within the contiguous general code space.
@@ -132,11 +131,13 @@ static int hsize_table[] = {
69001 /* 16 bits - 95% occupancy */
};
-static int BufCompressedFill(), BufCompressedSkip(), BufCompressedClose();
+static int BufCompressedClose ( BufFilePtr f, int doClose );
+static int BufCompressedFill ( BufFilePtr f );
+static code_int getcode ( CompressedFile *file );
+static int BufCompressedSkip ( BufFilePtr f, int bytes );
BufFilePtr
-BufFilePushCompressed (f)
- BufFilePtr f;
+BufFilePushCompressed (BufFilePtr f)
{
int code;
int maxbits;
@@ -150,6 +151,8 @@ BufFilePushCompressed (f)
return 0;
}
code = BufFileGet (f);
+ if (code == BUFFILEEOF) return 0;
+
maxbits = code & BIT_MASK;
if (maxbits > BITS || maxbits < 12)
return 0;
@@ -184,13 +187,13 @@ BufFilePushCompressed (f)
*file->stackp++ = file->finchar;
return BufFileCreate ((char *) file,
BufCompressedFill,
+ 0,
BufCompressedSkip,
BufCompressedClose);
}
static int
-BufCompressedClose (f, doClose)
- BufFilePtr f;
+BufCompressedClose (BufFilePtr f, int doClose)
{
CompressedFile *file;
BufFilePtr raw;
@@ -203,8 +206,7 @@ BufCompressedClose (f, doClose)
}
static int
-BufCompressedFill (f)
- BufFilePtr f;
+BufCompressedFill (BufFilePtr f)
{
CompressedFile *file;
register char_type *stackp, *de_stack;
@@ -300,8 +302,7 @@ BufCompressedFill (f)
static char_type rmask[9] = {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff};
static code_int
-getcode(file)
- CompressedFile *file;
+getcode(CompressedFile *file)
{
register code_int code;
register int r_off, bits;
@@ -375,9 +376,7 @@ getcode(file)
}
static int
-BufCompressedSkip (f, bytes)
- BufFilePtr f;
- int bytes;
+BufCompressedSkip (BufFilePtr f, int bytes)
{
int c;
while (bytes--)
@@ -390,9 +389,8 @@ BufCompressedSkip (f, bytes)
}
#ifdef TEST
-main (argc, argv)
- int argc;
- char **argv;
+int
+main (int argc, char *argv[])
{
BufFilePtr inputraw, input, output;
int c;
@@ -400,9 +398,10 @@ main (argc, argv)
inputraw = BufFileOpenRead (0);
input = BufFilePushCompressed (inputraw);
output = BufFileOpenWrite (1);
- while ((c = BufFileGet (input)) != -1)
+ while ((c = BufFileGet (input)) != BUFFILEEOF)
BufFilePut (c, output);
BufFileClose (input, FALSE);
BufFileClose (output, FALSE);
+ return 0;
}
#endif
diff --git a/src/fontfile/defaults.c b/src/fontfile/defaults.c
index 2738287..6425d20 100644
--- a/src/fontfile/defaults.c
+++ b/src/fontfile/defaults.c
@@ -25,6 +25,7 @@ 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/defaults.c,v 1.8 2001/12/14 19:56:50 dawes Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
@@ -62,8 +63,10 @@ in this Software without prior written authorization from The Open Group.
#define DEFAULT_SCAN_UNIT 1
#endif
-FontDefaultFormat (bit, byte, glyph, scan)
- int *bit, *byte, *glyph, *scan;
+#include "fntfilst.h"
+
+void
+FontDefaultFormat (int *bit, int *byte, int *glyph, int *scan)
{
*bit = DEFAULT_BIT_ORDER;
*byte = DEFAULT_BYTE_ORDER;
diff --git a/src/fontfile/dirfile.c b/src/fontfile/dirfile.c
index 82f0d10..5f90501 100644
--- a/src/fontfile/dirfile.c
+++ b/src/fontfile/dirfile.c
@@ -25,6 +25,7 @@ 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/dirfile.c,v 3.15 2002/05/31 18:45:50 dawes Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
@@ -41,20 +42,23 @@ in this Software without prior written authorization from The Open Group.
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
-#ifdef X_NOT_STDC_ENV
-extern int errno;
-#endif
-static int ReadFontAlias();
+static Bool AddFileNameAliases ( FontDirectoryPtr dir );
+static int ReadFontAlias ( char *directory, Bool isFile,
+ FontDirectoryPtr *pdir );
+static int lexAlias ( FILE *file, char **lexToken );
+static int lexc ( FILE *file );
int
-FontFileReadDirectory (directory, pdir)
- char *directory;
- FontDirectoryPtr *pdir;
+FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir)
{
char file_name[MAXFONTFILENAMELEN];
char font_name[MAXFONTNAMELEN];
char dir_file[MAXFONTFILENAMELEN];
+#ifdef FONTDIRATTRIB
+ char dir_path[MAXFONTFILENAMELEN];
+ char *ptr;
+#endif
FILE *file;
int count,
i,
@@ -64,8 +68,24 @@ FontFileReadDirectory (directory, pdir)
FontDirectoryPtr dir = NullFontDirectory;
+#ifdef FONTDIRATTRIB
+ /* Check for font directory attributes */
+#ifndef __UNIXOS2__
+ if ((ptr = strchr(directory, ':'))) {
+#else
+ /* OS/2 path might start with a drive letter, don't clip this */
+ if (ptr = strchr(directory+2, ':')) {
+#endif
+ strncpy(dir_path, directory, ptr - directory);
+ dir_path[ptr - directory] = '\0';
+ } else {
+ strcpy(dir_path, directory);
+ }
+ strcpy(dir_file, dir_path);
+#else
strcpy(dir_file, directory);
- if (directory[strlen(directory) - 1] != '/')
+#endif
+ if (dir_file[strlen(dir_file) - 1] != '/')
strcat(dir_file, "/");
strcat(dir_file, FontDirFile);
file = fopen(dir_file, "r");
@@ -85,8 +105,14 @@ FontFileReadDirectory (directory, pdir)
dir->dir_mtime = statb.st_mtime;
if (format[0] == '\0')
sprintf(format, "%%%ds %%%d[^\n]\n",
- MAXFONTFILENAMELEN-1, MAXFONTNAMELEN-1);
+ MAXFONTFILENAMELEN-1, MAXFONTNAMELEN-1);
while ((count = fscanf(file, format, file_name, font_name)) != EOF) {
+#ifdef __UNIXOS2__
+ /* strip any existing trailing CR */
+ for (i=0; i<strlen(font_name); i++) {
+ if (font_name[i]=='\r') font_name[i] = '\0';
+ }
+#endif
if (count != 2) {
FontFileFreeDir (dir);
fclose(file);
@@ -103,7 +129,11 @@ FontFileReadDirectory (directory, pdir)
} else if (errno != ENOENT) {
return BadFontPath;
}
+#ifdef FONTDIRATTRIB
+ status = ReadFontAlias(dir_path, FALSE, &dir);
+#else
status = ReadFontAlias(directory, FALSE, &dir);
+#endif
if (status != Successful) {
if (dir)
FontFileFreeDir (dir);
@@ -119,10 +149,9 @@ FontFileReadDirectory (directory, pdir)
}
Bool
-FontFileDirectoryChanged(dir)
- FontDirectoryPtr dir;
+FontFileDirectoryChanged(FontDirectoryPtr dir)
{
- char dir_file[MAXFONTNAMELEN];
+ char dir_file[MAXFONTFILENAMELEN];
struct stat statb;
strcpy (dir_file, dir->directory);
@@ -153,11 +182,10 @@ FontFileDirectoryChanged(dir)
*/
static Bool
-AddFileNameAliases(dir)
- FontDirectoryPtr dir;
+AddFileNameAliases(FontDirectoryPtr dir)
{
int i;
- char copy[MAXFONTNAMELEN];
+ char copy[MAXFONTFILENAMELEN];
char *fileName;
FontTablePtr table;
FontRendererPtr renderer;
@@ -198,29 +226,24 @@ AddFileNameAliases(dir)
* "font name \"With Double Quotes\" \\ and \\ back-slashes"
* works just fine.
*
- * A line beginning with a # denotes a newline-terminated comment.
+ * A line beginning with a ! denotes a newline-terminated comment.
*/
/*
* token types
*/
-static int lexAlias(), lexc();
-
#define NAME 0
#define NEWLINE 1
#define DONE 2
#define EALLOC 3
static int
-ReadFontAlias(directory, isFile, pdir)
- char *directory;
- Bool isFile;
- FontDirectoryPtr *pdir;
+ReadFontAlias(char *directory, Bool isFile, FontDirectoryPtr *pdir)
{
char alias[MAXFONTNAMELEN];
char font_name[MAXFONTNAMELEN];
- char alias_file[MAXFONTNAMELEN];
+ char alias_file[MAXFONTFILENAMELEN];
FILE *file;
FontDirectoryPtr dir;
int token;
@@ -279,12 +302,8 @@ ReadFontAlias(directory, isFile, pdir)
status = AllocError;
break;
case NAME:
- CopyISOLatin1Lowered((unsigned char *) alias,
- (unsigned char *) alias,
- strlen(alias));
- CopyISOLatin1Lowered((unsigned char *) font_name,
- (unsigned char *) lexToken,
- strlen(lexToken));
+ CopyISOLatin1Lowered(alias, alias, strlen(alias));
+ CopyISOLatin1Lowered(font_name, lexToken, strlen(lexToken));
if (!FontFileAddFontAlias (dir, alias, font_name))
status = AllocError;
break;
@@ -305,9 +324,7 @@ ReadFontAlias(directory, isFile, pdir)
static int charClass;
static int
-lexAlias(file, lexToken)
- FILE *file;
- char **lexToken;
+lexAlias(FILE *file, char **lexToken)
{
int c;
char *t;
@@ -370,6 +387,8 @@ lexAlias(file, lexToken)
break;
case Comment:
continue;
+ default:
+ break;
}
*t++ = c;
++count;
@@ -405,8 +424,7 @@ lexAlias(file, lexToken)
}
static int
-lexc(file)
- FILE *file;
+lexc(FILE *file)
{
int c;
@@ -429,6 +447,7 @@ lexc(file)
case '\t':
charClass = WHITE;
break;
+ case '\r':
case '\n':
charClass = NL;
break;
diff --git a/src/fontfile/ffcheck.c b/src/fontfile/ffcheck.c
index 6f29801..4de2a4b 100644
--- a/src/fontfile/ffcheck.c
+++ b/src/fontfile/ffcheck.c
@@ -25,43 +25,34 @@ 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.15 2001/12/14 19:56:51 dawes Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
*/
-/* $NCDId: @(#)fontfile.c,v 1.6 1991/07/02 17:00:46 lemke Exp $ */
+/* $NCDXorg: @(#)fontfile.c,v 1.6 1991/07/02 17:00:46 lemke Exp $ */
-#include "fntfilst.h"
+#include "fntfilst.h"
+#include "bitmap.h"
+#ifdef LOADABLEFONTS
+#include "fontmod.h"
+#endif
/*
* Map FPE functions to renderer functions
*/
-extern int FontFileNameCheck();
-extern int FontFileInitFPE();
-extern int FontFileResetFPE();
-extern int FontFileFreeFPE();
-extern void FontFileCloseFont();
-
/* Here we must check the client to see if it has a context attached to
* it that allows us to access the printer fonts
*/
-int
-FontFileCheckOpenFont (client, fpe, flags, name, namelen, format, fmask,
- id, pFont, aliasName, non_cachable_font)
- pointer client;
- FontPathElementPtr fpe;
- int flags;
- char *name;
- int namelen;
- fsBitmapFormat format;
- fsBitmapFormatMask fmask;
- XID id;
- FontPtr *pFont;
- char **aliasName;
- FontPtr non_cachable_font;
+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,
@@ -69,28 +60,19 @@ FontFileCheckOpenFont (client, fpe, flags, name, namelen, format, fmask,
return BadFontName;
}
-int
-FontFileCheckListFonts (client, fpe, pat, len, max, names)
- pointer client;
- FontPathElementPtr fpe;
- char *pat;
- int len;
- int max;
- FontNamesPtr names;
+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;
}
-int
-FontFileCheckStartListFontsWithInfo(client, fpe, pat, len, max, privatep)
- pointer client;
- FontPathElementPtr fpe;
- char *pat;
- int len;
- int max;
- pointer *privatep;
+static int
+FontFileCheckStartListFontsWithInfo(pointer client, FontPathElementPtr fpe,
+ char *pat, int len, int max,
+ pointer *privatep)
{
if (XpClientIsBitmapClient(client))
return FontFileStartListFontsWithInfo(client, fpe, pat, len,
@@ -98,16 +80,11 @@ FontFileCheckStartListFontsWithInfo(client, fpe, pat, len, max, privatep)
return BadFontName;
}
-int
-FontFileCheckListNextFontWithInfo(client, fpe, namep, namelenp, pFontInfo,
- numFonts, private)
- pointer client;
- FontPathElementPtr fpe;
- char **namep;
- int *namelenp;
- FontInfoPtr *pFontInfo;
- int *numFonts;
- pointer private;
+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,
@@ -115,14 +92,10 @@ FontFileCheckListNextFontWithInfo(client, fpe, namep, namelenp, pFontInfo,
return BadFontName;
}
-int
-FontFileCheckStartListFontsAndAliases(client, fpe, pat, len, max, privatep)
- pointer client;
- FontPathElementPtr fpe;
- char *pat;
- int len;
- int max;
- pointer *privatep;
+static int
+FontFileCheckStartListFontsAndAliases(pointer client, FontPathElementPtr fpe,
+ char *pat, int len, int max,
+ pointer *privatep)
{
if (XpClientIsBitmapClient(client))
return FontFileStartListFontsAndAliases(client, fpe, pat, len,
@@ -130,16 +103,11 @@ FontFileCheckStartListFontsAndAliases(client, fpe, pat, len, max, privatep)
return BadFontName;
}
-int
-FontFileCheckListNextFontOrAlias(client, fpe, namep, namelenp, resolvedp,
- resolvedlenp, private)
- pointer client;
- FontPathElementPtr fpe;
- char **namep;
- int *namelenp;
- char **resolvedp;
- int *resolvedlenp;
- pointer private;
+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,
@@ -147,24 +115,51 @@ FontFileCheckListNextFontOrAlias(client, fpe, namep, namelenp, resolvedp,
return BadFontName;
}
-extern void FontFileEmptyBitmapSource();
-typedef int (*IntFunc) ();
+typedef int (*IntFunc) (void);
static int font_file_check_type;
void
-FontFileCheckRegisterFpeFunctions ()
+FontFileCheckRegisterFpeFunctions (void)
{
+#ifndef LOADABLEFONTS
BitmapRegisterFontFileFunctions ();
#ifndef LOWMEMFTPT
#ifndef CRAY
+#ifdef BUILD_SPEEDO
SpeedoRegisterFontFileFunctions ();
+#endif
+#ifdef BUILD_TYPE1
Type1RegisterFontFileFunctions();
#endif
+#endif
+#ifdef BUILD_CID
+ CIDRegisterFontFileFunctions();
+#endif
+#ifdef BUILD_FREETYPE
+ FreeTypeRegisterFontFileFunctions();
+#endif
+#ifdef BUILD_XTRUETYPE
+ XTrueTypeRegisterFontFileFunctions();
+#endif
#endif /* ifndef LOWMEMFTPT */
+#else
+
+ {
+ int i;
+
+ if (FontModuleList) {
+ for (i = 0; FontModuleList[i].name; i++) {
+ if (FontModuleList[i].initFunc)
+ FontModuleList[i].initFunc();
+ }
+ }
+ }
+#endif
+
font_file_check_type = RegisterFPEFunctions(FontFileNameCheck,
FontFileInitFPE,
FontFileFreeFPE,
@@ -174,9 +169,9 @@ FontFileCheckRegisterFpeFunctions ()
FontFileCheckListFonts,
FontFileCheckStartListFontsWithInfo,
FontFileCheckListNextFontWithInfo,
- (IntFunc) 0,
- (IntFunc) 0,
- (IntFunc) 0,
+ NULL,
+ NULL,
+ NULL,
FontFileCheckStartListFontsAndAliases,
FontFileCheckListNextFontOrAlias,
FontFileEmptyBitmapSource);
diff --git a/src/fontfile/fileio.c b/src/fontfile/fileio.c
index 43c84ab..8a7cb03 100644
--- a/src/fontfile/fileio.c
+++ b/src/fontfile/fileio.c
@@ -25,6 +25,7 @@ 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/fileio.c,v 3.10 2002/05/31 18:45:50 dawes Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
@@ -33,12 +34,11 @@ in this Software without prior written authorization from The Open Group.
#include <fntfilio.h>
#include <X11/Xos.h>
#ifndef O_BINARY
-#define O_BINARY 0
+#define O_BINARY O_RDONLY
#endif
FontFilePtr
-FontFileOpen (name)
- char *name;
+FontFileOpen (const char *name)
{
int fd;
int len;
@@ -54,7 +54,12 @@ FontFileOpen (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);
@@ -75,8 +80,7 @@ FontFileOpen (name)
}
int
-FontFileClose (f)
- FontFilePtr f;
+FontFileClose (FontFilePtr f)
{
return BufFileClose ((BufFilePtr) f, TRUE);
}
diff --git a/src/fontfile/filewr.c b/src/fontfile/filewr.c
index d8ed5b5..8de8f26 100644
--- a/src/fontfile/filewr.c
+++ b/src/fontfile/filewr.c
@@ -25,6 +25,7 @@ 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/filewr.c,v 3.7 2002/05/31 18:45:50 dawes Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
@@ -34,12 +35,11 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xos.h>
FontFilePtr
-FontFileOpenWrite (name)
- char *name;
+FontFileOpenWrite (const char *name)
{
int fd;
-#ifdef WIN32
+#if defined(WIN32) || defined(__UNIXOS2__) || defined(__CYGWIN__)
fd = open (name, O_CREAT|O_TRUNC|O_RDWR|O_BINARY, 0666);
#else
fd = creat (name, 0666);
@@ -50,14 +50,13 @@ FontFileOpenWrite (name)
}
FontFilePtr
-FontFileOpenWriteFd (fd)
+FontFileOpenWriteFd (int fd)
{
return (FontFilePtr) BufFileOpenWrite (fd);
}
FontFilePtr
-FontFileOpenFd (fd)
- int fd;
+FontFileOpenFd (int fd)
{
return (FontFilePtr) BufFileOpenRead (fd);
}
diff --git a/src/fontfile/fontdir.c b/src/fontfile/fontdir.c
index beca5af..a2bd411 100644
--- a/src/fontfile/fontdir.c
+++ b/src/fontfile/fontdir.c
@@ -25,6 +25,7 @@ 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/fontdir.c,v 3.19 2002/05/31 18:45:50 dawes Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
@@ -34,9 +35,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/keysym.h>
Bool
-FontFileInitTable (table, size)
- FontTablePtr table;
- int size;
+FontFileInitTable (FontTablePtr table, int size)
{
if (size)
{
@@ -53,14 +52,14 @@ FontFileInitTable (table, size)
}
void
-FontFileFreeEntry (entry)
- FontEntryPtr entry;
+FontFileFreeEntry (FontEntryPtr entry)
{
FontScalableExtraPtr extra;
int i;
if (entry->name.name)
xfree(entry->name.name);
+ entry->name.name = NULL;
switch (entry->type)
{
@@ -75,9 +74,11 @@ FontFileFreeEntry (entry)
break;
case FONT_ENTRY_BITMAP:
xfree (entry->u.bitmap.fileName);
+ entry->u.bitmap.fileName = NULL;
break;
case FONT_ENTRY_ALIAS:
xfree (entry->u.alias.resolved);
+ entry->u.alias.resolved = NULL;
break;
#ifdef NOTYET
case FONT_ENTRY_BC:
@@ -87,8 +88,7 @@ FontFileFreeEntry (entry)
}
void
-FontFileFreeTable (table)
- FontTablePtr table;
+FontFileFreeTable (FontTablePtr table)
{
int i;
@@ -98,21 +98,44 @@ FontFileFreeTable (table)
}
FontDirectoryPtr
-FontFileMakeDir(dirName, size)
- char *dirName;
- int size;
+FontFileMakeDir(char *dirName, int size)
{
FontDirectoryPtr dir;
int dirlen;
int needslash = 0;
+#ifdef FONTDIRATTRIB
+ char *attrib;
+ int attriblen;
+#endif
+#ifdef FONTDIRATTRIB
+#ifndef __UNIXOS2__
+ attrib = strchr(dirName, ':');
+#else
+ /* OS/2 uses the colon in the drive letter descriptor, skip this */
+ attrib = strchr(dirName+2, ':');
+#endif
+ if (attrib) {
+ dirlen = attrib - dirName;
+ attriblen = strlen(attrib);
+ } else {
+ dirlen = strlen(dirName);
+ attriblen = 0;
+ }
+#else
dirlen = strlen(dirName);
+#endif
if (dirName[dirlen - 1] != '/')
#ifdef NCD
if (dirlen) /* leave out slash for builtins */
#endif
needslash = 1;
+#ifdef FONTDIRATTRIB
+ dir = (FontDirectoryPtr) xalloc(sizeof *dir + dirlen + needslash + 1 +
+ (attriblen ? attriblen + 1 : 0));
+#else
dir = (FontDirectoryPtr) xalloc(sizeof *dir + dirlen + needslash + 1);
+#endif
if (!dir)
return (FontDirectoryPtr)0;
if (!FontFileInitTable (&dir->scalable, 0))
@@ -129,15 +152,25 @@ FontFileMakeDir(dirName, size)
dir->directory = (char *) (dir + 1);
dir->dir_mtime = 0;
dir->alias_mtime = 0;
+#ifdef FONTDIRATTRIB
+ if (attriblen)
+ dir->attributes = dir->directory + dirlen + needslash + 1;
+ else
+ dir->attributes = NULL;
+ strncpy(dir->directory, dirName, dirlen);
+ dir->directory[dirlen] = '\0';
+ if (dir->attributes)
+ strcpy(dir->attributes, attrib);
+#else
strcpy(dir->directory, dirName);
+#endif
if (needslash)
strcat(dir->directory, "/");
return dir;
}
void
-FontFileFreeDir (dir)
- FontDirectoryPtr dir;
+FontFileFreeDir (FontDirectoryPtr dir)
{
FontFileFreeTable (&dir->scalable);
FontFileFreeTable (&dir->nonScalable);
@@ -145,9 +178,7 @@ FontFileFreeDir (dir)
}
FontEntryPtr
-FontFileAddEntry(table, prototype)
- FontTablePtr table;
- FontEntryPtr prototype;
+FontFileAddEntry(FontTablePtr table, FontEntryPtr prototype)
{
FontEntryPtr entry;
int newsize;
@@ -175,24 +206,56 @@ FontFileAddEntry(table, prototype)
return entry;
}
+/*
+ * Compare two strings just like strcmp, but preserve decimal integer
+ * sorting order, i.e. "2" < "10" or "iso8859-2" < "iso8859-10" <
+ * "iso10646-1". Strings are sorted as if sequences of digits were
+ * prefixed by a length indicator (i.e., does not ignore leading zeroes).
+ *
+ * Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk>
+ */
+#define Xisdigit(c) ('\060' <= (c) && (c) <= '\071')
+
+static int strcmpn(const char *s1, const char *s2)
+{
+ int digits, predigits = 0;
+ const char *ss1, *ss2;
+
+ while (1) {
+ if (*s1 == 0 && *s2 == 0)
+ return 0;
+ digits = Xisdigit(*s1) && Xisdigit(*s2);
+ if (digits && !predigits) {
+ ss1 = s1;
+ ss2 = s2;
+ while (Xisdigit(*ss1) && Xisdigit(*ss2))
+ ss1++, ss2++;
+ if (!Xisdigit(*ss1) && Xisdigit(*ss2))
+ return -1;
+ if (Xisdigit(*ss1) && !Xisdigit(*ss2))
+ return 1;
+ }
+ if ((unsigned char)*s1 < (unsigned char)*s2)
+ return -1;
+ if ((unsigned char)*s1 > (unsigned char)*s2)
+ return 1;
+ predigits = digits;
+ s1++, s2++;
+ }
+}
+
+
static int
-#ifdef NeedFunctionPrototypes
FontFileNameCompare(const void* a, const void* b)
-#else
-FontFileNameCompare(a, b)
- char *a,
- *b;
-#endif
{
FontEntryPtr a_name = (FontEntryPtr) a,
b_name = (FontEntryPtr) b;
- return strcmp(a_name->name.name, b_name->name.name);
+ return strcmpn(a_name->name.name, b_name->name.name);
}
void
-FontFileSortTable (table)
- FontTablePtr table;
+FontFileSortTable (FontTablePtr table)
{
if (!table->sorted) {
qsort((char *) table->entries, table->used, sizeof(FontEntryRec),
@@ -202,8 +265,7 @@ FontFileSortTable (table)
}
void
-FontFileSortDir(dir)
- FontDirectoryPtr dir;
+FontFileSortDir(FontDirectoryPtr dir)
{
FontFileSortTable (&dir->scalable);
FontFileSortTable (&dir->nonScalable);
@@ -225,19 +287,17 @@ FontFileSortDir(dir)
*/
#define isWild(c) ((c) == XK_asterisk || (c) == XK_question)
+#define isDigit(c) (XK_0 <= (c) && (c) <= XK_9)
static int
-SetupWildMatch(table, pat, leftp, rightp, privatep)
- FontTablePtr table;
- FontNamePtr pat;
- int *leftp,
- *rightp;
- int *privatep;
+SetupWildMatch(FontTablePtr table, FontNamePtr pat,
+ int *leftp, int *rightp, int *privatep)
{
int nDashes;
char c;
char *t;
char *firstWild;
+ char *firstDigit;
int first;
int center,
left,
@@ -248,12 +308,17 @@ SetupWildMatch(table, pat, leftp, rightp, privatep)
name = pat->name;
nDashes = pat->ndashes;
firstWild = 0;
+ firstDigit = 0;
t = name;
while ((c = *t++)) {
if (isWild(c)) {
if (!firstWild)
firstWild = t - 1;
}
+ if (isDigit(c)) {
+ if (!firstDigit)
+ firstDigit = t - 1;
+ }
}
left = 0;
right = table->used;
@@ -266,7 +331,10 @@ SetupWildMatch(table, pat, leftp, rightp, privatep)
*rightp = right;
return -1;
} else if (firstWild) {
- first = firstWild - name;
+ if (firstDigit && firstDigit < firstWild)
+ first = firstDigit - name;
+ else
+ first = firstWild - name;
while (left < right) {
center = (left + right) / 2;
result = strncmp(name, table->entries[center].name.name, first);
@@ -283,7 +351,7 @@ SetupWildMatch(table, pat, leftp, rightp, privatep)
} else {
while (left < right) {
center = (left + right) / 2;
- result = strcmp(name, table->entries[center].name.name);
+ result = strcmpn(name, table->entries[center].name.name);
if (result == 0)
return center;
if (result < 0)
@@ -298,9 +366,7 @@ SetupWildMatch(table, pat, leftp, rightp, privatep)
}
static int
-PatternMatch(pat, patdashes, string, stringdashes)
- char *pat;
- char *string;
+PatternMatch(char *pat, int patdashes, char *string, int stringdashes)
{
char c,
t;
@@ -360,9 +426,7 @@ PatternMatch(pat, patdashes, string, stringdashes)
}
int
-FontFileCountDashes (name, namelen)
- char *name;
- int namelen;
+FontFileCountDashes (char *name, int namelen)
{
int ndashes = 0;
@@ -373,8 +437,7 @@ FontFileCountDashes (name, namelen)
}
char *
-FontFileSaveString (s)
- char *s;
+FontFileSaveString (char *s)
{
char *n;
@@ -386,10 +449,8 @@ FontFileSaveString (s)
}
FontEntryPtr
-FontFileFindNameInScalableDir(table, pat, vals)
- FontTablePtr table;
- FontNamePtr pat;
- FontScalablePtr vals;
+FontFileFindNameInScalableDir(FontTablePtr table, FontNamePtr pat,
+ FontScalablePtr vals)
{
int i,
start,
@@ -417,11 +478,11 @@ FontFileFindNameInScalableDir(table, pat, vals)
cap = ~0; /* Calling code will have to see if true */
else
cap = 0;
- if (((vs & PIXELSIZE_MASK) == PIXELSIZE_ARRAY ||
- (vs & POINTSIZE_MASK) == POINTSIZE_ARRAY) &&
- !(cap & CAP_MATRIX) ||
- (vs & CHARSUBSET_SPECIFIED) &&
- !(cap & CAP_CHARSUBSETTING))
+ if ((((vs & PIXELSIZE_MASK) == PIXELSIZE_ARRAY ||
+ (vs & POINTSIZE_MASK) == POINTSIZE_ARRAY) &&
+ !(cap & CAP_MATRIX)) ||
+ ((vs & CHARSUBSET_SPECIFIED) &&
+ !(cap & CAP_CHARSUBSETTING)))
continue;
}
return &table->entries[i];
@@ -433,23 +494,15 @@ FontFileFindNameInScalableDir(table, pat, vals)
}
FontEntryPtr
-FontFileFindNameInDir(table, pat)
- FontTablePtr table;
- FontNamePtr pat;
+FontFileFindNameInDir(FontTablePtr table, FontNamePtr pat)
{
return FontFileFindNameInScalableDir(table, pat, (FontScalablePtr)0);
}
int
-FontFileFindNamesInScalableDir(table, pat, max, names, vals,
- alias_behavior, newmax)
- FontTablePtr table;
- FontNamePtr pat;
- int max;
- FontNamesPtr names;
- FontScalablePtr vals;
- int alias_behavior;
- int *newmax;
+FontFileFindNamesInScalableDir(FontTablePtr table, FontNamePtr pat, int max,
+ FontNamesPtr names, FontScalablePtr vals,
+ int alias_behavior, int *newmax)
{
int i,
start,
@@ -487,11 +540,11 @@ FontFileFindNamesInScalableDir(table, pat, max, names, vals,
cap = ~0; /* Calling code will have to see if true */
else
cap = 0;
- if (((vs & PIXELSIZE_MASK) == PIXELSIZE_ARRAY ||
+ if ((((vs & PIXELSIZE_MASK) == PIXELSIZE_ARRAY ||
(vs & POINTSIZE_MASK) == POINTSIZE_ARRAY) &&
- !(cap & CAP_MATRIX) ||
- (vs & CHARSUBSET_SPECIFIED) &&
- !(cap & CAP_CHARSUBSETTING))
+ !(cap & CAP_MATRIX)) ||
+ ((vs & CHARSUBSET_SPECIFIED) &&
+ !(cap & CAP_CHARSUBSETTING)))
continue;
}
@@ -534,11 +587,8 @@ FontFileFindNamesInScalableDir(table, pat, max, names, vals,
}
int
-FontFileFindNamesInDir(table, pat, max, names)
- FontTablePtr table;
- FontNamePtr pat;
- int max;
- FontNamesPtr names;
+FontFileFindNamesInDir(FontTablePtr table, FontNamePtr pat,
+ int max, FontNamesPtr names)
{
return FontFileFindNamesInScalableDir(table, pat, max, names,
(FontScalablePtr)0,
@@ -546,10 +596,7 @@ FontFileFindNamesInDir(table, pat, max, names)
}
Bool
-FontFileMatchName(name, length, pat)
- char *name;
- int length;
- FontNamePtr pat;
+FontFileMatchName(char *name, int length, FontNamePtr pat)
{
/* Perform a fontfile-type name match on a single name */
FontTableRec table;
@@ -573,17 +620,14 @@ FontFileMatchName(name, length, pat)
*/
Bool
-FontFileAddFontFile (dir, fontName, fileName)
- FontDirectoryPtr dir;
- char *fontName;
- char *fileName;
+FontFileAddFontFile (FontDirectoryPtr dir, char *fontName, char *fileName)
{
FontEntryRec entry;
FontScalableRec vals, zeroVals;
FontRendererPtr renderer;
FontEntryPtr existing;
FontScalableExtraPtr extra;
- FontEntryPtr bitmap, scalable;
+ FontEntryPtr bitmap = 0, scalable;
Bool isscale;
renderer = FontFileMatchRenderer (fileName);
@@ -610,6 +654,28 @@ FontFileAddFontFile (dir, fontName, fileName)
(vals.values_supplied & PIXELSIZE_MASK) != PIXELSIZE_ARRAY &&
(vals.values_supplied & POINTSIZE_MASK) != POINTSIZE_ARRAY &&
!(vals.values_supplied & ENHANCEMENT_SPECIFY_MASK);
+#ifdef FONTDIRATTRIB
+#define UNSCALED_ATTRIB "unscaled"
+ /* For scalable fonts, check if the "unscaled" attribute is present */
+ if (isscale && dir->attributes && dir->attributes[0] == ':') {
+ char *ptr1 = dir->attributes + 1;
+ char *ptr2;
+ int length;
+ int uslength = strlen(UNSCALED_ATTRIB);
+
+ do {
+ ptr2 = strchr(ptr1, ':');
+ if (ptr2)
+ length = ptr2 - ptr1;
+ else
+ length = dir->attributes + strlen(dir->attributes) - ptr1;
+ if (length == uslength && !strncmp(ptr1, UNSCALED_ATTRIB, uslength))
+ isscale = FALSE;
+ if (ptr2)
+ ptr1 = ptr2 + 1;
+ } while (ptr2);
+ }
+#endif
if (!isscale || (vals.values_supplied & SIZE_SPECIFY_MASK))
{
/* If the fontname says it is nonScalable, make sure that the
@@ -739,10 +805,7 @@ FontFileAddFontFile (dir, fontName, fileName)
}
Bool
-FontFileAddFontAlias (dir, aliasName, fontName)
- FontDirectoryPtr dir;
- char *aliasName;
- char *fontName;
+FontFileAddFontAlias (FontDirectoryPtr dir, char *aliasName, char *fontName)
{
FontEntryRec entry;
diff --git a/src/fontfile/fontfile.c b/src/fontfile/fontfile.c
index 5230a15..1e39413 100644
--- a/src/fontfile/fontfile.c
+++ b/src/fontfile/fontfile.c
@@ -25,11 +25,12 @@ 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/fontfile.c,v 3.16 2002/05/31 18:45:50 dawes Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
*/
-/* $NCDId: @(#)fontfile.c,v 1.6 1991/07/02 17:00:46 lemke Exp $ */
+/* $NCDXorg: @(#)fontfile.c,v 1.6 1991/07/02 17:00:46 lemke Exp $ */
#include "fntfilst.h"
@@ -37,11 +38,23 @@ in this Software without prior written authorization from The Open Group.
* Map FPE functions to renderer functions
*/
+static int FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont,
+ int flags, FontEntryPtr entry,
+ fsBitmapFormat format,
+ fsBitmapFormatMask fmask,
+ FontPtr non_cachable_font);
+
int
-FontFileNameCheck (name)
- char *name;
+FontFileNameCheck (char *name)
{
#ifndef NCD
+#ifdef __UNIXOS2__
+ /* 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
+ */
+ if (isalpha(*name) && name[1]==':')
+ return TRUE;
+#endif
return *name == '/';
#else
return ((strcmp(name, "built-ins") == 0) || (*name == '/'));
@@ -49,8 +62,7 @@ FontFileNameCheck (name)
}
int
-FontFileInitFPE (fpe)
- FontPathElementPtr fpe;
+FontFileInitFPE (FontPathElementPtr fpe)
{
int status;
FontDirectoryPtr dir;
@@ -71,12 +83,15 @@ FontFileInitFPE (fpe)
/* ARGSUSED */
int
-FontFileResetFPE (fpe)
- FontPathElementPtr fpe;
+FontFileResetFPE (FontPathElementPtr fpe)
{
FontDirectoryPtr dir;
dir = (FontDirectoryPtr) fpe->private;
+ /*
+ * The reset must fail for bitmap fonts because they get cleared when
+ * the path is set.
+ */
if (FontFileDirectoryChanged (dir))
{
/* can't do it, so tell the caller to close and re-open */
@@ -94,8 +109,7 @@ FontFileResetFPE (fpe)
}
int
-FontFileFreeFPE (fpe)
- FontPathElementPtr fpe;
+FontFileFreeFPE (FontPathElementPtr fpe)
{
FontFileUnregisterBitmapSource (fpe);
FontFileFreeDir ((FontDirectoryPtr) fpe->private);
@@ -103,13 +117,9 @@ FontFileFreeFPE (fpe)
}
static int
-transfer_values_to_alias(entryname, entrynamelength, resolvedname,
- aliasName, vals)
- char *entryname;
- int entrynamelength;
- char *resolvedname;
- char **aliasName;
- FontScalablePtr vals;
+transfer_values_to_alias(char *entryname, int entrynamelength,
+ char *resolvedname,
+ char **aliasName, FontScalablePtr vals)
{
static char aliasname[MAXFONTNAMELEN];
int nameok = 1, len;
@@ -117,6 +127,7 @@ transfer_values_to_alias(entryname, entrynamelength, resolvedname,
*aliasName = resolvedname;
if ((len = strlen(*aliasName)) <= MAXFONTNAMELEN &&
+ (entrynamelength < MAXFONTNAMELEN) &&
FontFileCountDashes (*aliasName, len) == 14)
{
FontScalableRec tmpVals;
@@ -158,7 +169,6 @@ transfer_values_to_alias(entryname, entrynamelength, resolvedname,
gotchas */
if (FontFileCompleteXLFD(&tmpVals2, &tmpVals2))
{
- double hypot();
tempmatrix[0] =
matrix[0] * tmpVals2.point_matrix[0] +
matrix[1] * tmpVals2.point_matrix[2];
@@ -219,19 +229,11 @@ transfer_values_to_alias(entryname, entrynamelength, resolvedname,
/* ARGSUSED */
int
-FontFileOpenFont (client, fpe, flags, name, namelen, format, fmask,
- id, pFont, aliasName, non_cachable_font)
- pointer client;
- FontPathElementPtr fpe;
- int flags;
- char *name;
- int namelen;
- fsBitmapFormat format;
- fsBitmapFormatMask fmask;
- XID id;
- FontPtr *pFont;
- char **aliasName;
- FontPtr non_cachable_font;
+FontFileOpenFont (pointer client, FontPathElementPtr fpe, Mask flags,
+ char *name, int namelen,
+ fsBitmapFormat format, fsBitmapFormatMask fmask,
+ XID id, FontPtr *pFont, char **aliasName,
+ FontPtr non_cachable_font)
{
FontDirectoryPtr dir;
char lowerName[MAXFONTNAMELEN];
@@ -461,9 +463,7 @@ FontFileOpenFont (client, fpe, flags, name, namelen, format, fmask,
/* ARGSUSED */
void
-FontFileCloseFont (fpe, pFont)
- FontPathElementPtr fpe;
- FontPtr pFont;
+FontFileCloseFont (FontPathElementPtr fpe, FontPtr pFont)
{
FontEntryPtr entry;
@@ -484,14 +484,11 @@ FontFileCloseFont (fpe, pFont)
(*pFont->unload_font) (pFont);
}
-int
-FontFileOpenBitmapNCF (fpe, pFont, flags, entry, format, fmask,
- non_cachable_font)
- FontPathElementPtr fpe;
- int flags;
- FontEntryPtr entry;
- FontPtr *pFont;
- FontPtr non_cachable_font;
+static int
+FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont,
+ int flags, FontEntryPtr entry,
+ fsBitmapFormat format, fsBitmapFormatMask fmask,
+ FontPtr non_cachable_font)
{
FontBitmapEntryPtr bitmap;
char fileName[MAXFONTFILENAMELEN*2+1];
@@ -514,21 +511,17 @@ FontFileOpenBitmapNCF (fpe, pFont, flags, entry, format, fmask,
}
int
-FontFileOpenBitmap (fpe, pFont, flags, entry, format, fmask)
- FontPathElementPtr fpe;
- int flags;
- FontEntryPtr entry;
- FontPtr *pFont;
+FontFileOpenBitmap (FontPathElementPtr fpe, FontPtr *pFont,
+ int flags, FontEntryPtr entry,
+ fsBitmapFormat format, fsBitmapFormatMask fmask)
{
return FontFileOpenBitmapNCF (fpe, pFont, flags, entry, format, fmask,
(FontPtr)0);
}
-int
-FontFileGetInfoBitmap (fpe, pFontInfo, entry)
- FontPathElementPtr fpe;
- FontInfoPtr pFontInfo;
- FontEntryPtr entry;
+static int
+FontFileGetInfoBitmap (FontPathElementPtr fpe, FontInfoPtr pFontInfo,
+ FontEntryPtr entry)
{
FontBitmapEntryPtr bitmap;
char fileName[MAXFONTFILENAMELEN*2+1];
@@ -544,16 +537,10 @@ FontFileGetInfoBitmap (fpe, pFontInfo, entry)
}
static void
-_FontFileAddScalableNames(names, scaleNames, nameptr, zeroChars, vals, ranges,
- nranges, max)
- FontNamesPtr names;
- FontNamesPtr scaleNames;
- FontNamePtr nameptr;
- char *zeroChars;
- FontScalablePtr vals;
- fsRange *ranges;
- int nranges;
- int *max;
+_FontFileAddScalableNames(FontNamesPtr names, FontNamesPtr scaleNames,
+ FontNamePtr nameptr, char *zeroChars,
+ FontScalablePtr vals, fsRange *ranges,
+ int nranges, int *max)
{
int i;
FontScalableRec zeroVals, tmpVals;
@@ -667,14 +654,9 @@ _FontFileAddScalableNames(names, scaleNames, nameptr, zeroChars, vals, ranges,
/* ARGSUSED */
static int
-_FontFileListFonts (client, fpe, pat, len, max, names, mark_aliases)
- pointer client;
- FontPathElementPtr fpe;
- char *pat;
- int len;
- int max;
- FontNamesPtr names;
- int mark_aliases;
+_FontFileListFonts (pointer client, FontPathElementPtr fpe,
+ char *pat, int len, int max, FontNamesPtr names,
+ int mark_aliases)
{
FontDirectoryPtr dir;
char lowerChars[MAXFONTNAMELEN], zeroChars[MAXFONTNAMELEN];
@@ -779,25 +761,16 @@ typedef struct _LFWIData {
} LFWIDataRec, *LFWIDataPtr;
int
-FontFileListFonts (client, fpe, pat, len, max, names)
- pointer client;
- FontPathElementPtr fpe;
- char *pat;
- int len;
- int max;
- FontNamesPtr names;
+FontFileListFonts (pointer client, FontPathElementPtr fpe, char *pat,
+ int len, int max, FontNamesPtr names)
{
return _FontFileListFonts (client, fpe, pat, len, max, names, 0);
}
int
-FontFileStartListFontsWithInfo(client, fpe, pat, len, max, privatep)
- pointer client;
- FontPathElementPtr fpe;
- char *pat;
- int len;
- int max;
- pointer *privatep;
+FontFileStartListFontsWithInfo(pointer client, FontPathElementPtr fpe,
+ char *pat, int len, int max,
+ pointer *privatep)
{
LFWIDataPtr data;
int ret;
@@ -825,12 +798,9 @@ FontFileStartListFontsWithInfo(client, fpe, pat, len, max, privatep)
/* ARGSUSED */
static int
-FontFileListOneFontWithInfo (client, fpe, namep, namelenp, pFontInfo)
- pointer client;
- FontPathElementPtr fpe;
- char **namep;
- int *namelenp;
- FontInfoPtr *pFontInfo;
+FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
+ char **namep, int *namelenp,
+ FontInfoPtr *pFontInfo)
{
FontDirectoryPtr dir;
char lowerName[MAXFONTNAMELEN];
@@ -979,15 +949,10 @@ FontFileListOneFontWithInfo (client, fpe, namep, namelenp, pFontInfo)
}
int
-FontFileListNextFontWithInfo(client, fpe, namep, namelenp, pFontInfo,
- numFonts, private)
- pointer client;
- FontPathElementPtr fpe;
- char **namep;
- int *namelenp;
- FontInfoPtr *pFontInfo;
- int *numFonts;
- pointer private;
+FontFileListNextFontWithInfo(pointer client, FontPathElementPtr fpe,
+ char **namep, int *namelenp,
+ FontInfoPtr *pFontInfo,
+ int *numFonts, pointer private)
{
LFWIDataPtr data = (LFWIDataPtr) private;
int ret;
@@ -1013,13 +978,9 @@ FontFileListNextFontWithInfo(client, fpe, namep, namelenp, pFontInfo,
}
int
-FontFileStartListFontsAndAliases(client, fpe, pat, len, max, privatep)
- pointer client;
- FontPathElementPtr fpe;
- char *pat;
- int len;
- int max;
- pointer *privatep;
+FontFileStartListFontsAndAliases(pointer client, FontPathElementPtr fpe,
+ char *pat, int len, int max,
+ pointer *privatep)
{
LFWIDataPtr data;
int ret;
@@ -1046,15 +1007,9 @@ FontFileStartListFontsAndAliases(client, fpe, pat, len, max, privatep)
}
int
-FontFileListNextFontOrAlias(client, fpe, namep, namelenp, resolvedp,
- resolvedlenp, private)
- pointer client;
- FontPathElementPtr fpe;
- char **namep;
- int *namelenp;
- char **resolvedp;
- int *resolvedlenp;
- pointer private;
+FontFileListNextFontOrAlias(pointer client, FontPathElementPtr fpe,
+ char **namep, int *namelenp, char **resolvedp,
+ int *resolvedlenp, pointer private)
{
LFWIDataPtr data = (LFWIDataPtr) private;
int ret;
@@ -1094,12 +1049,11 @@ FontFileListNextFontOrAlias(client, fpe, namep, namelenp, resolvedp,
}
-extern void FontFileEmptyBitmapSource();
-typedef int (*IntFunc) ();
+typedef int (*IntFunc) (void);
static int font_file_type;
void
-FontFileRegisterLocalFpeFunctions ()
+FontFileRegisterLocalFpeFunctions (void)
{
font_file_type = RegisterFPEFunctions(FontFileNameCheck,
FontFileInitFPE,
@@ -1110,9 +1064,9 @@ FontFileRegisterLocalFpeFunctions ()
FontFileListFonts,
FontFileStartListFontsWithInfo,
FontFileListNextFontWithInfo,
- (IntFunc) 0,
- (IntFunc) 0,
- (IntFunc) 0,
+ NULL,
+ NULL,
+ NULL,
FontFileStartListFontsAndAliases,
FontFileListNextFontOrAlias,
FontFileEmptyBitmapSource);
diff --git a/src/fontfile/fontscale.c b/src/fontfile/fontscale.c
index 56ed691..8fb63e4 100644
--- a/src/fontfile/fontscale.c
+++ b/src/fontfile/fontscale.c
@@ -25,6 +25,7 @@ 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/fontscale.c,v 3.10 2001/12/14 19:56:52 dawes Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
@@ -40,11 +41,8 @@ in this Software without prior written authorization from The Open Group.
#endif
Bool
-FontFileAddScaledInstance (entry, vals, pFont, bitmapName)
- FontEntryPtr entry;
- FontScalablePtr vals;
- FontPtr pFont;
- char *bitmapName;
+FontFileAddScaledInstance (FontEntryPtr entry, FontScalablePtr vals,
+ FontPtr pFont, char *bitmapName)
{
FontScalableEntryPtr scalable;
FontScalableExtraPtr extra;
@@ -75,8 +73,7 @@ FontFileAddScaledInstance (entry, vals, pFont, bitmapName)
/* Must call this after the directory is sorted */
void
-FontFileSwitchStringsToBitmapPointers (dir)
- FontDirectoryPtr dir;
+FontFileSwitchStringsToBitmapPointers (FontDirectoryPtr dir)
{
int s;
int b;
@@ -100,9 +97,7 @@ FontFileSwitchStringsToBitmapPointers (dir)
}
void
-FontFileRemoveScaledInstance (entry, pFont)
- FontEntryPtr entry;
- FontPtr pFont;
+FontFileRemoveScaledInstance (FontEntryPtr entry, FontPtr pFont)
{
FontScalableEntryPtr scalable;
FontScalableExtraPtr extra;
@@ -124,9 +119,7 @@ FontFileRemoveScaledInstance (entry, pFont)
}
Bool
-FontFileCompleteXLFD (vals, def)
- register FontScalablePtr vals;
- FontScalablePtr def;
+FontFileCompleteXLFD (FontScalablePtr vals, FontScalablePtr def)
{
FontResolutionPtr res;
int num_res;
@@ -247,7 +240,7 @@ FontFileCompleteXLFD (vals, def)
pixel_setsize_adjustment = (double)vals->x / (double)vals->y;
vals->pixel_matrix[0] *= pixel_setsize_adjustment;
- vals->values_supplied = vals->values_supplied & ~PIXELSIZE_MASK |
+ vals->values_supplied = (vals->values_supplied & ~PIXELSIZE_MASK) |
PIXELSIZE_SCALAR_NORMALIZED;
}
@@ -349,8 +342,7 @@ FontFileCompleteXLFD (vals, def)
}
static Bool
-MatchScalable (a, b)
- FontScalablePtr a, b;
+MatchScalable (FontScalablePtr a, FontScalablePtr b)
{
int i;
@@ -370,15 +362,15 @@ MatchScalable (a, b)
if (!(a->x == b->x &&
a->y == b->y &&
- (a->width == b->width || a->width == 0 || b->width == 0) &&
+ (a->width == b->width || a->width == 0 || b->width == 0 || b->width == -1) &&
(!(b->values_supplied & PIXELSIZE_MASK) ||
- (a->values_supplied & PIXELSIZE_MASK) ==
- (b->values_supplied & PIXELSIZE_MASK) &&
- EQUAL(a->pixel_matrix, b->pixel_matrix)) &&
+ ((a->values_supplied & PIXELSIZE_MASK) ==
+ (b->values_supplied & PIXELSIZE_MASK) &&
+ EQUAL(a->pixel_matrix, b->pixel_matrix))) &&
(!(b->values_supplied & POINTSIZE_MASK) ||
- (a->values_supplied & POINTSIZE_MASK) ==
- (b->values_supplied & POINTSIZE_MASK) &&
- EQUAL(a->point_matrix, b->point_matrix)) &&
+ ((a->values_supplied & POINTSIZE_MASK) ==
+ (b->values_supplied & POINTSIZE_MASK) &&
+ EQUAL(a->point_matrix, b->point_matrix))) &&
(a->nranges == 0 || a->nranges == b->nranges)))
return FALSE;
@@ -393,9 +385,8 @@ MatchScalable (a, b)
}
FontScaledPtr
-FontFileFindScaledInstance (entry, vals, noSpecificSize)
- FontEntryPtr entry;
- FontScalablePtr vals;
+FontFileFindScaledInstance (FontEntryPtr entry, FontScalablePtr vals,
+ int noSpecificSize)
{
FontScalableEntryPtr scalable;
FontScalableExtraPtr extra;
diff --git a/src/fontfile/gunzip.c b/src/fontfile/gunzip.c
index a303f21..21894d0 100644
--- a/src/fontfile/gunzip.c
+++ b/src/fontfile/gunzip.c
@@ -2,6 +2,7 @@
/* lib/font/fontfile/gunzip.c
written by Mark Eichin <eichin@kitten.gen.ma.us> September 1996.
intended for inclusion in X11 public releases. */
+/* $XFree86: xc/lib/font/fontfile/gunzip.c,v 1.5 2001/01/17 19:43:30 dawes Exp $ */
#include "fontmisc.h"
#include <bufio.h>
@@ -15,14 +16,13 @@ typedef struct _xzip_buf {
BufFilePtr f;
} xzip_buf;
-static int BufZipFileSkip(); /* f, count */
-static int BufZipFileFill(); /* read: f; write: char, f */
-static int BufZipFileClose(); /* f, flag */
-static int BufCheckZipHeader(); /* f */
+static int BufZipFileClose ( BufFilePtr f, int flag );
+static int BufZipFileFill ( BufFilePtr f );
+static int BufZipFileSkip ( BufFilePtr f, int c );
+static int BufCheckZipHeader ( BufFilePtr f );
BufFilePtr
-BufFilePushZIP (f)
- BufFilePtr f;
+BufFilePushZIP (BufFilePtr f)
{
xzip_buf *x;
@@ -58,15 +58,15 @@ BufFilePushZIP (f)
return 0;
}
- return BufFileCreate(x,
+ return BufFileCreate((char *)x,
BufZipFileFill,
+ 0,
BufZipFileSkip,
BufZipFileClose);
}
-static int BufZipFileClose(f, flag)
- BufFilePtr f;
- int flag;
+static int
+BufZipFileClose(BufFilePtr f, int flag)
{
xzip_buf *x = (xzip_buf *)f->private;
inflateEnd (&(x->z));
@@ -84,8 +84,8 @@ static int BufZipFileClose(f, flag)
Z_STREAM_END, we then have 4bytes CRC and 4bytes length...
gzio.c:gzread shows most of the mechanism.
*/
-static int BufZipFileFill (f)
- BufFilePtr f;
+static int
+BufZipFileFill (BufFilePtr f)
{
xzip_buf *x = (xzip_buf *)f->private;
@@ -102,7 +102,8 @@ static int BufZipFileFill (f)
case Z_STREAM_END:
case Z_DATA_ERROR:
case Z_ERRNO:
- return BUFFILEEOF;
+ f->left = 0;
+ return BUFFILEEOF;
default:
return BUFFILEEOF;
}
@@ -148,9 +149,8 @@ static int BufZipFileFill (f)
}
/* there should be a BufCommonSkip... */
-static int BufZipFileSkip (f, c)
- BufFilePtr f;
- int c;
+static int
+BufZipFileSkip (BufFilePtr f, int c)
{
/* BufFileRawSkip returns the count unchanged.
BufCompressedSkip returns 0.
@@ -191,8 +191,8 @@ static int BufZipFileSkip (f, c)
#define RESERVED 0xE0 /* bits 5..7: reserved */
#define GET(f) do {c = BufFileGet(f); if (c == BUFFILEEOF) return c;} while(0)
-static int BufCheckZipHeader(f)
- BufFilePtr f;
+static int
+BufCheckZipHeader(BufFilePtr f)
{
int c, flags;
GET(f); if (c != 0x1f) return 1; /* magic 1 */
diff --git a/src/fontfile/printerfont.c b/src/fontfile/printerfont.c
index 5632aa5..6759e91 100644
--- a/src/fontfile/printerfont.c
+++ b/src/fontfile/printerfont.c
@@ -25,11 +25,12 @@ 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.5 2001/12/14 19:56:52 dawes Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
*/
-/* $NCDId: @(#)fontfile.c,v 1.6 1991/07/02 17:00:46 lemke Exp $ */
+/* $NCDXorg: @(#)fontfile.c,v 1.6 1991/07/02 17:00:46 lemke Exp $ */
#include "fntfilst.h"
@@ -37,10 +38,6 @@ in this Software without prior written authorization from The Open Group.
* Map FPE functions to renderer functions
*/
-extern int FontFileInitFPE();
-extern int FontFileResetFPE();
-extern int FontFileFreeFPE();
-extern void FontFileCloseFont();
#define PRINTERPATHPREFIX "PRINTER:"
/* STUB
@@ -50,9 +47,8 @@ FontPathElementPtr fpe;
{ return 1; }
*/
-int
-PrinterFontNameCheck (name)
- char *name;
+static int
+PrinterFontNameCheck (char *name)
{
if (strncmp(name,PRINTERPATHPREFIX,strlen(PRINTERPATHPREFIX)) != 0)
return 0;
@@ -64,9 +60,8 @@ PrinterFontNameCheck (name)
#endif
}
-int
-PrinterFontInitFPE (fpe)
- FontPathElementPtr fpe;
+static int
+PrinterFontInitFPE (FontPathElementPtr fpe)
{
int status;
FontDirectoryPtr dir;
@@ -91,20 +86,12 @@ PrinterFontInitFPE (fpe)
* it that allows us to access the printer fonts
*/
-int
-PrinterFontOpenFont (client, fpe, flags, name, namelen, format, fmask,
- id, pFont, aliasName, non_cachable_font)
- pointer client;
- FontPathElementPtr fpe;
- int flags;
- char *name;
- int namelen;
- fsBitmapFormat format;
- fsBitmapFormatMask fmask;
- XID id;
- FontPtr *pFont;
- char **aliasName;
- FontPtr non_cachable_font;
+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,
@@ -112,28 +99,19 @@ PrinterFontOpenFont (client, fpe, flags, name, namelen, format, fmask,
return BadFontName;
}
-int
-PrinterFontListFonts (client, fpe, pat, len, max, names)
- pointer client;
- FontPathElementPtr fpe;
- char *pat;
- int len;
- int max;
- FontNamesPtr names;
+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;
}
-int
-PrinterFontStartListFontsWithInfo(client, fpe, pat, len, max, privatep)
- pointer client;
- FontPathElementPtr fpe;
- char *pat;
- int len;
- int max;
- pointer *privatep;
+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,
@@ -141,16 +119,11 @@ PrinterFontStartListFontsWithInfo(client, fpe, pat, len, max, privatep)
return BadFontName;
}
-int
-PrinterFontListNextFontWithInfo(client, fpe, namep, namelenp, pFontInfo,
- numFonts, private)
- pointer client;
- FontPathElementPtr fpe;
- char **namep;
- int *namelenp;
- FontInfoPtr *pFontInfo;
- int *numFonts;
- pointer private;
+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,
@@ -158,14 +131,10 @@ PrinterFontListNextFontWithInfo(client, fpe, namep, namelenp, pFontInfo,
return BadFontName;
}
-int
-PrinterFontStartListFontsAndAliases(client, fpe, pat, len, max, privatep)
- pointer client;
- FontPathElementPtr fpe;
- char *pat;
- int len;
- int max;
- pointer *privatep;
+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,
@@ -173,16 +142,11 @@ PrinterFontStartListFontsAndAliases(client, fpe, pat, len, max, privatep)
return BadFontName;
}
-int
-PrinterFontListNextFontOrAlias(client, fpe, namep, namelenp, resolvedp,
- resolvedlenp, private)
- pointer client;
- FontPathElementPtr fpe;
- char **namep;
- int *namelenp;
- char **resolvedp;
- int *resolvedlenp;
- pointer private;
+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,
@@ -190,12 +154,11 @@ PrinterFontListNextFontOrAlias(client, fpe, namep, namelenp, resolvedp,
return BadFontName;
}
-extern void FontFileEmptyBitmapSource();
-typedef int (*IntFunc) ();
+typedef int (*IntFunc) (void);
static int printer_font_type;
void
-PrinterFontRegisterFpeFunctions ()
+PrinterFontRegisterFpeFunctions (void)
{
/* what is the use of printer font type? */
printer_font_type = RegisterFPEFunctions(PrinterFontNameCheck,
@@ -207,9 +170,9 @@ PrinterFontRegisterFpeFunctions ()
PrinterFontListFonts,
PrinterFontStartListFontsWithInfo,
PrinterFontListNextFontWithInfo,
- (IntFunc) 0,
- (IntFunc) 0,
- (IntFunc) 0,
+ NULL,
+ NULL,
+ NULL,
PrinterFontStartListFontsAndAliases,
PrinterFontListNextFontOrAlias,
FontFileEmptyBitmapSource);
diff --git a/src/fontfile/register.c b/src/fontfile/register.c
index 8379f85..385d165 100644
--- a/src/fontfile/register.c
+++ b/src/fontfile/register.c
@@ -25,6 +25,7 @@ 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.15 2001/12/14 19:56:52 dawes Exp $ */
/*
* This is in a separate source file so that small programs
@@ -32,19 +33,55 @@ in this Software without prior written authorization from The Open Group.
* end up dragging in code from all the renderers, which is not small.
*/
+#include "fontmisc.h"
+#include "fntfilst.h"
+#include "bitmap.h"
+
+#ifdef LOADABLEFONTS
+#include "fontmod.h"
+#endif
+
void
-FontFileRegisterFpeFunctions()
+FontFileRegisterFpeFunctions(void)
{
+#ifndef LOADABLEFONTS
BitmapRegisterFontFileFunctions ();
#ifndef LOWMEMFTPT
#ifndef CRAY
+#ifdef BUILD_SPEEDO
SpeedoRegisterFontFileFunctions ();
+#endif
+#ifdef BUILD_TYPE1
Type1RegisterFontFileFunctions();
#endif
+#endif
+#ifdef BUILD_CID
+ CIDRegisterFontFileFunctions();
+#endif
+#ifdef BUILD_FREETYPE
+ FreeTypeRegisterFontFileFunctions();
+#endif
+#ifdef BUILD_XTRUETYPE
+ XTrueTypeRegisterFontFileFunctions();
+#endif
#endif /* ifndef LOWMEMFTPT */
+#else
+ {
+ int i;
+
+ if (FontModuleList) {
+ for (i = 0; FontModuleList[i].name; i++) {
+ if (FontModuleList[i].initFunc)
+ FontModuleList[i].initFunc();
+ }
+ }
+ }
+#endif
+
FontFileRegisterLocalFpeFunctions ();
}
+
diff --git a/src/fontfile/renderers.c b/src/fontfile/renderers.c
index c997f27..2db871d 100644
--- a/src/fontfile/renderers.c
+++ b/src/fontfile/renderers.c
@@ -25,39 +25,76 @@ 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/renderers.c,v 1.7 2002/12/09 17:30:00 dawes Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
*/
#include "fntfilst.h"
+extern void ErrorF(const char *f, ...);
static FontRenderersRec renderers;
+/*
+ * XXX Maybe should allow unregistering renders. For now, just clear the
+ * list at each new generation.
+ */
+extern unsigned long serverGeneration;
+static unsigned long rendererGeneration = 0;
+
+Bool
+FontFileRegisterRenderer (FontRendererPtr renderer)
+{
+ return FontFilePriorityRegisterRenderer(renderer, 0);
+}
+
Bool
-FontFileRegisterRenderer (renderer)
- FontRendererPtr renderer;
+FontFilePriorityRegisterRenderer (FontRendererPtr renderer, int priority)
{
int i;
- FontRendererPtr *new;
+ struct _FontRenderersElement *new;
- for (i = 0; i < renderers.number; i++)
- if (!strcmp (renderers.renderers[i]->fileSuffix, renderer->fileSuffix))
- return TRUE;
- i = renderers.number + 1;
- new = (FontRendererPtr *) xrealloc (renderers.renderers, sizeof *new * i);
- if (!new)
- return FALSE;
- renderer->number = i - 1;
- renderers.renderers = new;
- renderers.renderers[i - 1] = renderer;
- renderers.number = i;
+ if (rendererGeneration != serverGeneration) {
+ rendererGeneration = serverGeneration;
+ renderers.number = 0;
+ if (!renderers.renderers)
+ xfree(renderers.renderers);
+ renderers.renderers = NULL;
+ }
+
+ for (i = 0; i < renderers.number; i++) {
+ if (!strcmp (renderers.renderers[i].renderer->fileSuffix,
+ renderer->fileSuffix)) {
+ if(renderers.renderers[i].priority >= priority) {
+ if(renderers.renderers[i].priority == priority) {
+ if (rendererGeneration == 1)
+ ErrorF("Warning: font renderer for \"%s\" "
+ "already registered at priority %d\n",
+ renderer->fileSuffix, priority);
+ }
+ return TRUE;
+ } else {
+ break;
+ }
+ }
+ }
+
+ if(i >= renderers.number) {
+ new = xrealloc (renderers.renderers, sizeof(*new) * (i + 1));
+ if (!new)
+ return FALSE;
+ renderers.renderers = new;
+ renderers.number = i + 1;
+ }
+ renderer->number = i;
+ renderers.renderers[i].renderer = renderer;
+ renderers.renderers[i].priority = priority;
return TRUE;
}
FontRendererPtr
-FontFileMatchRenderer (fileName)
- char *fileName;
+FontFileMatchRenderer (char *fileName)
{
int i;
int fileLen;
@@ -66,7 +103,7 @@ FontFileMatchRenderer (fileName)
fileLen = strlen (fileName);
for (i = 0; i < renderers.number; i++)
{
- r = renderers.renderers[i];
+ r = renderers.renderers[i].renderer;
if (fileLen >= r->fileSuffixLen &&
!strcmp (fileName + fileLen - r->fileSuffixLen, r->fileSuffix))
{