diff options
Diffstat (limited to 'libXfont')
25 files changed, 221 insertions, 95 deletions
diff --git a/libXfont/config.h b/libXfont/config.h new file mode 100644 index 000000000..2f66903bc --- /dev/null +++ b/libXfont/config.h @@ -0,0 +1,31 @@ +/* Support bdf format bitmap font files */ +#define XFONT_BDFFORMAT 1 + +/* Support bitmap font files */ +#define XFONT_BITMAP 1 + +/* Support built-in fonts */ +#define XFONT_BUILTINS 1 + +/* Support the X Font Services Protocol */ +#define XFONT_FC 1 + +/* Support fonts in files */ +#define XFONT_FONTFILE 1 + +/* Support FreeType rasterizer for nearly all font file formats */ +#define XFONT_FREETYPE 1 + +/* Support pcf format bitmap font files */ +#define XFONT_PCFFORMAT 1 + +/* Support snf format bitmap font files */ +#define XFONT_SNFFORMAT 1 + +/* Support bzip2 for bitmap fonts */ +#undef X_BZIP2_FONT_COMPRESSION + +/* Support gzip for bitmap fonts */ +#define X_GZIP_FONT_COMPRESSION 1 + +#include <dix-config.h> diff --git a/libXfont/src/FreeType/ftenc.c b/libXfont/src/FreeType/ftenc.c index 9e31d7529..08e206c2a 100644 --- a/libXfont/src/FreeType/ftenc.c +++ b/libXfont/src/FreeType/ftenc.c @@ -31,7 +31,7 @@ THE SOFTWARE. #include <X11/fonts/fontmisc.h> #include <X11/fonts/fontenc.h> -#include <ft2build.h> +#include <config/ftheader.h> #include FT_FREETYPE_H #include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TABLES_H diff --git a/libXfont/src/FreeType/ftfuncs.c b/libXfont/src/FreeType/ftfuncs.c index bca58188b..f8b01835c 100644 --- a/libXfont/src/FreeType/ftfuncs.c +++ b/libXfont/src/FreeType/ftfuncs.c @@ -34,6 +34,7 @@ THE SOFTWARE. #include <string.h> #include <math.h> #include <ctype.h> +#include <unistd.h> #include <X11/fonts/fntfilst.h> #include <X11/fonts/fontutil.h> @@ -130,6 +131,9 @@ sfnt_get_ushort( FT_Face face, #define sfnt_get_short(f,t,o) ((FT_Short)sfnt_get_ushort((f),(t),(o))) +#ifdef _MSC_VER +#define hypot _hypot +#endif static int ftypeInitP = 0; /* is the engine initialised? */ FT_Library ftypeLibrary; @@ -1465,7 +1469,7 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, current_raster[j]|=current_buffer[jj]>>mod_dx0; j++; prev_jj++; jj++; for( ; j<bpr ; j++,prev_jj++,jj++ ){ - current_raster[j]|=current_buffer[prev_jj]<<mod_dx1; + current_raster[j]|=(current_buffer[prev_jj]<<mod_dx1)&0xff; if( bitmap->pitch <= jj ) break; current_raster[j]|=current_buffer[jj]>>mod_dx0; } diff --git a/libXfont/src/FreeType/fttools.c b/libXfont/src/FreeType/fttools.c index bc75b7e4f..a0e34d021 100644 --- a/libXfont/src/FreeType/fttools.c +++ b/libXfont/src/FreeType/fttools.c @@ -40,6 +40,13 @@ #define MSBFirst 1 #endif +#ifdef LOBYTE +#undef LOBYTE +#endif +#ifdef HIBYTE +#undef HIBYTE +#endif + #define LOBYTE(s,byte) ((byte)==LSBFirst?*(char*)(s):*((char*)(s)+1)) #define HIBYTE(s,byte) ((byte)==LSBFirst?*((char*)(s)+1):*(char*)(s)) diff --git a/libXfont/src/FreeType/makefile b/libXfont/src/FreeType/makefile new file mode 100644 index 000000000..8d4fee2b6 --- /dev/null +++ b/libXfont/src/FreeType/makefile @@ -0,0 +1,15 @@ +LIBRARY = libft + +CSRCS = \ + ftenc.c \ + ftfuncs.c \ + fttools.c \ + xttcap.c + +INCLUDES += $(MHMAKECONF)\freetype\include\freetype $(MHMAKECONF)\freetype\include + +DEFINES += strcasecmp=_stricmp + +INCLUDES := ../.. $(INCLUDES) + + diff --git a/libXfont/src/FreeType/xttcap.c b/libXfont/src/FreeType/xttcap.c index cee752ebf..fde5534e8 100644 --- a/libXfont/src/FreeType/xttcap.c +++ b/libXfont/src/FreeType/xttcap.c @@ -45,6 +45,7 @@ static char const * const releaseID = #include <string.h> #include <ctype.h> #include <math.h> +#include <unistd.h> #ifndef True #define True (-1) diff --git a/libXfont/src/bitmap/bitmapfunc.c b/libXfont/src/bitmap/bitmapfunc.c index 47ce488d0..653ff5d55 100644 --- a/libXfont/src/bitmap/bitmapfunc.c +++ b/libXfont/src/bitmap/bitmapfunc.c @@ -101,6 +101,7 @@ static BitmapFileFunctionsRec readers[] = { { bdfReadFont, bdfReadFontInfo} , # endif #endif + { NULL, NULL } }; @@ -229,9 +230,10 @@ static FontRendererRec renderers[] = { CAPABILITIES }, # endif #endif + { NULL, 0, NULL, 0, NULL, NULL, 0, 0 } }; -#define numRenderers (sizeof renderers / sizeof renderers[0]) +#define numRenderers (sizeof renderers / sizeof renderers[0] - 1) void BitmapRegisterFontFileFunctions (void) diff --git a/libXfont/src/bitmap/bitmaputil.c b/libXfont/src/bitmap/bitmaputil.c index 0a1c87e73..7ac94b3fb 100644 --- a/libXfont/src/bitmap/bitmaputil.c +++ b/libXfont/src/bitmap/bitmaputil.c @@ -34,13 +34,9 @@ from The Open Group. #include <X11/fonts/bitmap.h> #include <X11/fonts/bdfint.h> -#ifndef MAXSHORT #define MAXSHORT 32767 -#endif -#ifndef MINSHORT #define MINSHORT -32768 -#endif static xCharInfo initMinMetrics = { MAXSHORT, MAXSHORT, MAXSHORT, MAXSHORT, MAXSHORT, 0xFFFF}; diff --git a/libXfont/src/bitmap/bitscale.c b/libXfont/src/bitmap/bitscale.c index e89ba7ce0..130dffd86 100644 --- a/libXfont/src/bitmap/bitscale.c +++ b/libXfont/src/bitmap/bitscale.c @@ -59,6 +59,10 @@ from The Open Group. #define MAX(a,b) (((a)>(b)) ? a : b) #endif +#ifdef _MSC_VER +#define hypot _hypot +#endif + /* Should get this from elsewhere */ extern unsigned long serverGeneration; diff --git a/libXfont/src/bitmap/makefile b/libXfont/src/bitmap/makefile new file mode 100644 index 000000000..f7ea10fdc --- /dev/null +++ b/libXfont/src/bitmap/makefile @@ -0,0 +1,16 @@ +LIBRARY = libbitmap + +CSRCS = \ + bdfread.c \ + bdfutils.c \ + bitmap.c \ + bitmapfunc.c \ + bitmaputil.c \ + bitscale.c \ + fontink.c \ + pcfread.c \ + pcfwrite.c \ + snfread.c + +INCLUDES := ../.. $(INCLUDES) + diff --git a/libXfont/src/builtins/dir.c b/libXfont/src/builtins/dir.c index bf351b147..cd50cef56 100644 --- a/libXfont/src/builtins/dir.c +++ b/libXfont/src/builtins/dir.c @@ -25,6 +25,7 @@ #include <config.h> #endif #include "builtin.h" +#include <unistd.h> static BuiltinDirPtr BuiltinDirsDup (const BuiltinDirPtr a_dirs, diff --git a/libXfont/src/builtins/makefile b/libXfont/src/builtins/makefile new file mode 100644 index 000000000..dac4fcf8c --- /dev/null +++ b/libXfont/src/builtins/makefile @@ -0,0 +1,10 @@ +LIBRARY = libbuiltins + +CSRCS = dir.c \ + file.c \ + fonts.c \ + fpe.c \ + render.c + +INCLUDES := ../.. $(INCLUDES) + diff --git a/libXfont/src/fc/fsio.c b/libXfont/src/fc/fsio.c index 4deab8876..3d2aa502d 100644 --- a/libXfont/src/fc/fsio.c +++ b/libXfont/src/fc/fsio.c @@ -32,6 +32,7 @@ #ifdef WIN32 #define _WILLWINSOCK_ +#include "X11/Xwinsock.h" #include "X11/Xwindows.h" #endif @@ -57,6 +58,7 @@ #endif #include <errno.h> #ifdef WIN32 +#undef EWOULDBLOCK #define EWOULDBLOCK WSAEWOULDBLOCK #undef EINTR #define EINTR WSAEINTR diff --git a/libXfont/src/fc/fstrans.c b/libXfont/src/fc/fstrans.c index c334c2504..74a884e63 100644 --- a/libXfont/src/fc/fstrans.c +++ b/libXfont/src/fc/fstrans.c @@ -22,6 +22,7 @@ #ifdef HAVE_CONFIG_H #include <config.h> +#include <dix-config.h> #endif #define FONT_t #define TRANS_CLIENT diff --git a/libXfont/src/fc/makefile b/libXfont/src/fc/makefile new file mode 100644 index 000000000..a4b105d26 --- /dev/null +++ b/libXfont/src/fc/makefile @@ -0,0 +1,10 @@ + +INCLUDES := ../.. $(INCLUDES) + +LIBRARY = libfc + +CSRCS =\ + fsconvert.c \ + fserve.c \ + fsio.c \ + fstrans.c diff --git a/libXfont/src/fontfile/catalogue.c b/libXfont/src/fontfile/catalogue.c index 623093011..d5721ab68 100644 --- a/libXfont/src/fontfile/catalogue.c +++ b/libXfont/src/fontfile/catalogue.c @@ -27,6 +27,7 @@ #ifdef HAVE_CONFIG_H #include <config.h> #endif +#include <X11/Xwindows.h> #ifdef HAVE_READLINK #include <X11/fonts/fntfilst.h> @@ -142,7 +143,7 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan) int pathlen; path = fpe->name + strlen(CataloguePrefix); - if (stat(path, &statbuf) < 0 || !S_ISDIR(statbuf.st_mode)) + if (stat(path, &statbuf) < 0 || (statbuf.st_mode&_S_IFDIR)) return BadFontPath; if ((forceScan == FALSE) && (statbuf.st_mtime <= cat->mtime)) @@ -156,6 +157,7 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan) } CatalogueUnrefFPEs (fpe); + #ifndef _MSC_VER while (entry = readdir(dir), entry != NULL) { snprintf(link, sizeof link, "%s/%s", path, entry->d_name); @@ -220,6 +222,7 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan) continue; } } + #endif closedir(dir); diff --git a/libXfont/src/fontfile/fontdir.c b/libXfont/src/fontfile/fontdir.c index 7271603ec..a4d41960b 100644 --- a/libXfont/src/fontfile/fontdir.c +++ b/libXfont/src/fontfile/fontdir.c @@ -34,6 +34,8 @@ in this Software without prior written authorization from The Open Group. #include <X11/fonts/fntfilst.h> #include <X11/keysym.h> +#include <unistd.h> + #if HAVE_STDINT_H #include <stdint.h> #elif !defined(INT32_MAX) diff --git a/libXfont/src/fontfile/fontfile.c b/libXfont/src/fontfile/fontfile.c index eb37a8705..7372d3ece 100644 --- a/libXfont/src/fontfile/fontfile.c +++ b/libXfont/src/fontfile/fontfile.c @@ -36,6 +36,12 @@ in this Software without prior written authorization from The Open Group. #ifdef WIN32 #include <ctype.h> #endif +#ifdef _MSC_VER +#define BOOL W32BOOL +#include <windows.h> +#undef _X_HIDDEN +#define _X_HIDDEN static +#endif static unsigned char ISOLatin1ToLower(unsigned char source) @@ -49,7 +55,7 @@ ISOLatin1ToLower(unsigned char source) return source; } -_X_HIDDEN void +void CopyISOLatin1Lowered(char *dest, char *source, int length) { int i; @@ -71,6 +77,32 @@ static int FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont, int FontFileNameCheck (char *name) { +#ifdef _MSC_VER + WIN32_FIND_DATA FindData; + HANDLE hFind; + char Tmp; + int LenName=strlen(name)-1; + Tmp=name[LenName]; + if (Tmp=='/') + name[LenName]=0; + hFind=FindFirstFile(name,&FindData); + name[LenName]=Tmp; + + if (hFind==INVALID_HANDLE_VALUE) + { + return 0; + } + else + { + FindClose(hFind); + if (FindData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) + { + return 1; + } + return 0; + } + +#else #ifndef NCD #if defined(WIN32) /* OS/2 uses D:/... as a path name for fonts, so accept this as a valid @@ -83,6 +115,7 @@ FontFileNameCheck (char *name) #else return ((strcmp(name, "built-ins") == 0) || (*name == '/')); #endif +#endif } int diff --git a/libXfont/src/fontfile/fontscale.c b/libXfont/src/fontfile/fontscale.c index 55aca298a..eb8d0bb58 100644 --- a/libXfont/src/fontfile/fontscale.c +++ b/libXfont/src/fontfile/fontscale.c @@ -34,6 +34,10 @@ in this Software without prior written authorization from The Open Group. #include <X11/fonts/fntfilst.h> #include <math.h> +#ifdef _MSC_VER +#define hypot _hypot +#endif + Bool FontFileAddScaledInstance (FontEntryPtr entry, FontScalablePtr vals, FontPtr pFont, char *bitmapName) diff --git a/libXfont/src/fontfile/makefile b/libXfont/src/fontfile/makefile new file mode 100644 index 000000000..619cdbdbb --- /dev/null +++ b/libXfont/src/fontfile/makefile @@ -0,0 +1,24 @@ + +LIBRARY = libfontfile + +DEFINES += X_GZIP_FONT_COMPRESSION + +CSRCS = bitsource.c \ + bufio.c \ + decompress.c \ + defaults.c \ + dirfile.c \ + fileio.c \ + filewr.c \ + fontdir.c \ + fontencc.c \ + fontfile.c \ + fontscale.c \ + gunzip.c \ + register.c \ + renderers.c \ + catalogue.c + +INCLUDES := ../.. $(INCLUDES) + + diff --git a/libXfont/src/fontfile/renderers.c b/libXfont/src/fontfile/renderers.c index a9e4bef53..e17d6a77e 100644 --- a/libXfont/src/fontfile/renderers.c +++ b/libXfont/src/fontfile/renderers.c @@ -32,6 +32,7 @@ in this Software without prior written authorization from The Open Group. #include <config.h> #endif #include <X11/fonts/fntfilst.h> +#include <unistd.h> extern void ErrorF(const char *f, ...); static FontRenderersRec renderers; diff --git a/libXfont/src/stubs/makefile b/libXfont/src/stubs/makefile new file mode 100644 index 000000000..e028dd5db --- /dev/null +++ b/libXfont/src/stubs/makefile @@ -0,0 +1,26 @@ +LIBRARY = libstubs + +CSRCS = \ + cauthgen.c \ + csignal.c \ + delfntcid.c \ + errorf.c \ + fatalerror.c \ + findoldfnt.c \ + getcres.c \ + getdefptsize.c \ + getnewfntcid.c \ + gettime.c \ + initfshdl.c \ + regfpefunc.c \ + rmfshdl.c \ + servclient.c \ + setfntauth.c \ + stfntcfnt.c \ + stubs.h + +CSRCS:=$(filter-out %.h,$(CSRCS)) + +INCLUDES := ../.. $(INCLUDES) + + diff --git a/libXfont/src/util/fontxlfd.c b/libXfont/src/util/fontxlfd.c index 974128ee3..ace87809b 100644 --- a/libXfont/src/util/fontxlfd.c +++ b/libXfont/src/util/fontxlfd.c @@ -33,6 +33,7 @@ from The Open Group. #ifdef HAVE_CONFIG_H #include <config.h> #endif +#include <float.h> #include <X11/fonts/fontmisc.h> #include <X11/fonts/fontstruct.h> #include <X11/fonts/fontxlfd.h> @@ -194,7 +195,6 @@ xlfd_round_double(double x) defined(__hppa__) || \ defined(__amd64__) || defined(__amd64) || \ defined(sgi) -#include <float.h> /* if we have IEEE 754 fp, we can round to binary digits... */ @@ -234,7 +234,7 @@ xlfd_round_double(double x) j = 1 << ((DBL_MANT_DIG-XLFD_NDIGITS_2) & 0x07); for (; i<7; i++) { k = d.b[i] + j; - d.b[i] = k; + d.b[i] = k&0xff; if (k & 0x100) j = 1; else break; } diff --git a/libXfont/src/util/makefile b/libXfont/src/util/makefile new file mode 100644 index 000000000..53b5560a3 --- /dev/null +++ b/libXfont/src/util/makefile @@ -0,0 +1,17 @@ +LIBRARY = libutil + +INCLUDES += ../stubs + +INCLUDES := ../.. $(INCLUDES) + +CSRCS = \ + atom.c \ + fontaccel.c \ + fontnames.c \ + fontutil.c \ + fontxlfd.c \ + format.c \ + miscutil.c \ + patcache.c \ + private.c \ + utilbitmap.c diff --git a/libXfont/src/util/utilbitmap.c b/libXfont/src/util/utilbitmap.c index 5feb2d133..619f72eaa 100644 --- a/libXfont/src/util/utilbitmap.c +++ b/libXfont/src/util/utilbitmap.c @@ -33,90 +33,6 @@ in this Software without prior written authorization from The Open Group. #endif #include <X11/fonts/fontmisc.h> -/* Utility functions for reformating font bitmaps */ - -static const unsigned char _reverse_byte[0x100] = { - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, - 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, - 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, - 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, - 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, - 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, - 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, - 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, - 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, - 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, - 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, - 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, - 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, - 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, - 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, - 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, - 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, - 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, - 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, - 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, - 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, - 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, - 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, - 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, - 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, - 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, - 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, - 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, - 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, - 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, - 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, - 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff -}; - -/* - * Invert bit order within each BYTE of an array. - */ -void -BitOrderInvert(unsigned char *buf, int nbytes) -{ - const unsigned char *rev = _reverse_byte; - - for (; --nbytes >= 0; buf++) - *buf = rev[*buf]; -} - -/* - * Invert byte order within each 16-bits of an array. - */ -void -TwoByteSwap(unsigned char *buf, int nbytes) -{ - unsigned char c; - - for (; nbytes > 0; nbytes -= 2, buf += 2) - { - c = buf[0]; - buf[0] = buf[1]; - buf[1] = c; - } -} - -/* - * Invert byte order within each 32-bits of an array. - */ -void -FourByteSwap(unsigned char *buf, int nbytes) -{ - unsigned char c; - - for (; nbytes > 0; nbytes -= 4, buf += 4) - { - c = buf[0]; - buf[0] = buf[3]; - buf[3] = c; - c = buf[1]; - buf[1] = buf[2]; - buf[2] = c; - } -} - /* * Repad a bitmap */ |