summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am12
-rw-r--r--atom.c2
-rw-r--r--bdfint.h87
-rw-r--r--bdfread.c8
-rw-r--r--bdftopcf.c10
-rw-r--r--bdfutils.c6
-rw-r--r--bitmap.c4
-rw-r--r--bitmap.h101
-rw-r--r--bitmaputil.c6
-rw-r--r--bufio.c4
-rw-r--r--bufio.h83
-rw-r--r--configure.ac2
-rw-r--r--defaults.c2
-rw-r--r--fileio.c2
-rw-r--r--filewr.c2
-rw-r--r--fntfil.h179
-rw-r--r--fntfilio.h53
-rw-r--r--fntfilst.h193
-rw-r--r--font.h166
-rw-r--r--fontaccel.c4
-rw-r--r--fontink.c6
-rw-r--r--fontmisc.h100
-rw-r--r--fontutil.h24
-rw-r--r--fontxlfd.h97
-rw-r--r--pcf.h97
-rw-r--r--pcfwrite.c6
-rw-r--r--private.c2
-rw-r--r--stubs.h4
-rw-r--r--utilbitmap.c2
29 files changed, 1228 insertions, 36 deletions
diff --git a/Makefile.am b/Makefile.am
index 1265065..6012b42 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,16 +26,28 @@ AM_CFLAGS = $(CWARNFLAGS)
bdftopcf_SOURCES = \
atom.c \
+ bdfint.h \
bdfread.c \
bdfutils.c \
bitmap.c \
+ bitmap.h \
bitmaputil.c \
bufio.c \
+ bufio.h \
+ config.h \
defaults.c \
fileio.c \
filewr.c \
+ fntfil.h \
+ fntfilio.h \
+ fntfilst.h \
+ font.h \
fontaccel.c \
fontink.c \
+ fontmisc.h \
+ fontutil.h \
+ fontxlfd.h \
+ pcf.h \
pcfwrite.c \
private.c \
stubs.h \
diff --git a/atom.c b/atom.c
index c105706..3641719 100644
--- a/atom.c
+++ b/atom.c
@@ -33,7 +33,7 @@ in this Software without prior written authorization from The Open Group.
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include <X11/fonts/fontmisc.h>
+#include "fontmisc.h"
#include "stubs.h"
typedef struct _AtomList {
diff --git a/bdfint.h b/bdfint.h
new file mode 100644
index 0000000..cc464cb
--- /dev/null
+++ b/bdfint.h
@@ -0,0 +1,87 @@
+/*
+
+Copyright 1990, 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.
+
+*/
+
+#ifndef BDFINT_H
+#define BDFINT_H
+
+#define bdfIsPrefix(buf,str) (!strncmp((char *)buf,str,strlen(str)))
+#define bdfStrEqual(s1,s2) (!strcmp(s1,s2))
+
+#define BDF_GENPROPS 6
+#define NullProperty ((FontPropPtr)0)
+
+/*
+ * This structure holds some properties we need to generate if they aren't
+ * specified in the BDF file and some other values read from the file
+ * that we'll need to calculate them. We need to keep track of whether
+ * or not we've read them.
+ */
+typedef struct BDFSTAT {
+ int linenum;
+ char *fileName;
+ char fontName[MAXFONTNAMELEN];
+ float pointSize;
+ int resolution_x;
+ int resolution_y;
+ int digitCount;
+ int digitWidths;
+ int exHeight;
+
+ FontPropPtr fontProp;
+ FontPropPtr pointSizeProp;
+ FontPropPtr resolutionXProp;
+ FontPropPtr resolutionYProp;
+ FontPropPtr resolutionProp;
+ FontPropPtr xHeightProp;
+ FontPropPtr weightProp;
+ FontPropPtr quadWidthProp;
+ BOOL haveFontAscent;
+ BOOL haveFontDescent;
+ BOOL haveDefaultCh;
+} bdfFileState;
+
+extern void bdfError ( const char * message, ... ) _X_ATTRIBUTE_PRINTF(1, 2);
+extern void bdfWarning ( const char *message, ... ) _X_ATTRIBUTE_PRINTF(1, 2);
+extern unsigned char * bdfGetLine ( FontFilePtr file, unsigned char *buf,
+ int len );
+extern Atom bdfForceMakeAtom ( const char *str, int *size );
+extern Atom bdfGetPropertyValue ( char *s );
+extern int bdfIsInteger ( char *str );
+extern unsigned char bdfHexByte ( unsigned char *s );
+extern Bool bdfSpecialProperty ( FontPtr pFont, FontPropPtr prop,
+ char isString, bdfFileState *bdfState );
+extern int bdfReadFont( FontPtr pFont, FontFilePtr file,
+ int bit, int byte, int glyph, int scan );
+extern int bdfReadFontInfo( FontInfoPtr pFontInfo, FontFilePtr file );
+
+extern void FontCharInkMetrics ( FontPtr pFont, CharInfoPtr pCI,
+ xCharInfo *pInk );
+extern void FontCharReshape ( FontPtr pFont, CharInfoPtr pSrc,
+ CharInfoPtr pDst );
+
+#endif /* BDFINT_H */
diff --git a/bdfread.c b/bdfread.c
index f343eed..b932af5 100644
--- a/bdfread.c
+++ b/bdfread.c
@@ -54,11 +54,11 @@ from The Open Group.
#endif
#include <ctype.h>
-#include <X11/fonts/fntfilst.h>
-#include <X11/fonts/fontutil.h>
+#include "fntfilst.h"
+#include "fontutil.h"
/* use bitmap structure */
-#include <X11/fonts/bitmap.h>
-#include <X11/fonts/bdfint.h>
+#include "bitmap.h"
+#include "bdfint.h"
#if HAVE_STDINT_H
#include <stdint.h>
diff --git a/bdftopcf.c b/bdftopcf.c
index 2208fee..6f9e96b 100644
--- a/bdftopcf.c
+++ b/bdftopcf.c
@@ -32,12 +32,12 @@ from The Open Group.
#include <X11/X.h>
#include <X11/Xproto.h>
-#include <X11/fonts/fontmisc.h>
+#include "fontmisc.h"
#include <X11/fonts/fontstruct.h>
-#include <X11/fonts/fntfilio.h>
-#include <X11/fonts/fntfil.h>
-#include <X11/fonts/bdfint.h>
-#include <X11/fonts/pcf.h>
+#include "fntfilio.h"
+#include "fntfil.h"
+#include "bdfint.h"
+#include "pcf.h"
#include <stdio.h>
#include <X11/Xos.h>
diff --git a/bdfutils.c b/bdfutils.c
index 438d197..520be33 100644
--- a/bdfutils.c
+++ b/bdfutils.c
@@ -57,11 +57,11 @@ from The Open Group.
#include <stdio.h>
#include <stdarg.h>
-#include <X11/fonts/fntfilst.h>
+#include "fntfilst.h"
#include <X11/fonts/fontstruct.h>
/* use bitmap structure */
-#include <X11/fonts/bitmap.h>
-#include <X11/fonts/bdfint.h>
+#include "bitmap.h"
+#include "bdfint.h"
int bdfFileLineNum;
diff --git a/bitmap.c b/bitmap.c
index 0a379eb..7aaeba8 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -32,8 +32,8 @@ in this Software without prior written authorization from The Open Group.
#include <config.h>
#endif
-#include <X11/fonts/fntfilst.h>
-#include <X11/fonts/bitmap.h>
+#include "fntfilst.h"
+#include "bitmap.h"
int
bitmapGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars,
diff --git a/bitmap.h b/bitmap.h
new file mode 100644
index 0000000..cb14f2f
--- /dev/null
+++ b/bitmap.h
@@ -0,0 +1,101 @@
+/*
+
+Copyright 1990, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+/*
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+#ifndef _BITMAP_H_
+#define _BITMAP_H_
+
+#include "fntfilio.h"
+#include <stdio.h> /* just for NULL */
+
+/*
+ * Internal format used to store bitmap fonts
+ */
+
+/* number of encoding entries in one segment */
+#define BITMAP_FONT_SEGMENT_SIZE 128
+
+typedef struct _BitmapExtra {
+ Atom *glyphNames;
+ int *sWidths;
+ CARD32 bitmapsSizes[GLYPHPADOPTIONS];
+ FontInfoRec info;
+} BitmapExtraRec, *BitmapExtraPtr;
+
+typedef struct _BitmapFont {
+ unsigned version_num;
+ int num_chars;
+ int num_tables;
+ CharInfoPtr metrics; /* font metrics, including glyph pointers */
+ xCharInfo *ink_metrics; /* ink metrics */
+ char *bitmaps; /* base of bitmaps, useful only to free */
+ CharInfoPtr **encoding; /* array of arrays of char info pointers */
+ CharInfoPtr pDefault; /* default character */
+ BitmapExtraPtr bitmapExtra; /* stuff not used by X server */
+} BitmapFontRec, *BitmapFontPtr;
+
+#define ACCESSENCODING(enc,i) \
+(enc[(i)/BITMAP_FONT_SEGMENT_SIZE]?\
+(enc[(i)/BITMAP_FONT_SEGMENT_SIZE][(i)%BITMAP_FONT_SEGMENT_SIZE]):\
+0)
+#define ACCESSENCODINGL(enc,i) \
+(enc[(i)/BITMAP_FONT_SEGMENT_SIZE][(i)%BITMAP_FONT_SEGMENT_SIZE])
+
+#define SEGMENT_MAJOR(n) ((n)/BITMAP_FONT_SEGMENT_SIZE)
+#define SEGMENT_MINOR(n) ((n)%BITMAP_FONT_SEGMENT_SIZE)
+#define NUM_SEGMENTS(n) \
+ (((n)+BITMAP_FONT_SEGMENT_SIZE-1)/BITMAP_FONT_SEGMENT_SIZE)
+
+extern int bitmapGetGlyphs ( FontPtr pFont, unsigned long count,
+ unsigned char *chars, FontEncoding charEncoding,
+ unsigned long *glyphCount, CharInfoPtr *glyphs );
+extern int bitmapGetMetrics ( FontPtr pFont, unsigned long count,
+ unsigned char *chars, FontEncoding charEncoding,
+ unsigned long *glyphCount, xCharInfo **glyphs );
+
+extern void bitmapComputeFontBounds ( FontPtr pFont );
+extern void bitmapComputeFontInkBounds ( FontPtr pFont );
+extern Bool bitmapAddInkMetrics ( FontPtr pFont );
+extern int bitmapComputeWeight ( FontPtr pFont );
+
+extern void BitmapRegisterFontFileFunctions ( void );
+
+extern int BitmapOpenScalable ( FontPathElementPtr fpe, FontPtr *pFont,
+ int flags, FontEntryPtr entry, char *fileName,
+ FontScalablePtr vals, fsBitmapFormat format,
+ fsBitmapFormatMask fmask,
+ FontPtr non_cachable_font );
+extern int BitmapGetInfoScalable ( FontPathElementPtr fpe,
+ FontInfoPtr pFontInfo, FontEntryPtr entry,
+ FontNamePtr fontName, char *fileName,
+ FontScalablePtr vals );
+
+#endif /* _BITMAP_H_ */
diff --git a/bitmaputil.c b/bitmaputil.c
index 0a1c87e..3da1663 100644
--- a/bitmaputil.c
+++ b/bitmaputil.c
@@ -30,9 +30,9 @@ from The Open Group.
#include <config.h>
#endif
-#include <X11/fonts/fntfilst.h>
-#include <X11/fonts/bitmap.h>
-#include <X11/fonts/bdfint.h>
+#include "fntfilst.h"
+#include "bitmap.h"
+#include "bdfint.h"
#ifndef MAXSHORT
#define MAXSHORT 32767
diff --git a/bufio.c b/bufio.c
index d8d4f29..9fb9dd1 100644
--- a/bufio.c
+++ b/bufio.c
@@ -35,8 +35,8 @@ from The Open Group.
#include <config.h>
#endif
#include <X11/Xos.h>
-#include <X11/fonts/fontmisc.h>
-#include <X11/fonts/bufio.h>
+#include "fontmisc.h"
+#include "bufio.h"
#include <errno.h>
BufFilePtr
diff --git a/bufio.h b/bufio.h
new file mode 100644
index 0000000..e7a9f4a
--- /dev/null
+++ b/bufio.h
@@ -0,0 +1,83 @@
+/*
+
+Copyright 1993, 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.
+
+*/
+
+#ifndef ___BUFIO_H___
+#define ___BUFIO_H___ 1
+
+#include <X11/Xfuncproto.h>
+
+#define BUFFILESIZE 8192
+#define BUFFILEEOF -1
+
+typedef unsigned char BufChar;
+typedef struct _buffile *BufFilePtr;
+
+typedef struct _buffile {
+ BufChar *bufp;
+ int left;
+ int eof;
+ BufChar buffer[BUFFILESIZE];
+ int (*input)( BufFilePtr /* f */);
+ int (*output)( int /* c */, BufFilePtr /* f */);
+ int (*skip)( BufFilePtr /* f */, int /* count */);
+ int (*close)( BufFilePtr /* f */, int /* doClose */);
+ char *private;
+} BufFileRec;
+
+extern BufFilePtr BufFileCreate (
+ char*,
+ int (*)(BufFilePtr),
+ int (*)(int, BufFilePtr),
+ int (*)(BufFilePtr, int),
+ int (*)(BufFilePtr, int));
+extern BufFilePtr BufFileOpenRead ( int );
+extern BufFilePtr BufFileOpenWrite ( int );
+extern BufFilePtr BufFilePushCompressed ( BufFilePtr );
+#ifdef X_GZIP_FONT_COMPRESSION
+extern BufFilePtr BufFilePushZIP ( BufFilePtr );
+#endif
+#ifdef X_BZIP2_FONT_COMPRESSION
+extern BufFilePtr BufFilePushBZIP2 ( BufFilePtr );
+#endif
+extern int BufFileClose ( BufFilePtr, int );
+extern int BufFileRead ( BufFilePtr, char*, int );
+extern int BufFileWrite ( BufFilePtr, char*, int );
+
+#define BufFileGet(f) ((f)->left-- ? *(f)->bufp++ : ((f)->eof = (*(f)->input) (f)))
+#define BufFilePut(c,f) (--(f)->left ? *(f)->bufp++ = ((unsigned char)(c)) : (*(f)->output) ((unsigned char)(c),f))
+#define BufFileSkip(f,c) ((f)->eof = (*(f)->skip) (f, c))
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#endif /* ___BUFIO_H___ */
+
diff --git a/configure.ac b/configure.ac
index 7688bc8..9fecbcc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ dnl Process this file with autoconf to create configure.
# Initialize Autoconf
AC_PREREQ([2.60])
-AC_INIT([bdftopcf], [1.0.5],
+AC_INIT([bdftopcf], [1.0.6],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [bdftopcf])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
diff --git a/defaults.c b/defaults.c
index 1ad7d7c..6da4581 100644
--- a/defaults.c
+++ b/defaults.c
@@ -62,7 +62,7 @@ in this Software without prior written authorization from The Open Group.
#define DEFAULT_SCAN_UNIT 1
#endif
-#include <X11/fonts/fntfilst.h>
+#include "fntfilst.h"
void
FontDefaultFormat (int *bit, int *byte, int *glyph, int *scan)
diff --git a/fileio.c b/fileio.c
index b633f97..d6321c7 100644
--- a/fileio.c
+++ b/fileio.c
@@ -31,7 +31,7 @@ in this Software without prior written authorization from The Open Group.
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include <X11/fonts/fntfilio.h>
+#include "fntfilio.h"
#include <X11/Xos.h>
#ifndef O_BINARY
#define O_BINARY O_RDONLY
diff --git a/filewr.c b/filewr.c
index 859a0be..0070367 100644
--- a/filewr.c
+++ b/filewr.c
@@ -31,7 +31,7 @@ in this Software without prior written authorization from The Open Group.
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include <X11/fonts/fntfilio.h>
+#include "fntfilio.h"
#include <X11/Xos.h>
#ifndef O_BINARY
#define O_BINARY 0
diff --git a/fntfil.h b/fntfil.h
new file mode 100644
index 0000000..c44eb5e
--- /dev/null
+++ b/fntfil.h
@@ -0,0 +1,179 @@
+/*
+
+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.
+
+*/
+
+/*
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+#ifndef _FONTFILE_H_
+#define _FONTFILE_H_
+
+#include "fontxlfd.h"
+
+typedef struct _FontEntry *FontEntryPtr;
+typedef struct _FontTable *FontTablePtr;
+typedef struct _FontName *FontNamePtr;
+typedef struct _FontScaled *FontScaledPtr;
+typedef struct _FontScalableExtra *FontScalableExtraPtr;
+typedef struct _FontScalableEntry *FontScalableEntryPtr;
+typedef struct _FontScaleAliasEntry *FontScaleAliasEntryPtr;
+typedef struct _FontBitmapEntry *FontBitmapEntryPtr;
+typedef struct _FontAliasEntry *FontAliasEntryPtr;
+typedef struct _FontBCEntry *FontBCEntryPtr;
+typedef struct _FontDirectory *FontDirectoryPtr;
+typedef struct _FontRenderer *FontRendererPtr;
+
+#define NullFontEntry ((FontEntryPtr) 0)
+#define NullFontTable ((FontTablePtr) 0)
+#define NullFontName ((FontNamePtr) 0)
+#define NullFontScaled ((FontScaled) 0)
+#define NullFontScalableExtra ((FontScalableExtra) 0)
+#define NullFontscalableEntry ((FontScalableEntry) 0)
+#define NullFontScaleAliasEntry ((FontScaleAliasEntry) 0)
+#define NullFontBitmapEntry ((FontBitmapEntry) 0)
+#define NullFontAliasEntry ((FontAliasEntry) 0)
+#define NullFontBCEntry ((FontBCEntry) 0)
+#define NullFontDirectory ((FontDirectoryPtr) 0)
+#define NullFontRenderer ((FontRendererPtr) 0)
+
+#define FONT_ENTRY_SCALABLE 0
+#define FONT_ENTRY_SCALE_ALIAS 1
+#define FONT_ENTRY_BITMAP 2
+#define FONT_ENTRY_ALIAS 3
+#define FONT_ENTRY_BC 4
+
+#define MAXFONTNAMELEN 1024
+#define MAXFONTFILENAMELEN 1024
+
+#define FontDirFile "fonts.dir"
+#define FontAliasFile "fonts.alias"
+#define FontScalableFile "fonts.scale"
+
+extern int FontFileNameCheck ( const char *name );
+extern int FontFileInitFPE ( FontPathElementPtr fpe );
+extern int FontFileResetFPE ( FontPathElementPtr fpe );
+extern int FontFileFreeFPE ( FontPathElementPtr fpe );
+extern int FontFileOpenFont ( pointer client, FontPathElementPtr fpe,
+ Mask flags, const char *name, int namelen,
+ fsBitmapFormat format, fsBitmapFormatMask fmask,
+ XID id, FontPtr *pFont, char **aliasName,
+ FontPtr non_cachable_font );
+extern void FontFileCloseFont ( FontPathElementPtr fpe, FontPtr pFont );
+extern int FontFileOpenBitmap ( FontPathElementPtr fpe, FontPtr *pFont,
+ int flags, FontEntryPtr entry,
+ fsBitmapFormat format,
+ fsBitmapFormatMask fmask );
+extern int FontFileListFonts ( pointer client, FontPathElementPtr fpe,
+ const char *pat, int len, int max,
+ FontNamesPtr names );
+extern int FontFileStartListFonts ( pointer client, FontPathElementPtr fpe,
+ const char *pat, int len, int max,
+ pointer *privatep, int mark_aliases );
+extern int FontFileStartListFontsWithInfo ( pointer client,
+ FontPathElementPtr fpe,
+ const char *pat, int len, int max,
+ pointer *privatep );
+extern int FontFileListNextFontWithInfo ( pointer client,
+ FontPathElementPtr fpe,
+ char **namep, int *namelenp,
+ FontInfoPtr *pFontInfo,
+ int *numFonts, pointer private );
+extern int FontFileStartListFontsAndAliases ( pointer client,
+ FontPathElementPtr fpe,
+ const char *pat, int len, int max,
+ pointer *privatep );
+extern int FontFileListNextFontOrAlias ( pointer client,
+ FontPathElementPtr fpe,
+ char **namep, int *namelenp,
+ char **resolvedp, int *resolvedlenp,
+ pointer private );
+extern void FontFileRegisterLocalFpeFunctions ( void );
+extern void CatalogueRegisterLocalFpeFunctions ( void );
+
+
+extern FontEntryPtr FontFileAddEntry ( FontTablePtr table,
+ FontEntryPtr prototype );
+extern Bool FontFileAddFontAlias ( FontDirectoryPtr dir, char *aliasName,
+ char *fontName );
+extern Bool FontFileAddFontFile ( FontDirectoryPtr dir, char *fontName,
+ char *fileName );
+extern int FontFileCountDashes ( char *name, int namelen );
+extern FontEntryPtr FontFileFindNameInDir ( FontTablePtr table,
+ FontNamePtr pat );
+extern FontEntryPtr FontFileFindNameInScalableDir ( FontTablePtr table,
+ FontNamePtr pat,
+ FontScalablePtr vals );
+extern int FontFileFindNamesInDir ( FontTablePtr table, FontNamePtr pat,
+ int max, FontNamesPtr names );
+extern int FontFileFindNamesInScalableDir ( FontTablePtr table,
+ FontNamePtr pat, int max,
+ FontNamesPtr names,
+ FontScalablePtr vals,
+ int alias_behavior, int *newmax );
+
+extern void FontFileFreeDir ( FontDirectoryPtr dir );
+extern void FontFileFreeEntry ( FontEntryPtr entry );
+extern void FontFileFreeTable ( FontTablePtr table );
+extern Bool FontFileInitTable ( FontTablePtr table, int size );
+extern FontDirectoryPtr FontFileMakeDir ( const char *dirName, int size );
+extern Bool FontFileMatchName ( char *name, int length, FontNamePtr pat );
+extern char * FontFileSaveString ( char *s );
+extern void FontFileSortDir ( FontDirectoryPtr dir );
+extern void FontFileSortTable ( FontTablePtr table );
+
+extern void FontDefaultFormat ( int *bit, int *byte, int *glyph, int *scan );
+
+extern Bool FontFileRegisterRenderer ( FontRendererPtr renderer );
+extern Bool FontFilePriorityRegisterRenderer ( FontRendererPtr renderer,
+ int priority );
+extern FontRendererPtr FontFileMatchRenderer ( char *fileName );
+
+extern Bool FontFileAddScaledInstance ( FontEntryPtr entry,
+ FontScalablePtr vals, FontPtr pFont,
+ char *bitmapName );
+extern void FontFileSwitchStringsToBitmapPointers ( FontDirectoryPtr dir );
+extern void FontFileRemoveScaledInstance ( FontEntryPtr entry, FontPtr pFont );
+extern Bool FontFileCompleteXLFD ( FontScalablePtr vals, FontScalablePtr def );
+extern FontScaledPtr FontFileFindScaledInstance ( FontEntryPtr entry,
+ FontScalablePtr vals,
+ int noSpecificSize );
+
+extern Bool FontFileRegisterBitmapSource ( FontPathElementPtr fpe );
+extern void FontFileUnregisterBitmapSource ( FontPathElementPtr fpe );
+extern void FontFileEmptyBitmapSource ( void );
+extern int FontFileMatchBitmapSource ( FontPathElementPtr fpe,
+ FontPtr *pFont, int flags,
+ FontEntryPtr entry,
+ FontNamePtr zeroPat,
+ FontScalablePtr vals,
+ fsBitmapFormat format,
+ fsBitmapFormatMask fmask,
+ Bool noSpecificSize );
+
+extern int FontFileReadDirectory ( const char *directory, FontDirectoryPtr *pdir );
+extern Bool FontFileDirectoryChanged ( FontDirectoryPtr dir );
+
+#endif /* _FONTFILE_H_ */
diff --git a/fntfilio.h b/fntfilio.h
new file mode 100644
index 0000000..7586318
--- /dev/null
+++ b/fntfilio.h
@@ -0,0 +1,53 @@
+/*
+
+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.
+
+*/
+
+/*
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+#ifndef _FNTFILIO_H_
+#define _FNTFILIO_H_
+
+#include "bufio.h"
+
+typedef BufFilePtr FontFilePtr;
+
+#define FontFileGetc(f) BufFileGet(f)
+#define FontFilePutc(c,f) BufFilePut(c,f)
+#define FontFileRead(f,b,n) BufFileRead(f,b,n)
+#define FontFileWrite(f,b,n) BufFileWrite(f,b,n)
+#define FontFileSkip(f,n) (BufFileSkip (f, n) != BUFFILEEOF)
+#define FontFileSeek(f,n) (BufFileSeek (f,n,0) != BUFFILEEOF)
+
+#define FontFileEOF BUFFILEEOF
+
+extern FontFilePtr FontFileOpen ( const char *name );
+extern int FontFileClose ( FontFilePtr f );
+extern FontFilePtr FontFileOpenWrite ( const char *name );
+extern FontFilePtr FontFileOpenWriteFd ( int fd );
+extern FontFilePtr FontFileOpenFd ( int fd );
+
+#endif /* _FNTFILIO_H_ */
diff --git a/fntfilst.h b/fntfilst.h
new file mode 100644
index 0000000..7e96428
--- /dev/null
+++ b/fntfilst.h
@@ -0,0 +1,193 @@
+/*
+
+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.
+
+*/
+
+/*
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+#ifndef _FONTFILEST_H_
+#define _FONTFILEST_H_
+
+#include <X11/Xos.h>
+#ifndef XP_PSTEXT
+#include "fontmisc.h"
+#endif
+#include <X11/fonts/fontstruct.h>
+#include "fontxlfd.h"
+#include "fntfil.h"
+
+typedef struct _FontName {
+ char *name;
+ short length;
+ short ndashes;
+} FontNameRec;
+
+typedef struct _FontScaled {
+ FontScalableRec vals;
+ FontEntryPtr bitmap;
+ FontPtr pFont;
+} FontScaledRec;
+
+typedef struct _FontScalableExtra {
+ FontScalableRec defaults;
+ int numScaled;
+ int sizeScaled;
+ FontScaledPtr scaled;
+ pointer private;
+} FontScalableExtraRec;
+
+typedef struct _FontScalableEntry {
+ FontRendererPtr renderer;
+ char *fileName;
+ FontScalableExtraPtr extra;
+} FontScalableEntryRec;
+
+/*
+ * This "can't" work yet - the returned alias string must be permanent,
+ * but this layer would need to generate the appropriate name from the
+ * resolved scalable + the XLFD values passed in. XXX
+ */
+
+typedef struct _FontScaleAliasEntry {
+ char *resolved;
+} FontScaleAliasEntryRec;
+
+typedef struct _FontBitmapEntry {
+ FontRendererPtr renderer;
+ char *fileName;
+ FontPtr pFont;
+} FontBitmapEntryRec;
+
+typedef struct _FontAliasEntry {
+ char *resolved;
+} FontAliasEntryRec;
+
+typedef struct _FontBCEntry {
+ FontScalableRec vals;
+ FontEntryPtr entry;
+} FontBCEntryRec;
+
+typedef struct _FontEntry {
+ FontNameRec name;
+ int type;
+ union _FontEntryParts {
+ FontScalableEntryRec scalable;
+ FontBitmapEntryRec bitmap;
+ FontAliasEntryRec alias;
+ FontBCEntryRec bc;
+ } u;
+} FontEntryRec;
+
+typedef struct _FontTable {
+ int used;
+ int size;
+ FontEntryPtr entries;
+ Bool sorted;
+} FontTableRec;
+
+typedef struct _FontDirectory {
+ char *directory;
+ unsigned long dir_mtime;
+ unsigned long alias_mtime;
+ FontTableRec scalable;
+ FontTableRec nonScalable;
+ char *attributes;
+} FontDirectoryRec;
+
+/* Capability bits: for definition of capabilities bitmap in the
+ FontRendererRec to indicate support of XLFD enhancements */
+
+#define CAP_MATRIX 0x1
+#define CAP_CHARSUBSETTING 0x2
+
+typedef struct _FontRenderer {
+ const char *fileSuffix;
+ int fileSuffixLen;
+ int (*OpenBitmap)(FontPathElementPtr /* fpe */,
+ FontPtr * /* pFont */,
+ int /* flags */,
+ FontEntryPtr /* entry */,
+ char * /* fileName */,
+ fsBitmapFormat /* format */,
+ fsBitmapFormatMask /* mask */,
+ FontPtr /* non_cachable_font */);
+ int (*OpenScalable)(FontPathElementPtr /* fpe */,
+ FontPtr * /* pFont */,
+ int /* flags */,
+ FontEntryPtr /* entry */,
+ char * /* fileName */,
+ FontScalablePtr /* vals */,
+ fsBitmapFormat /* format */,
+ fsBitmapFormatMask /* fmask */,
+ FontPtr /* non_cachable_font */);
+ int (*GetInfoBitmap)(FontPathElementPtr /* fpe */,
+ FontInfoPtr /* pFontInfo */,
+ FontEntryPtr /* entry */,
+ char * /*fileName */);
+ int (*GetInfoScalable)(FontPathElementPtr /* fpe */,
+ FontInfoPtr /* pFontInfo */,
+ FontEntryPtr /* entry */,
+ FontNamePtr /* fontName */,
+ char * /* fileName */,
+ FontScalablePtr /* vals */);
+ int number;
+ int capabilities; /* Bitmap components defined above */
+} FontRendererRec;
+
+typedef struct _FontRenders {
+ int number;
+ struct _FontRenderersElement {
+ /* In order to preserve backward compatibility, the
+ priority field is made invisible to renderers */
+ FontRendererPtr renderer;
+ int priority;
+ } *renderers;
+} FontRenderersRec, *FontRenderersPtr;
+
+typedef struct _BitmapInstance {
+ FontScalableRec vals;
+ FontBitmapEntryPtr bitmap;
+} BitmapInstanceRec, *BitmapInstancePtr;
+
+typedef struct _BitmapScalablePrivate {
+ int numInstances;
+ BitmapInstancePtr instances;
+} BitmapScalablePrivateRec, *BitmapScalablePrivatePtr;
+
+typedef struct _BitmapSources {
+ FontPathElementPtr *fpe;
+ int size;
+ int count;
+} BitmapSourcesRec, *BitmapSourcesPtr;
+
+extern BitmapSourcesRec FontFileBitmapSources;
+
+/* Defines for FontFileFindNamesInScalableDir() behavior */
+#define NORMAL_ALIAS_BEHAVIOR 0
+#define LIST_ALIASES_AND_TARGET_NAMES (1<<0)
+#define IGNORE_SCALABLE_ALIASES (1<<1)
+
+#endif /* _FONTFILEST_H_ */
diff --git a/font.h b/font.h
new file mode 100644
index 0000000..a834655
--- /dev/null
+++ b/font.h
@@ -0,0 +1,166 @@
+/***********************************************************
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef FONT_H
+#define FONT_H
+
+#ifndef BitmapFormatByteOrderMask
+#include "fsmasks.h"
+#endif
+
+/* data structures */
+#ifndef _XTYPEDEF_FONTPTR
+typedef struct _Font *FontPtr;
+#define _XTYPEDEF_FONTPTR
+#endif
+
+typedef struct _FontInfo *FontInfoPtr;
+typedef struct _FontProp *FontPropPtr;
+typedef struct _ExtentInfo *ExtentInfoPtr;
+typedef struct _FontPathElement *FontPathElementPtr;
+
+#ifndef _XTYPEDEF_CHARINFOPTR
+typedef struct _CharInfo *CharInfoPtr;
+#define _XTYPEDEF_CHARINFOPTR
+#endif
+
+typedef struct _FontNames *FontNamesPtr;
+typedef struct _FontResolution *FontResolutionPtr;
+
+#define NullCharInfo ((CharInfoPtr) 0)
+#define NullFont ((FontPtr) 0)
+#define NullFontInfo ((FontInfoPtr) 0)
+
+ /* draw direction */
+#define LeftToRight 0
+#define RightToLeft 1
+#define BottomToTop 2
+#define TopToBottom 3
+typedef int DrawDirection;
+
+#define NO_SUCH_CHAR -1
+
+
+#define FontAliasType 0x1000
+
+#define AllocError 80
+#define StillWorking 81
+#define FontNameAlias 82
+#define BadFontName 83
+#define Suspended 84
+#define Successful 85
+#define BadFontPath 86
+#define BadCharRange 87
+#define BadFontFormat 88
+#define FPEResetFailed 89 /* for when an FPE reset won't work */
+
+/* OpenFont flags */
+#define FontLoadInfo 0x0001
+#define FontLoadProps 0x0002
+#define FontLoadMetrics 0x0004
+#define FontLoadBitmaps 0x0008
+#define FontLoadAll 0x000f
+#define FontOpenSync 0x0010
+#define FontReopen 0x0020
+
+/* Query flags */
+#define LoadAll 0x1
+#define FinishRamge 0x2
+#define EightBitFont 0x4
+#define SixteenBitFont 0x8
+
+/* Glyph Caching Modes */
+#define CACHING_OFF 0
+#define CACHE_16_BIT_GLYPHS 1
+#define CACHE_ALL_GLYPHS 2
+#define DEFAULT_GLYPH_CACHING_MODE CACHE_16_BIT_GLYPHS
+extern int glyphCachingMode;
+
+struct _Client;
+
+extern int StartListFontsWithInfo(
+ struct _Client * /*client*/,
+ int /*length*/,
+ unsigned char * /*pattern*/,
+ int /*max_names*/
+);
+
+extern FontNamesPtr MakeFontNamesRecord(
+ unsigned /* size */
+);
+
+extern void FreeFontNames(
+ FontNamesPtr /* pFN*/
+);
+
+extern int AddFontNamesName(
+ FontNamesPtr /* names */,
+ char * /* name */,
+ int /* length */
+);
+
+#if 0 /* unused */
+extern int FontToFSError();
+extern FontResolutionPtr GetClientResolution();
+#endif
+
+typedef struct _FontPatternCache *FontPatternCachePtr;
+
+extern FontPatternCachePtr MakeFontPatternCache (
+ void
+);
+
+extern void FreeFontPatternCache (
+ FontPatternCachePtr /* cache */
+);
+
+extern void EmptyFontPatternCache (
+ FontPatternCachePtr /* cache */
+);
+
+extern void CacheFontPattern (
+ FontPatternCachePtr /* cache */,
+ const char * /* pattern */,
+ int /* patlen */,
+ FontPtr /* pFont */
+);
+extern FontResolutionPtr GetClientResolutions(
+ int * /* num */
+);
+
+extern FontPtr FindCachedFontPattern (
+ FontPatternCachePtr /* cache */,
+ const char * /* pattern */,
+ int /* patlen */
+);
+
+extern void RemoveCachedFontPattern (
+ FontPatternCachePtr /* cache */,
+ FontPtr /* pFont */
+);
+
+typedef enum {
+ Linear8Bit, TwoD8Bit, Linear16Bit, TwoD16Bit
+} FontEncoding;
+
+#endif /* FONT_H */
diff --git a/fontaccel.c b/fontaccel.c
index db03e73..e224d4d 100644
--- a/fontaccel.c
+++ b/fontaccel.c
@@ -33,9 +33,9 @@ from The Open Group.
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include <X11/fonts/fontmisc.h>
+#include "fontmisc.h"
#include <X11/fonts/fontstruct.h>
-#include <X11/fonts/fontutil.h>
+#include "fontutil.h"
void
FontComputeInfoAccelerators(FontInfoPtr pFontInfo)
diff --git a/fontink.c b/fontink.c
index f4898da..e4e1862 100644
--- a/fontink.c
+++ b/fontink.c
@@ -34,9 +34,9 @@ from The Open Group.
#include <config.h>
#endif
-#include <X11/fonts/fntfilst.h>
-#include <X11/fonts/bitmap.h>
-#include <X11/fonts/bdfint.h>
+#include "fntfilst.h"
+#include "bitmap.h"
+#include "bdfint.h"
static unsigned char ink_mask_msb[8] = {
0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01,
diff --git a/fontmisc.h b/fontmisc.h
new file mode 100644
index 0000000..d3926a7
--- /dev/null
+++ b/fontmisc.h
@@ -0,0 +1,100 @@
+/*
+
+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.
+
+*/
+
+/*
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+#ifndef _FONTMISC_H_
+#define _FONTMISC_H_
+
+#include <X11/Xfuncs.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <X11/Xdefs.h>
+
+
+#ifndef LSBFirst
+#define LSBFirst 0
+#define MSBFirst 1
+#endif
+
+#ifndef None
+#define None 0l
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#define FALSE 0
+#endif
+
+extern Atom MakeAtom ( const char *string, unsigned len, int makeit );
+extern int ValidAtom ( Atom atom );
+extern char *NameForAtom (Atom atom);
+
+#define lowbit(x) ((x) & (~(x) + 1))
+
+#undef assert
+#define assert(x) ((void)0)
+
+extern void
+BitOrderInvert(
+ register unsigned char *,
+ register int
+);
+
+extern void
+TwoByteSwap(
+ register unsigned char *,
+ register int
+);
+
+extern void
+FourByteSwap(
+ register unsigned char *,
+ register int
+);
+
+extern int
+RepadBitmap (
+ char*,
+ char*,
+ unsigned,
+ unsigned,
+ int,
+ int
+);
+
+extern void CopyISOLatin1Lowered(
+ char * /*dest*/,
+ const char * /*source*/,
+ int /*length*/
+);
+
+extern void register_fpe_functions(void);
+
+#endif /* _FONTMISC_H_ */
diff --git a/fontutil.h b/fontutil.h
new file mode 100644
index 0000000..ed55b89
--- /dev/null
+++ b/fontutil.h
@@ -0,0 +1,24 @@
+#ifndef _FONTUTIL_H_
+#define _FONTUTIL_H_
+
+#include <X11/fonts/FSproto.h>
+
+extern int FontCouldBeTerminal(FontInfoPtr);
+extern int CheckFSFormat(fsBitmapFormat, fsBitmapFormatMask, int *, int *,
+ int *, int *, int *);
+extern void FontComputeInfoAccelerators(FontInfoPtr);
+
+extern void GetGlyphs ( FontPtr font, unsigned long count,
+ unsigned char *chars, FontEncoding fontEncoding,
+ unsigned long *glyphcount, CharInfoPtr *glyphs );
+extern void QueryGlyphExtents ( FontPtr pFont, CharInfoPtr *charinfo,
+ unsigned long count, ExtentInfoRec *info );
+extern Bool QueryTextExtents ( FontPtr pFont, unsigned long count,
+ unsigned char *chars, ExtentInfoRec *info );
+extern Bool ParseGlyphCachingMode ( char *str );
+extern void InitGlyphCaching ( void );
+extern void SetGlyphCachingMode ( int newmode );
+extern int add_range ( fsRange *newrange, int *nranges, fsRange **range,
+ Bool charset_subset );
+
+#endif /* _FONTUTIL_H_ */
diff --git a/fontxlfd.h b/fontxlfd.h
new file mode 100644
index 0000000..3555706
--- /dev/null
+++ b/fontxlfd.h
@@ -0,0 +1,97 @@
+/*
+
+Copyright 1990, 1994, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+/*
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+#ifndef _FONTXLFD_H_
+#define _FONTXLFD_H_
+
+#include <X11/fonts/FSproto.h>
+
+/* Constants for values_supplied bitmap */
+
+#define SIZE_SPECIFY_MASK 0xf
+
+#define PIXELSIZE_MASK 0x3
+#define PIXELSIZE_UNDEFINED 0
+#define PIXELSIZE_SCALAR 0x1
+#define PIXELSIZE_ARRAY 0x2
+#define PIXELSIZE_SCALAR_NORMALIZED 0x3 /* Adjusted for resolution */
+
+#define POINTSIZE_MASK 0xc
+#define POINTSIZE_UNDEFINED 0
+#define POINTSIZE_SCALAR 0x4
+#define POINTSIZE_ARRAY 0x8
+
+#define PIXELSIZE_WILDCARD 0x10
+#define POINTSIZE_WILDCARD 0x20
+
+#define ENHANCEMENT_SPECIFY_MASK 0x40
+
+#define CHARSUBSET_SPECIFIED 0x40
+
+#define EPS 1.0e-20
+#define XLFD_NDIGITS 3 /* Round numbers in pixel and
+ point arrays to this many
+ digits for repeatability */
+
+typedef struct _FontScalable {
+ int values_supplied; /* Bitmap identifying what advanced
+ capabilities or enhancements
+ were specified in the font name */
+ double pixel_matrix[4];
+ double point_matrix[4];
+
+ /* Pixel and point fields are deprecated in favor of the
+ transformation matrices. They are provided and filled in for the
+ benefit of rasterizers that do not handle the matrices. */
+
+ int pixel,
+ point;
+
+ int x,
+ y,
+ width;
+ char *xlfdName;
+ int nranges;
+ fsRange *ranges;
+} FontScalableRec, *FontScalablePtr;
+
+
+extern double xlfd_round_double ( double x );
+extern Bool FontParseXLFDName ( char *fname, FontScalablePtr vals, int subst );
+extern fsRange *FontParseRanges ( char *name, int *nranges );
+
+#define FONT_XLFD_REPLACE_NONE 0
+#define FONT_XLFD_REPLACE_STAR 1
+#define FONT_XLFD_REPLACE_ZERO 2
+#define FONT_XLFD_REPLACE_VALUE 3
+
+#endif /* _FONTXLFD_H_ */
diff --git a/pcf.h b/pcf.h
new file mode 100644
index 0000000..e0f5668
--- /dev/null
+++ b/pcf.h
@@ -0,0 +1,97 @@
+/*
+
+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.
+
+*/
+
+/*
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+#ifndef _PCF_H_
+#define _PCF_H_
+
+#include "fntfilio.h"
+
+/*
+ * Information used to read/write PCF fonts
+ */
+
+typedef struct _PCFTable {
+ CARD32 type;
+ CARD32 format;
+ CARD32 size;
+ CARD32 offset;
+} PCFTableRec, *PCFTablePtr;
+
+#define PCF_FILE_VERSION (('p'<<24)|('c'<<16)|('f'<<8)|1)
+#define PCF_FORMAT_MASK 0xffffff00
+
+#define PCF_DEFAULT_FORMAT 0x00000000
+#define PCF_INKBOUNDS 0x00000200
+#define PCF_ACCEL_W_INKBOUNDS 0x00000100
+#define PCF_COMPRESSED_METRICS 0x00000100
+
+#define PCF_FORMAT_MATCH(a,b) (((a)&PCF_FORMAT_MASK) == ((b)&PCF_FORMAT_MASK))
+
+#define PCF_GLYPH_PAD_MASK (3<<0)
+#define PCF_BYTE_MASK (1<<2)
+#define PCF_BIT_MASK (1<<3)
+#define PCF_SCAN_UNIT_MASK (3<<4)
+
+#define PCF_BYTE_ORDER(f) (((f) & PCF_BYTE_MASK)?MSBFirst:LSBFirst)
+#define PCF_BIT_ORDER(f) (((f) & PCF_BIT_MASK)?MSBFirst:LSBFirst)
+#define PCF_GLYPH_PAD_INDEX(f) ((f) & PCF_GLYPH_PAD_MASK)
+#define PCF_GLYPH_PAD(f) (1<<PCF_GLYPH_PAD_INDEX(f))
+#define PCF_SCAN_UNIT_INDEX(f) (((f) & PCF_SCAN_UNIT_MASK) >> 4)
+#define PCF_SCAN_UNIT(f) (1<<PCF_SCAN_UNIT_INDEX(f))
+#define PCF_FORMAT_BITS(f) ((f) & (PCF_GLYPH_PAD_MASK|PCF_BYTE_MASK|PCF_BIT_MASK|PCF_SCAN_UNIT_MASK))
+
+#define PCF_SIZE_TO_INDEX(s) ((s) == 4 ? 2 : (s) == 2 ? 1 : 0)
+#define PCF_INDEX_TO_SIZE(b) (1<<b)
+
+#define PCF_FORMAT(bit,byte,glyph,scan) (\
+ (PCF_SIZE_TO_INDEX(scan) << 4) | \
+ (((bit) == MSBFirst ? 1 : 0) << 3) | \
+ (((byte) == MSBFirst ? 1 : 0) << 2) | \
+ (PCF_SIZE_TO_INDEX(glyph) << 0))
+
+#define PCF_PROPERTIES (1<<0)
+#define PCF_ACCELERATORS (1<<1)
+#define PCF_METRICS (1<<2)
+#define PCF_BITMAPS (1<<3)
+#define PCF_INK_METRICS (1<<4)
+#define PCF_BDF_ENCODINGS (1<<5)
+#define PCF_SWIDTHS (1<<6)
+#define PCF_GLYPH_NAMES (1<<7)
+#define PCF_BDF_ACCELERATORS (1<<8)
+
+extern int pcfReadFont ( FontPtr pFont, FontFilePtr file,
+ int bit, int byte, int glyph, int scan );
+extern int pcfReadFontInfo ( FontInfoPtr pFontInfo, FontFilePtr file );
+extern int pcfWriteFont ( FontPtr pFont, FontFilePtr file );
+extern void pcfError ( const char *, ... ) _X_ATTRIBUTE_PRINTF(1, 2);
+
+#endif /* _PCF_H_ */
diff --git a/pcfwrite.c b/pcfwrite.c
index ea2049f..8ef716f 100644
--- a/pcfwrite.c
+++ b/pcfwrite.c
@@ -34,9 +34,9 @@ from The Open Group.
#include <config.h>
#endif
-#include <X11/fonts/fntfilst.h>
-#include <X11/fonts/bitmap.h>
-#include <X11/fonts/pcf.h>
+#include "fntfilst.h"
+#include "bitmap.h"
+#include "pcf.h"
#include <stdarg.h>
#include <stdio.h>
diff --git a/private.c b/private.c
index ba2d61e..9714228 100644
--- a/private.c
+++ b/private.c
@@ -31,7 +31,7 @@ in this Software without prior written authorization from The Open Group.
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include <X11/fonts/fontmisc.h>
+#include "fontmisc.h"
#include <X11/fonts/fontstruct.h>
static int _FontPrivateAllocateIndex = 0;
diff --git a/stubs.h b/stubs.h
index 9e71806..762f96a 100644
--- a/stubs.h
+++ b/stubs.h
@@ -1,6 +1,6 @@
#include <stdio.h>
-#include <X11/fonts/fntfilst.h>
-#include <X11/fonts/font.h>
+#include "fntfilst.h"
+#include "font.h"
#ifndef True
#define True (-1)
diff --git a/utilbitmap.c b/utilbitmap.c
index 1c5cf0d..7e78424 100644
--- a/utilbitmap.c
+++ b/utilbitmap.c
@@ -31,7 +31,7 @@ in this Software without prior written authorization from The Open Group.
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include <X11/fonts/fontmisc.h>
+#include "fontmisc.h"
/* Utility functions for reformating font bitmaps */