Annotation of researchv10no/cmd/post.src/dpost.utf/font.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  *
                      3:  * Characteristics of a font - for postprocessors. Most changes are for
                      4:  * Unicode and Plan 9 UTF encoding. Also tried to anticipate larger and
                      5:  * more general Unicode fonts.
                      6:  * 
                      7:  */
                      8: 
                      9: #define FIRSTCODE      0x0020
                     10: #define LASTCODE       0x8BFF
                     11: #define FIRSTSPECIAL   0xE800
                     12: #define LASTSPECIAL    0xFDFF
                     13: 
                     14: #define INVALIDCODE    0x0000
                     15: #define LARGESTFONT    0x1000
                     16: #define MAXFONTS       99
                     17: #define        SPECIALCHARS    (LASTSPECIAL-FIRSTSPECIAL+1)
                     18: 
                     19: #define ValidCode(c)   ((c) >= FIRSTCODE && (c) <= LASTCODE)
                     20: #define ValidSpecial(c)        ((c) >= FIRSTSPECIAL && (c) <= LASTSPECIAL)
                     21: #define ValidChar(c)   (ValidCode(c) || ValidSpecial(c))
                     22: 
                     23: /*
                     24:  *
                     25:  * State of a table entry in fonts[].
                     26:  *
                     27:  */
                     28: 
                     29: #define NEWFONT                0
                     30: #define RELEASED       1
                     31: #define INMEMORY       2
                     32: 
                     33: /*
                     34:  *
                     35:  * Flags - for setting bits in a font's flag field.
                     36:  *
                     37:  */
                     38: 
                     39: #define USED           1
                     40: #define NAMED          2
                     41: 
                     42: #define skipline(f)    while ( getc(f) != '\n' )
                     43: 
                     44: /*
                     45:  *
                     46:  * Data about each character on a font. Omitted the ascender/descender field.
                     47:  * Need 16 bits for num field to support Unicode character set. Use the same
                     48:  * for code field which may be translated to Plan 9's UTF represenation on
                     49:  * output. A string for code field might be worth a try? Needs considerable
                     50:  * thought!!
                     51:  *
                     52:  */
                     53: 
                     54: typedef struct {
                     55:        unsigned short  num;            /* INVALIDCODE means not on this font */
                     56:        unsigned char   wid;            /* width */
                     57:        unsigned short  code;           /* code for actual device. */
                     58: } Chwid;
                     59: 
                     60: /*
                     61:  *
                     62:  * Font header - one for each available position. first and last fields
                     63:  * are an attempt to anticipate support for Unicode fonts. Characters
                     64:  * from first through last are described by the initial last-first+1
                     65:  * entries in wp. Entries in wp having num == INVALIDCODE are unassigned
                     66:  * in the font. The remaining nchars-(last-first+1) wp entries support
                     67:  * troff's traditional two character escapes. Special characters are
                     68:  * hashed and assigned codes from Unicode's Private Use Area.
                     69:  *
                     70:  */
                     71: 
                     72: typedef struct {
                     73:        char            *path;          /* where it came from */
                     74:        char            *name;          /* as known to troff */
                     75:        char            *fontname;      /* real name (e.g. Times-Roman) */
                     76:        char            state;          /* NEWFONT, RELEASED, or INMEMORY */
                     77:        char            flags;          /* for now just USED and NAMED */
                     78:        char            mounted;        /* mounted on this many positions */
                     79:        char            specfont;       /* 1 == special font */
                     80:        unsigned short  first;          /* first wp entry is for this character */
                     81:        unsigned short  last;           /* last code for this font */
                     82:        unsigned short  nchars;         /* size of width table for this font */
                     83:        Chwid           *wp;            /* widths, etc., of the real characters */
                     84: } Font;
                     85: 
                     86: /*
                     87:  *
                     88:  * Non-integer functions.
                     89:  *
                     90:  */
                     91: 
                     92: extern char    *chname();
                     93: extern char    *strsave();
                     94: extern char    *allocate();
                     95: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.