aboutsummaryrefslogtreecommitdiff
path: root/libXfont/src/fontfile
diff options
context:
space:
mode:
Diffstat (limited to 'libXfont/src/fontfile')
-rw-r--r--libXfont/src/fontfile/catalogue.c15
-rw-r--r--libXfont/src/fontfile/fontfile.c32
-rw-r--r--libXfont/src/fontfile/makefile33
3 files changed, 76 insertions, 4 deletions
diff --git a/libXfont/src/fontfile/catalogue.c b/libXfont/src/fontfile/catalogue.c
index d49423617..651ebc1a0 100644
--- a/libXfont/src/fontfile/catalogue.c
+++ b/libXfont/src/fontfile/catalogue.c
@@ -30,8 +30,12 @@
#include <X11/fonts/fntfilst.h>
#include <sys/types.h>
#include <sys/stat.h>
+#ifdef _MSC_VER
+#include <direct.h>
+#else
#include <dirent.h>
#include <unistd.h>
+#endif
static const char CataloguePrefix[] = "catalogue:";
@@ -135,19 +139,24 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan)
FontPathElementPtr subfpe;
struct stat statbuf;
const char *path;
+#ifndef _MSC_VER
DIR *dir;
struct dirent *entry;
+#endif
int len;
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))
return Successful;
- dir = opendir(path);
+#ifdef _MSC_VER
+__asm int 3;
+#else
+ dir = opendir(path);
if (dir == NULL)
{
xfree(cat);
@@ -221,7 +230,7 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan)
}
closedir(dir);
-
+#endif
qsort(cat->fpeList,
cat->fpeCount, sizeof cat->fpeList[0], ComparePriority);
diff --git a/libXfont/src/fontfile/fontfile.c b/libXfont/src/fontfile/fontfile.c
index f900f7508..3a0391835 100644
--- a/libXfont/src/fontfile/fontfile.c
+++ b/libXfont/src/fontfile/fontfile.c
@@ -40,7 +40,10 @@ 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>
+#endif
/*
* Map FPE functions to renderer functions
*/
@@ -54,6 +57,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(__UNIXOS2__) || defined(WIN32)
/* OS/2 uses D:/... as a path name for fonts, so accept this as a valid
@@ -66,6 +95,7 @@ FontFileNameCheck (char *name)
#else
return ((strcmp(name, "built-ins") == 0) || (*name == '/'));
#endif
+#endif
}
int
diff --git a/libXfont/src/fontfile/makefile b/libXfont/src/fontfile/makefile
new file mode 100644
index 000000000..019c87802
--- /dev/null
+++ b/libXfont/src/fontfile/makefile
@@ -0,0 +1,33 @@
+#FONTENCDIR=@ENCODINGSDIR@
+#FONTENCDEFS = -DFONT_ENCODINGS_DIRECTORY=\"$(FONTENCDIR)/encodings.dir\"
+
+LIBRARY = libfontfile
+
+INCLUDES += $(MHMAKECONF)\zlib\src\zlib-1.2.3
+
+#DEFINES += XFONT_TYPE1 XFONT_SPEEDO XFONT_BITMAP XFONT_FREETYPE BUILD_SPEEDO BUILD_TYPE1 BUILD_FREETYPE X_GZIP_FONT_COMPRESSION
+DEFINES += X_GZIP_FONT_COMPRESSION
+
+CSRCS = bitsource.c \
+ bufio.c \
+ decompress.c \
+ defaults.c \
+ dirfile.c \
+ ffcheck.c \
+ fileio.c \
+ filewr.c \
+ fontdir.c \
+ fontencc.c \
+ fontfile.c \
+ fontscale.c \
+ gunzip.c \
+ printerfont.c \
+ register.c \
+ renderers.c \
+ catalogue.c
+
+#if X_BZIP2_FONT_COMPRESSION
+#libfontfile_la_SOURCES += bunzip2.c
+#endif
+INCLUDES := ../../../../build $(INCLUDES)
+