| 1 |
#ifndef __TTF_UTIL_H |
| 2 |
#define __TTF_UTIL_H |
| 3 |
|
| 4 |
#include "ttf.h" |
| 5 |
|
| 6 |
/* $Id: ttfutil.h,v 1.2 1998/07/06 06:07:01 werner Exp $ */ |
| 7 |
|
| 8 |
#if !defined(EXIT_FAILURE) |
| 9 |
#define EXIT_FAILURE 1 |
| 10 |
#endif |
| 11 |
|
| 12 |
#if defined __GNUC__ && __GNUC__ >=3 |
| 13 |
__attribute__((__noreturn__)) |
| 14 |
#endif |
| 15 |
void ttfError(const char *msg); |
| 16 |
|
| 17 |
void FixedSplit(Fixed f, int b[]); |
| 18 |
#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) _x1 << 24 | _x2 << 16 | _x3 << 8 | _x4 |
| 19 |
char *TagToStr(ULONG tag); |
| 20 |
|
| 21 |
#ifdef KPATHSEA |
| 22 |
|
| 23 |
#include <stdlib.h> |
| 24 |
#include <kpathsea/lib.h> |
| 25 |
#include <kpathsea/tex-file.h> |
| 26 |
|
| 27 |
static inline FILE * |
| 28 |
fopen_truetype (const char *path) |
| 29 |
{ |
| 30 |
FILE *fp; |
| 31 |
char *p; |
| 32 |
|
| 33 |
if ((p = kpse_find_file (path, kpse_truetype_format, 0)) == NULL) |
| 34 |
return NULL; |
| 35 |
|
| 36 |
fp = fopen (p, "rb"); |
| 37 |
free (p); |
| 38 |
|
| 39 |
return fp; |
| 40 |
} |
| 41 |
|
| 42 |
#else /* !KPATHSEA */ |
| 43 |
|
| 44 |
/* Functions copied or adapted from kpathsea. */ |
| 45 |
void xfseek (FILE *fp, long offset, int wherefrom, const char *funcname); |
| 46 |
long xftell (FILE *fp, const char *funcname); |
| 47 |
void *xmalloc (size_t size); |
| 48 |
void *xcalloc (size_t nelem, size_t elsize); |
| 49 |
char *xstrdup(const char *s); |
| 50 |
|
| 51 |
#define FATAL_PERROR(str) do { perror (str); exit (EXIT_FAILURE); } while (0) |
| 52 |
#define XTALLOC(n, t) ((t *) xmalloc ((n) * sizeof (t))) |
| 53 |
#define XTALLOC1(t) XTALLOC (1, t) |
| 54 |
|
| 55 |
#define fopen_truetype(path) fopen (path, "rb") |
| 56 |
|
| 57 |
#endif /* !KPATHSEA */ |
| 58 |
|
| 59 |
#define XCALLOC(n, t) ((t *) xcalloc (n, sizeof (t))) |
| 60 |
#define XCALLOC1(t) XCALLOC (1, t) |
| 61 |
|
| 62 |
#include "protos.h" |
| 63 |
|
| 64 |
#endif /* __TTF_UTIL_H */ |
| 65 |
|
| 66 |
|
| 67 |
/* end of ttfutil.h */ |