out: ignore invalid font requests
[neatpost.git] / post.h
blob8b23789799c1d3a0d1f01968d3c3d8ae3c2154c5
1 /* predefined array limits */
2 #define PATHLEN 1024 /* path length */
3 #define NFONTS 32 /* number of fonts */
4 #define NGLYPHS 1024 /* glyphs in fonts */
5 #define FNLEN 64 /* font name length */
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 id[GNLEN]; /* device-dependent glyph identifier */
22 char name[GNLEN]; /* the first character mapped to this glyph */
23 struct font *font; /* glyph font */
24 int wid; /* character width */
25 int type; /* character type; ascender/descender */
26 int pos; /* glyph code */
29 /* output device functions */
30 int dev_open(char *dir, char *dev);
31 void dev_close(void);
32 int dev_mnt(int pos, char *id, char *name);
33 struct font *dev_font(int fn);
34 int dev_fontid(struct font *fn);
35 struct glyph *dev_glyph(char *c, int fn);
37 /* font-related functions */
38 struct font *font_open(char *path);
39 void font_close(struct font *fn);
40 struct glyph *font_glyph(struct font *fn, char *id);
41 struct glyph *font_find(struct font *fn, char *name);
42 int font_wid(struct font *fn, int sz, int w);
43 int font_swid(struct font *fn, int sz);
44 char *font_name(struct font *fn);
46 /* output functions */
47 void out(char *s, ...);
48 void outc(char *s);
49 void outh(int h);
50 void outv(int v);
51 void outrel(int h, int v);
52 void outfont(int f);
53 void outsize(int s);
54 void outcolor(int c);
55 void outrotate(int deg);
56 void outeps(char *eps);
57 void outpage(void);
58 void outmnt(int f);
59 extern char o_fonts[];
61 void drawbeg(void);
62 void drawend(int close, int fill);
63 void drawmbeg(char *s);
64 void drawmend(char *s);
65 void drawl(int h, int v);
66 void drawc(int c);
67 void drawe(int h, int v);
68 void drawa(int h1, int v1, int h2, int v2);
69 void draws(int h1, int v1, int h2, int v2);
71 /* postscript functions */
72 void ps_header(int pagewidth, int pageheight, int linewidth);
73 void ps_trailer(int pages, char *fonts);
74 void ps_pagebeg(int n);
75 void ps_pageend(int n);
77 /* colors */
78 #define CLR_R(c) (((c) >> 16) & 0xff)
79 #define CLR_G(c) (((c) >> 8) & 0xff)
80 #define CLR_B(c) ((c) & 0xff)
81 #define CLR_RGB(r, g, b) (((r) << 16) | ((g) << 8) | (b))
83 char *clr_str(int c);
84 int clr_get(char *s);