11 |
|
|
12 |
|
#include "paths.h" |
13 |
|
#include "rtio.h" |
14 |
+ |
#include "rterror.h" |
15 |
|
#include "font.h" |
16 |
|
|
17 |
|
#define galloc(nv) (GLYPH *)malloc(sizeof(GLYPH)+2*sizeof(GORD)*(nv)) |
26 |
|
char *fname |
27 |
|
) |
28 |
|
{ |
29 |
+ |
char embuf[512]; |
30 |
|
FILE *fp; |
31 |
|
char *pathname, *err = NULL; |
32 |
|
unsigned wsum, hsum, ngly; |
42 |
|
} |
43 |
|
/* load the font file */ |
44 |
|
if ((pathname = getpath(fname, getrlibpath(), R_OK)) == NULL) { |
45 |
< |
fprintf(stderr, "cannot find font file \"%s\"\n", fname); |
45 |
> |
sprintf(embuf, "cannot find font file \"%s\"\n", fname); |
46 |
> |
eputs(embuf); |
47 |
|
return(NULL); |
48 |
|
} |
49 |
|
if ((fp = fopen(pathname, "r")) == NULL) { |
50 |
< |
fprintf(stderr, "cannot open font file \"%s\"\n", pathname); |
50 |
> |
sprintf(embuf, "cannot open font file \"%s\"\n", pathname); |
51 |
> |
eputs(embuf); |
52 |
|
return(NULL); |
53 |
|
} |
54 |
|
f = (FONT *)calloc(1, sizeof(FONT)); |
114 |
|
f->next = fontlist; |
115 |
|
return(fontlist = f); |
116 |
|
nonint: |
117 |
< |
fprintf(stderr, "non-integer in font file \"%s\"\n", pathname); |
117 |
> |
sprintf(embuf, "non-integer in font file \"%s\"\n", pathname); |
118 |
> |
eputs(embuf); |
119 |
|
fclose(fp); |
120 |
|
return(NULL); |
121 |
|
fonterr: |
122 |
< |
fprintf(stderr, "%s character (%d) in font file \"%s\"\n", |
122 |
> |
sprintf(embuf, "%s character (%d) in font file \"%s\"\n", |
123 |
|
err, gn, pathname); |
124 |
+ |
eputs(embuf); |
125 |
|
fclose(fp); |
126 |
|
return(NULL); |
127 |
|
memerr: |
128 |
< |
fprintf(stderr, "out of memory in getfont()\n"); |
128 |
> |
eputs("out of memory in getfont()\n"); |
129 |
|
fclose(fp); |
130 |
|
return(NULL); |
131 |
|
} |