From cd24fcabc449bbc701a25e3cad279009dec69032 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 9 Jul 2005 23:31:40 +0000 Subject: Switch from monolithic configuration symbols to modular ones, add backward compatibility for monolithic symbols --- src/bitmap/bitmapfunc.c | 32 ++++++++++++++++++++++++-------- src/bitmap/bitscale.c | 32 ++++++++++++++++++++++++++++---- src/fontfile/register.c | 44 ++++++++++++++++++++++++++++++++++---------- 3 files changed, 86 insertions(+), 22 deletions(-) diff --git a/src/bitmap/bitmapfunc.c b/src/bitmap/bitmapfunc.c index 36356fd..e6187e5 100644 --- a/src/bitmap/bitmapfunc.c +++ b/src/bitmap/bitmapfunc.c @@ -36,6 +36,22 @@ in this Software without prior written authorization from The Open Group. #include #endif +/* + * Translate monolithic #defines to modular definitions + */ + +#ifdef PCFFORMAT +#define XFONT_PCFFORMAT 1 +#endif + +#ifdef SNFFORMAT +#define XFONT_SNFFORMAT 1 +#endif + +#ifdef BDFFORMAT +#define XFONT_BDFFORMAT 1 +#endif + #include #include #include @@ -58,28 +74,28 @@ typedef struct _BitmapFileFunctions { * */ static BitmapFileFunctionsRec readers[] = { -#ifdef PCFFORMAT +#if XFONT_PCFFORMAT { pcfReadFont, pcfReadFontInfo} , { pcfReadFont, pcfReadFontInfo} , #ifdef X_GZIP_FONT_COMPRESSION { pcfReadFont, pcfReadFontInfo} , #endif #endif -#ifdef SNFFORMAT +#if XFONT_SNFFORMAT { snfReadFont, snfReadFontInfo}, { snfReadFont, snfReadFontInfo}, #ifdef X_GZIP_FONT_COMPRESSION { snfReadFont, snfReadFontInfo} , #endif #endif -#ifdef BDFFORMAT +#if XFONT_BDFFORMAT { bdfReadFont, bdfReadFontInfo} , { bdfReadFont, bdfReadFontInfo} , #ifdef X_GZIP_FONT_COMPRESSION { bdfReadFont, bdfReadFontInfo} , #endif #endif -#ifdef PCFFORMAT +#if XFONT_PCFFORMAT { pmfReadFont, pcfReadFontInfo} , #endif }; @@ -88,7 +104,7 @@ static BitmapFileFunctionsRec readers[] = { #define CAPABILITIES (CAP_MATRIX | CAP_CHARSUBSETTING) static FontRendererRec renderers[] = { -#ifdef PCFFORMAT +#if XFONT_PCFFORMAT { ".pcf", 4, BitmapOpenBitmap, BitmapOpenScalable, BitmapGetInfoBitmap, BitmapGetInfoScalable, 0, CAPABILITIES }, @@ -102,7 +118,7 @@ static FontRendererRec renderers[] = { CAPABILITIES }, #endif #endif -#ifdef SNFFORMAT +#if XFONT_SNFFORMAT { ".snf", 4, BitmapOpenBitmap, BitmapOpenScalable, BitmapGetInfoBitmap, BitmapGetInfoScalable, 0, CAPABILITIES }, @@ -115,7 +131,7 @@ static FontRendererRec renderers[] = { CAPABILITIES }, #endif #endif -#ifdef BDFFORMAT +#if XFONT_BDFFORMAT { ".bdf", 4, BitmapOpenBitmap, BitmapOpenScalable, BitmapGetInfoBitmap, BitmapGetInfoScalable, 0, CAPABILITIES }, @@ -128,7 +144,7 @@ static FontRendererRec renderers[] = { CAPABILITIES }, #endif #endif -#ifdef PCFFORMAT +#if XFONT_PCFFORMAT { ".pmf", 4, BitmapOpenBitmap, BitmapOpenScalable, BitmapGetInfoBitmap, BitmapGetInfoScalable, 0, CAPABILITIES } diff --git a/src/bitmap/bitscale.c b/src/bitmap/bitscale.c index 3e49ecf..8f7247e 100644 --- a/src/bitmap/bitscale.c +++ b/src/bitmap/bitscale.c @@ -36,6 +36,22 @@ from The Open Group. #include #endif +/* + * Translate monolithic #defines to modular definitions + */ + +#ifdef PCFFORMAT +#define XFONT_PCFFORMAT 1 +#endif + +#ifdef SNFFORMAT +#define XFONT_SNFFORMAT 1 +#endif + +#ifdef BDFFORMAT +#define XFONT_BDFFORMAT 1 +#endif + #include #include #include @@ -89,28 +105,28 @@ typedef FontPtr (*ScaleFunc) ( FontPtr /* pf */, /* These next two arrays must be kept in step with the renderer array */ ScaleFunc scale[] = { -#ifdef PCFFORMAT +#if XFONT_PCFFORMAT BitmapScaleBitmaps, BitmapScaleBitmaps, #ifdef X_GZIP_FONT_COMPRESSION BitmapScaleBitmaps, #endif #endif -#ifdef SNFFORMAT +#if XFONT_SNFFORMAT BitmapScaleBitmaps, BitmapScaleBitmaps, #ifdef X_GZIP_FONT_COMPRESSION BitmapScaleBitmaps, #endif #endif -#ifdef BDFFORMAT +#if XFONT_BDFFORMAT BitmapScaleBitmaps, BitmapScaleBitmaps, #ifdef X_GZIP_FONT_COMPRESSION BitmapScaleBitmaps, #endif #endif -#ifdef PCFFORMAT +#if XFONT_PCFFORMAT PrinterScaleBitmaps, #endif }; @@ -139,22 +155,30 @@ typedef FontEntryPtr (*FindToScale) (FontPathElementPtr fpe, FontPathElementPtr *fpep); FindToScale find_scale[] = { +#if XFONT_PCFFORMAT FindBestToScale, FindBestToScale, #ifdef X_GZIP_FONT_COMPRESSION FindBestToScale, #endif +#endif +#if XFONT_SNFFORMAT FindBestToScale, FindBestToScale, #ifdef X_GZIP_FONT_COMPRESSION FindBestToScale, #endif +#endif +#if XFONT_BDFFORMAT FindBestToScale, FindBestToScale, #ifdef X_GZIP_FONT_COMPRESSION FindBestToScale, #endif +#endif +#if XFONT_PCFFORMAT FindPmfToScale, +#endif }; static unsigned long bitscaleGeneration = 0; /* initialization flag */ diff --git a/src/fontfile/register.c b/src/fontfile/register.c index dd4a04b..cb74c7c 100644 --- a/src/fontfile/register.c +++ b/src/fontfile/register.c @@ -35,7 +35,10 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include +#else +#define XFONT_BITMAP 1 #endif + #include #include #include @@ -44,29 +47,50 @@ in this Software without prior written authorization from The Open Group. #include #endif +/* + * Translate monolithic build symbols to modular build symbols. + * I chose to make the modular symbols 'canonical' because they + * are prefixed with XFONT_, neatly avoiding name collisions + * with other packages. + */ + +#ifndef CRAY +# ifdef BUILD_SPEEDO +# define XFONT_SPEEDO 1 +# endif +# ifdef BUILD_TYPE1 +# define XFONT_TYPE1 1 +# endif +#endif + +#ifdef BUILD_CID +# define XFONT_CID 1 +#endif +#ifdef BUILD_FREETYPE +# define XFONT_FREETYPE 1 +#endif + void FontFileRegisterFpeFunctions(void) { #ifndef LOADABLEFONTS - BitmapRegisterFontFileFunctions (); - -#ifndef CRAY -#ifdef BUILD_SPEEDO +#ifdef XFONT_BITMAP + BitmapRegisterFontFileFunctions (); +#endif +#ifdef XFONT_SPEEDO SpeedoRegisterFontFileFunctions (); #endif -#ifdef BUILD_TYPE1 +#ifdef XFONT_TYPE1 Type1RegisterFontFileFunctions(); #endif -#endif -#ifdef BUILD_CID +#ifdef XFONT_CID CIDRegisterFontFileFunctions(); #endif -#ifdef BUILD_FREETYPE +#ifdef XFONT_FREETYPE FreeTypeRegisterFontFileFunctions(); #endif - #else { int i; @@ -79,7 +103,7 @@ FontFileRegisterFpeFunctions(void) } } #endif - + FontFileRegisterLocalFpeFunctions (); } -- cgit v1.2.3