#ifndef lint static char sccsid[] = "@(#)cmpt_fprop.c 9.2 88/01/19 Copyright 1985 Sun Micro"; #endif /* * Copyright (c) 1985 by Sun Microsystems, Inc. */ /*- Compute the properties of a font. cmpt_fprop.c, Fri Feb 21 16:37:52 1986 James Gosling, Sun Microsystems */ #include "font.h" pst_compute_font_properties(f) register struct font *f; { register i; int maxglyph; short llx, lly, urx, ury; short minoy = 9999, minox = 9999; struct fpoint lastwidth; if (f->type == PrinterWidthFont) return; f->left_to_right = 1; f->monotonic = 1; f->narrow = 1; llx = 0; lly = 0; urx = 0; ury = 0; lastwidth.x = 0; lastwidth.y = 0; f->fixed_width = 1; maxglyph = f->nglyphs; if (f->encoding != JISC6226Encoding && maxglyph > 256) maxglyph = 256; for (i = 0; i < maxglyph; i++) { struct wglyph *wp = &f->glyphs[i]; struct glyph *p = wp->glyph; if (lastwidth.x == 0 && lastwidth.y == 0) lastwidth = wp->width; else { if (lastwidth.x != wp->width.x || lastwidth.y != wp->width.y) f->fixed_width = 0; if ((lastwidth.x ^ wp->width.x) < 0 || (lastwidth.y ^ wp->width.y) < 0) f->monotonic = 0; } if (wp->width.y != 0 || wp->width.x < 0) f->left_to_right = 0; if (p == 0) continue; if (p->size.x > 16) f->narrow = 0; if (p->origin.x > llx) llx = p->origin.x; if (p->origin.y > ury) ury = p->origin.y; if (p->origin.y < minoy) minoy = p->origin.y; if (p->origin.x < minox) minox = p->origin.x; if (lly < p->size.y - p->origin.y) lly = p->size.y - p->origin.y; if (urx < p->size.x - p->origin.x) urx = p->size.x - p->origin.x; } f->origin.x = llx; f->origin.y = ury; f->size.x = llx + urx; f->size.y = lly + ury; }