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 | ||||
-rw-r--r-- | libXfont/src/fontfile/fontfile.c | 35 | ||||
-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, 69 insertions, 2 deletions
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; |