diff options
Diffstat (limited to 'libXfont/src/fontfile')
-rw-r--r-- | libXfont/src/fontfile/catalogue.c | 5 | ||||
-rw-r--r-- | libXfont/src/fontfile/fontdir.c | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | libXfont/src/fontfile/fontfile.c | 37 | ||||
-rw-r--r-- | libXfont/src/fontfile/fontscale.c | 4 | ||||
-rw-r--r-- | libXfont/src/fontfile/makefile | 24 | ||||
-rw-r--r-- | libXfont/src/fontfile/renderers.c | 1 |
6 files changed, 70 insertions, 3 deletions
diff --git a/libXfont/src/fontfile/catalogue.c b/libXfont/src/fontfile/catalogue.c index 81a1e13f1..dbfb1cc25 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) { char *name; @@ -222,6 +224,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 05a961072..55aa98d4d 100644..100755 --- 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, const char *source, int length) { int i; @@ -69,8 +75,34 @@ static int FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont, FontPtr non_cachable_font); int -FontFileNameCheck (const char *name) +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 (const 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 a21802ff8..bfaa7ec00 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 bbcd46694..7c341f6d8 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; |