commit - 85bfd19a7beb628f24b051d23e6c94ecc6e4babc
commit + 1fcdefc5854ff5708ad545eb047075838eda55ff
blob - 54cd52a8b7ef5b6a556a23b7c066a6ae2c46c9b9
blob + fd629801aa1ec893625d67e30ddcd3f6ed5afd04
--- src/cmd/fontsrv/main.c
+++ src/cmd/fontsrv/main.c
Fmt fmt;
XFont *f;
char *data;
+ char *buf;
Memsubfont *sf;
Memimage *m;
readstr(r, "font missing\n");
break;
}
+ height = 0;
+ ascent = 0;
+ if(f->unit > 0) {
+ height = f->height * (int)QSIZE(path)/f->unit + 0.99999999;
+ ascent = height - (int)(-f->originy * (int)QSIZE(path)/f->unit + 0.99999999);
+ }
+ if(f->loadheight != nil)
+ f->loadheight(f, QSIZE(path), &height, &ascent);
+ fmtprint(&fmt, "%11d %11d\n", height, ascent);
if(f->fonttext == nil) {
- height = 0;
- ascent = 0;
- if(f->unit > 0) {
- height = f->height * (int)QSIZE(path)/f->unit + 0.99999999;
- ascent = height - (int)(-f->originy * (int)QSIZE(path)/f->unit + 0.99999999);
- }
- if(f->loadheight != nil)
- f->loadheight(f, QSIZE(path), &height, &ascent);
- fmtprint(&fmt, "%11d %11d\n", height, ascent);
for(i=0; i<f->nfile; i++)
fmtprint(&fmt, "0x%06x 0x%06x x%06x.bit\n", f->file[i]*SubfontSize, ((f->file[i]+1)*SubfontSize) - 1, f->file[i]*SubfontSize);
f->fonttext = fmtstrflush(&fmt);
f->nfonttext = strlen(f->fonttext);
+ } else {
+ buf = fmtstrflush(&fmt);
+ strncpy(f->fonttext, buf, strlen(buf)); // Do not copy the null byte.
+ free(buf);
}
readbuf(r, f->fonttext, f->nfonttext);
break;