post: support "x X PS"
[neatpost.git] / post.h
blob315133cf9215f356f4509b85e7db98a1b14d7ef2
1 /* predefined array limits */
2 #define PATHLEN 1024 /* path length */
3 #define NFONTS 32 /* number of fonts */
4 #define FNLEN 32 /* font name length */
5 #define NGLYPHS 512 /* glyphs in fonts */
6 #define GNLEN 32 /* glyph name length */
7 #define ILNLEN 1000 /* line limit of input files */
8 #define LNLEN 4000 /* line buffer length (ren.c/out.c) */
10 #define MIN(a, b) ((a) < (b) ? (a) : (b))
11 #define MAX(a, b) ((a) < (b) ? (b) : (a))
12 #define LEN(a) (sizeof(a) / sizeof((a)[0]))
14 /* device related variables */
15 extern int dev_res;
16 extern int dev_uwid;
17 extern int dev_hor;
18 extern int dev_ver;
20 struct glyph {
21 char name[FNLEN]; /* name of the glyph */
22 char id[FNLEN]; /* device-dependent glyph identifier */
23 struct font *font; /* glyph font */
24 int wid; /* character width */
25 int type; /* character type; ascender/descender */
28 struct font {
29 char name[FNLEN];
30 char psname[FNLEN];
31 struct glyph glyphs[NGLYPHS];
32 int nglyphs;
33 int spacewid;
34 int special;
35 char c[NGLYPHS][FNLEN]; /* character names in charset */
36 struct glyph *g[NGLYPHS]; /* character glyphs in charset */
37 int n; /* number of characters in charset */
40 /* output device functions */
41 int dev_open(char *path);
42 void dev_close(void);
43 int dev_mnt(int pos, char *id, char *name);
44 struct font *dev_font(int fn);
45 int dev_fontid(struct font *fn);
46 int charwid(int wid, int sz);
47 struct glyph *dev_glyph(char *c, int fn);
48 struct glyph *dev_glyph_byid(char *id, int fn);
50 /* font-related functions */
51 struct font *font_open(char *path);
52 void font_close(struct font *fn);
53 struct glyph *font_glyph(struct font *fn, char *id);
54 struct glyph *font_find(struct font *fn, char *name);
56 /* output functions */
57 void out(char *s, ...);
58 void outc(char *s);
59 void outh(int h);
60 void outv(int v);
61 void outrel(int h, int v);
62 void outfont(int f);
63 void outsize(int s);
64 void outpage(void);
65 extern char o_fonts[];
67 void drawbeg(char *s);
68 void drawend(char *s);
69 void drawl(int h, int v);
70 void drawc(int c);
71 void drawe(int h, int v);
72 void drawa(int h1, int v1, int h2, int v2);
73 void draws(int h1, int v1, int h2, int v2);
75 /* postscript functions */
76 void ps_header(void);
77 void ps_trailer(int pages, char *fonts);
78 void ps_pagebeg(int n);
79 void ps_pageend(int n);