summaryrefslogtreecommitdiff
path: root/Build/source/utils/t1utils/t1utils-1.39/t1lib.h
blob: 93859fea731305f017d4df63b22bdf7d0cf3f75d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef T1LIB_H
#define T1LIB_H
#ifdef __cplusplus
extern "C" {
#endif

#ifdef WIN32
# pragma warning (disable: 4007 4096)
# define CDECL __cdecl
#else
# define CDECL
#endif

#define PFB_MARKER	128
#define PFB_ASCII	1
#define PFB_BINARY	2
#define PFB_DONE	3

struct font_reader {
  void (*output_ascii)(char *, int);
  void (*output_binary)(unsigned char *, int);
  void (*output_end)();
};

void process_pfa(FILE *, const char *filename, struct font_reader *);
void process_pfb(FILE *, const char *filename, struct font_reader *);

struct pfb_writer {
  unsigned char *buf;
  unsigned len;
  unsigned max_len;
  unsigned pos;
  int blocktyp;
  int binary_blocks_written;
  FILE *f;
};

void init_pfb_writer(struct pfb_writer *, int, FILE *);
void pfb_writer_output_block(struct pfb_writer *);
void pfb_writer_grow_buf(struct pfb_writer *);
void pfb_writer_end(struct pfb_writer *);
#define PFB_OUTPUT_BYTE(w, b)	do { \
	if ((w)->pos >= (w)->len) pfb_writer_grow_buf(w); \
	(w)->buf[(w)->pos++] = (b); \
      } while (0)

int crcbuf(int crc, unsigned int len, const char *buf);

/* whoever uses this code must provide a definition for these functions */
extern void error(const char *, ...);
extern void fatal_error(const char *, ...);

#ifdef __cplusplus
}
#endif
#endif