/* @(#)font.h 9.3 88/01/19 SMI */ /* * Copyright (c) 1984 by Sun Microsystems, Inc. */ /*- Font related declarations font.h, Tue May 7 15:10:19 1985 James Gosling, Sun Microsystems */ /*- The following diagram explains some of the important vectors in the definition of a glyph (0,0) *-----------------+ | | | | | | | | | | | | | | | origin | | *--------------+--->*width[relative to the origin] | | | | | | +-----------------*size A font is written to a file as a font struct followed by all the glyphs. All the pointers are relative to the beginning of the font. When the font is read in or written out the pointers are converted from and to this offset form. The wglyph structure is separate from the glyph structure because we need to be able to build remapped versions of a font that differ only in widths. */ #ifndef FRACT #include "fract.h" #endif #ifndef NEW_FONT_MAGIC enum FontType { LRbitmapFont, /* Bitmap with rows left-to-right */ WidthFont, /* Font with only printer width information */ PrinterWidthFont, /* Scalable width information that applies to * Adobe PostScript printers */ SplineFont, /* Spline outline font */ VectorFont, /* Simple vector font */ }; enum FontEncoding { ASCIIencoding, /* 8 bit western European ASCII */ AdobeEncoding, /* The Adobe version of ASCII */ JISC6226Encoding, /* Japanese Industrial Standard Kanjii */ CyrillicEncoding, HangulEncoding, DevenageriEncoding, AdobeSymbolEncoding, /* An Adobe Symbol font */ }; struct wglyph { /* A glyph with its associated width * information */ struct glyph *glyph; /* The actual glyph */ struct fpoint width; /* The origin-to-origin width. Note that this * is in subpixel coordinates. */ }; struct font { union { int magic; /* Magic number that identifies this font * format */ struct font_opsvector *ops; /* The operation definitions for this * object */ } u; enum FontType type:8; /* The type of representation used for this * font */ enum FontEncoding encoding:8; /* The encoding used for this font * (ASCII, AdobeAscii, Kanjii, Hangul, * Devenageri, Cyrillic...) */ int left_to_right:1;/* true iff for all glyphs, wy==0 && wx>=0 */ int narrow:1; /* true iff for all glyphs, sx<=16 */ int fixed_width:1; /* true iff all glyphs have the same width */ int printermatched:1; /* true iff the widths in this font * have been matched to the widths on * a printer */ int monotonic:1; /* true iff the signs of the x widths match * for all glyphs and the signs of the y * widths match for all glyphs */ struct spoint origin, size; /* The bounding box for all glyphs in the * font. Think of superimposing all the * glyphs so that their origins coincide. */ char *name; /* The stringname for this fonts family */ char *comment; /* Generally the ownership information for the * font */ fract matrix[2][2]; /* a 2x2 matrix describing the scaling and * rotation that define this font */ short nglyphs; /* The number of glyphs in this font */ short pad; /* Pad out to 32 bits for compatibility with * machines that do long word int alignment */ struct wglyph glyphs[1]; /* The array of glyphs that make up this font */ }; struct font_opsvector { /* Operations on a font */ int (*get_rendering_info) (), (*get_stringwidth) (), (*scan_widthlimit) (); }; #define NEW_FONT_MAGIC 0x137A2944 /* The generic header for all glyph objects */ struct glyph { short length; /* The total number of bytes of information in * the glyph */ struct spoint origin, /* The origin position vector */ size; /* The size vector */ /* private stuff follows */ }; struct generic_glyph { struct glyph h; unsigned short bits[1]; }; struct font * cst_readfont( /* name */ ), *cst_readbfont( /* name,prepad */ ); /* * The collected modifiers that may be applied to a piece of text when it is * shown */ struct text_modifiers { struct fpoint cdelta; /* Delta applied to the distinguished * character */ char c; /* The distinguished character */ struct fpoint alldelta; /* Delta applied to all characters */ }; struct rendering_info { /* The information needed to render a glyph */ struct fpoint pos; /* Where it is to be rendered */ struct glyph *g; /* The glyph */ unsigned short *bits; /* The type-specific information */ }; struct rendering_info *get_rendering_info(); extern int rendering_info_length, rendering_info_size; extern struct rendering_info *rendering_info; #endif