aboutsummaryrefslogtreecommitdiff
path: root/libXfont/src/fontfile
diff options
context:
space:
mode:
Diffstat (limited to 'libXfont/src/fontfile')
-rw-r--r--libXfont/src/fontfile/catalogue.c5
-rw-r--r--libXfont/src/fontfile/fontfile.c35
-rw-r--r--libXfont/src/fontfile/fontscale.c4
-rw-r--r--libXfont/src/fontfile/makefile26
-rw-r--r--libXfont/src/fontfile/renderers.c1
5 files changed, 69 insertions, 2 deletions
diff --git a/libXfont/src/fontfile/catalogue.c b/libXfont/src/fontfile/catalogue.c
index 3a04a754d..5ce8a0799 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>
#include <X11/fonts/fntfilst.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -140,7 +141,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))
@@ -154,6 +155,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);
@@ -218,6 +220,7 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan)
continue;
}
}
+ #endif
closedir(dir);
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..6468ff9b5
--- /dev/null
+++ b/libXfont/src/fontfile/makefile
@@ -0,0 +1,26 @@
+
+LIBRARY = libfontfile
+
+INCLUDES += $(MHMAKECONF)\zlib\src\zlib-1.2.3
+
+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;