#ifndef lint static char sccsid[] = "@(#)rdbfont.c 9.2 88/01/19 Copyright 1985 Sun Micro"; #endif /* * Copyright (c) 1985 by Sun Microsystems, Inc. */ /*- Read PostScript binary font readbfont.c, Tue Nov 19 16:54:39 1985 James Gosling, Sun Microsystems */ #include #ifdef REF #include #endif #include #include "fract.h" #include "font.h" struct font * unpackbfont(f) register struct font *f; { register i; register struct wglyph *g; static struct glyph EmptyGlyph = { sizeof (struct glyph), 0, 0, 0, 0 }; if (f->name) f->name = f->name + (int) f; if (f->comment) f->comment = f->comment + (int) f; for (i = 0, g = f->glyphs; i < f->nglyphs; i++, g++) if (g->glyph) * (int *) &g->glyph += (int) f; else g->glyph = &EmptyGlyph; return f; } struct font * cst_readbfont(name, prepad) char *name; { register fd = open(name, 0); struct stat st; register struct font *f; if (fd < 0) return 0; if (fstat(fd, &st) < 0) { close(fd); return 0; } f = (struct font *) snoopalloc("rdbfont.c", st.st_size + prepad); read(fd, ((int) f) + prepad, st.st_size); close(fd); unpackbfont(((int) f) + prepad); return f; }