summaryrefslogtreecommitdiff
path: root/Build/source/texk/ttfdump/include
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2012-07-14 11:29:47 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2012-07-14 11:29:47 +0000
commit84fd53484ac1e0aa8d95b4339861c78e979ad52c (patch)
tree8506e2afadabb0775d8c33534c333db6c12ee83f /Build/source/texk/ttfdump/include
parent5a59d9768db59127880edef385f6a3bb3671436c (diff)
ttfdump: Use libkpathsea instead of copying xmalloc() & Co (from W32TeX)
git-svn-id: svn://tug.org/texlive/trunk@27042 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/ttfdump/include')
-rw-r--r--Build/source/texk/ttfdump/include/ttf.h3
-rw-r--r--Build/source/texk/ttfdump/include/ttfutil.h30
2 files changed, 29 insertions, 4 deletions
diff --git a/Build/source/texk/ttfdump/include/ttf.h b/Build/source/texk/ttfdump/include/ttf.h
index 57fa03ed1a3..6ea1c1746e1 100644
--- a/Build/source/texk/ttfdump/include/ttf.h
+++ b/Build/source/texk/ttfdump/include/ttf.h
@@ -7,9 +7,6 @@
#define __TTF_H
#include <stdio.h>
-#ifndef WIN32
-#include <unistd.h>
-#endif
#include "config.h"
/* $Id: ttf.h,v 1.3 1998/07/06 06:07:01 werner Exp $ */
diff --git a/Build/source/texk/ttfdump/include/ttfutil.h b/Build/source/texk/ttfdump/include/ttfutil.h
index 81a36dc4731..083d4cf3314 100644
--- a/Build/source/texk/ttfdump/include/ttfutil.h
+++ b/Build/source/texk/ttfdump/include/ttfutil.h
@@ -18,6 +18,29 @@ void FixedSplit(Fixed f, int b[]);
#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) _x1 << 24 | _x2 << 16 | _x3 << 8 | _x4
char *TagToStr(ULONG tag);
+#ifdef KPATHSEA
+
+#include <stdlib.h>
+#include <kpathsea/lib.h>
+#include <kpathsea/tex-file.h>
+
+static inline FILE *
+fopen_truetype (const char *path)
+{
+ FILE *fp;
+ char *p;
+
+ if ((p = kpse_find_file (path, kpse_truetype_format, 0)) == NULL)
+ return NULL;
+
+ fp = fopen (p, "rb");
+ free (p);
+
+ return fp;
+}
+
+#else /* !KPATHSEA */
+
/* Functions copied or adapted from kpathsea. */
void xfseek (FILE *fp, long offset, int wherefrom, const char *funcname);
long xftell (FILE *fp, const char *funcname);
@@ -27,8 +50,13 @@ char *xstrdup(const char *s);
#define FATAL_PERROR(str) do { perror (str); exit (EXIT_FAILURE); } while (0)
#define XTALLOC(n, t) ((t *) xmalloc ((n) * sizeof (t)))
-#define XCALLOC(n, t) ((t *) xcalloc (n, sizeof (t)))
#define XTALLOC1(t) XTALLOC (1, t)
+
+#define fopen_truetype(path) fopen (path, "rb")
+
+#endif /* !KPATHSEA */
+
+#define XCALLOC(n, t) ((t *) xcalloc (n, sizeof (t)))
#define XCALLOC1(t) XCALLOC (1, t)
#include "protos.h"