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 */
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
);
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
, ...);
51 void outrel(int h
, int v
);
55 void outrotate(int deg
);
56 void outeps(char *eps
);
59 extern char o_fonts
[];
62 void drawend(int close
, int fill
);
63 void drawmbeg(char *s
);
64 void drawmend(char *s
);
65 void drawl(int h
, int v
);
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
);
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))