home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / s / stex2-18.zip / SeeTeX / libtex / tfm.h < prev    next >
C/C++ Source or Header  |  1990-07-10  |  3KB  |  85 lines

  1. /*
  2.  * Copyright (c) 1987, 1989 University of Maryland
  3.  * Department of Computer Science.  All rights reserved.
  4.  * Permission to copy for any purpose is hereby granted
  5.  * so long as this copyright notice remains intact.
  6.  */
  7.  
  8. /*
  9.  * TFM file information.
  10.  */
  11.  
  12. /*
  13.  * TFM files start with a series of unsigned 16 bit integers.  We
  14.  * read this into the structure `tfm_header'.  These are type i32
  15.  * so that they may be used as integer quantities without concern
  16.  * as to sign extension.
  17.  */
  18. struct tfmheader {
  19.     i32    th_lf;        /* length of the file (16 bit words) */
  20.     i32    th_lh;        /* length of the header data (words) */
  21.     i32    th_bc;        /* beginning character */
  22.     i32    th_ec;        /* ending character (inclusive) */
  23.     i32    th_nw;        /* number of words in width table */
  24.     i32    th_nh;        /* number of words in height table */
  25.     i32    th_nd;        /* number of words in depth table */
  26.     i32    th_ni;        /* words in italic correction table */
  27.     i32    th_nl;        /* words in ligature/kern table */
  28.     i32    th_nk;        /* words in kern table */
  29.     i32    th_ne;        /* words in extensible character table */
  30.     i32    th_np;        /* number of font parameter words */
  31. };
  32.  
  33. /*
  34.  * The remainder of the TFM file comprises the following information,
  35.  * all of which are 32 bit quantities:
  36.  *
  37.  * header:    array [0..lh-1] of stuff
  38.  * char_info:    array [bc..ec] of char_info_word
  39.  * width:    array [0..nw-1] of fix_word
  40.  * height:    array [0..nh-1] of fix_word
  41.  * depth:    array [0..nd-1] of fix_word
  42.  * italic:    array [0..ni-1] of fix_word
  43.  * lig_kern:    array [0..nl-1] of lig_kern_command
  44.  * kern:    array [0..ne-1] of extensible_recipie
  45.  * param:    array [0..np-1] of fix_word
  46.  */
  47.  
  48. /*
  49.  * A char_info_word is built of four unsigned eight-bit quantities.  The first
  50.  * is an index into the width table (this saves 24 bits for every
  51.  * character that has the same width as another character).  The
  52.  * second is a composite height and depth index.  The third is a
  53.  * composite italic index and tag, and the fourth is a remainder.
  54.  *
  55.  * XXX needs explaining
  56.  */
  57. struct char_info_word {
  58.     char    ci_width;    /* width index */
  59.     char    ci_h_d;        /* height and depth index */
  60.     char    ci_i_t;        /* italic index and tag */
  61.     char    ci_remainder;    /* ??? */
  62. };
  63.  
  64. /*
  65.  * These macros split up h_and_d and i_and_t values.
  66.  */
  67. #define    T_CI_H(ci) (((ci)->ci_h_d >> 4) & 0xf)
  68. #define    T_CI_D(ci) ((ci)->ci_h_d & 0xf)
  69. #define    T_CI_I(ci) (((ci)->ci_i_t >> 2) & 0x3f)
  70. #define    T_CI_T(ci) ((ci)->ci_i_t & 3)
  71.  
  72. /*
  73.  * This structure contains everything one might need to know about
  74.  * a TFM file at run-time.
  75.  *
  76.  * XXX incomplete, or wrong, as yet
  77.  */
  78. struct tfmdata {
  79.     struct    tfmheader t_hdr;    /* full header */
  80.     struct    char_info_word *t_ci;    /* char info */
  81.     i32    *t_width;        /* widths table */
  82.     i32    *t_height;        /* heights */
  83.     i32    *t_depth;        /* depths */
  84. };
  85.