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 */
32 struct glyph glyphs
[NGLYPHS
];
36 int cs
, bd
; /* for .cs and .bd requests */
37 /* glyph list based on the first character of their id fields in glyphs[] */
38 int ghead
[256]; /* glyph list head */
39 int gnext
[NGLYPHS
]; /* next item in glyph list */
40 /* charset section characters */
41 char c
[NGLYPHS
][GNLEN
]; /* character names in charset */
42 struct glyph
*g
[NGLYPHS
]; /* character glyphs in charset */
43 int n
; /* number of characters in charset */
44 /* glyph list based on the first character of glyph names in c[] */
45 int chead
[256]; /* glyph list head */
46 int cnext
[NGLYPHS
]; /* next item in glyph list */
49 /* output device functions */
50 int dev_open(char *dir
, char *dev
);
52 int dev_mnt(int pos
, char *id
, char *name
);
53 struct font
*dev_font(int fn
);
54 int dev_fontid(struct font
*fn
);
55 int charwid(int wid
, int sz
);
56 struct glyph
*dev_glyph(char *c
, int fn
);
58 /* font-related functions */
59 struct font
*font_open(char *path
);
60 void font_close(struct font
*fn
);
61 struct glyph
*font_glyph(struct font
*fn
, char *id
);
62 struct glyph
*font_find(struct font
*fn
, char *name
);
64 /* output functions */
65 void out(char *s
, ...);
69 void outrel(int h
, int v
);
75 extern char o_fonts
[];
78 void drawend(int close
, int fill
);
79 void drawmbeg(char *s
);
80 void drawmend(char *s
);
81 void drawl(int h
, int v
);
83 void drawe(int h
, int v
);
84 void drawa(int h1
, int v1
, int h2
, int v2
);
85 void draws(int h1
, int v1
, int h2
, int v2
);
87 /* postscript functions */
89 void ps_trailer(int pages
, char *fonts
);
90 void ps_pagebeg(int n
);
91 void ps_pageend(int n
);
94 #define CLR_R(c) (((c) >> 16) & 0xff)
95 #define CLR_G(c) (((c) >> 8) & 0xff)
96 #define CLR_B(c) ((c) & 0xff)
97 #define CLR_RGB(r, g, b) (((r) << 16) | ((g) << 8) | (b))
100 int clr_get(char *s
);