h58165
s 00003/00003/00091
d D 1.4 83/03/02 22:47:49 mjb 4 3
c 
e
s 00001/00001/00093
d D 1.3 83/02/03 15:54:10 mjb 3 2
c fixed common name collision
e
s 00002/00001/00092
d D 1.2 83/01/28 19:17:36 mjb 2 1
c modified for error reporting
e
s 00093/00000/00000
d D 1.1 83/01/20 10:46:21 tes 1 0
c date and time created 83/01/20 10:46:21 by tes
e
u
tes
mjb
U
t
T
I 1
subroutine hshini

SHORTINT filnam(11)
integer sector, offset, temp
integer gdopen, gdseek, gdread

include(`hshcom')

D 4
# file name = hershy.tbl
data filnam /LETH,LETE,LETR,LETS,LETH,LETY,PERIOD,LETT,LETB,LETL,NUL/
E 4
I 4
# file name = graphz.tbl
data filnam /LETG,LETR,LETA,LETP,LETH,LETZ,PERIOD,LETT,LETB,LETL,NUL/
E 4

hfile = -1
D 3
cfont = -1
E 3
I 3
chfont = -1
E 3
if (hfile < 0) {

   vecknt = 0
   hcolor = 1
   hjust = 0
   vjust = 0
   hsize = 2
   vsize = 2
   rotatn = 0

changequote([,])
ifdef([UNIX],
D 4
[ hfile = gdopen ('hershy.tbl', BINARYxREAD) ],
E 4
I 4
[ hfile = gdopen ('graphz.tbl', BINARYxREAD) ],
E 4
[ hfile = gdopen (filnam, BINARYxREAD) ])
changequote(`,')

   if (hfile >= 0) {
      sector = 0
      offset = 0
      temp = gdseek (hfile, sector, offset)
      temp = gdread (hfile, nfonts, 2)

      # the font file is defined as follows:
      #
      #   byte number   item
      #
      #        0        number of fonts in file
      #     1 - 388     font description table for font 0
      #    389- 776     font description table for font 1
      #    ...etc       each font decription is 388 bytes and is defined as
      #                 follows:
      #                    byte number    item
      #                      0 - 3        packed excess 64 integers which
      #                                   contain the scale, base offset,
      #                                   top offset, constant width spacing.
      #                      4 - 131      packed excess 64 integers which 
      #                                   contain the relative width of each
      #                                   character.
      #                     132 - 387     128 integer pointers which provide
      #                                   the relative byte address from the
      #                                   beginning of the character 
      #                                   descriptions table to the description
      #                                   of the requested character.
      #   nfonts*388+1  Character description table. Each character is defined
      #                 as a string of excess 64 relative moves and draws which
      #                 are packed into 16 bit words. An excess move at the end
      #                 of the character definition will put the current
      #                 position in the right place to do the next character.
      #                 A character record is defined as follows:
      #                    [/ 0d / nn /]     [ ] [ ]...[]
      #                       ^    ^              ^
      #                       |    |              |
      #                 constant   number         stroke words
      #                            of stroke
      #                            words
      #                 A stroke word is defined as follows:
      #
      #                    | 1 bit | 1 bit | 7 bits | 7bits  |
      #                    |0=move |   1   |x coord |y coord |
      #                    |1=draw |       |        |        |
      #
      #                 In C this word is built as follows:
      #
      #                    (move_draw<<15)
      #                        + (1<<14) 
      #                        + (((x+64) & 0x7f) << 7)
      #                        + ((y+64) & 0x7f)

      # font description table position
      fdpos = 2 
      #   character description table position
      cdpos = fdpos + (4*nfonts) + (nfonts*128) + (nfonts*128*2)
      }
   else {
D 2
      stop 1111
E 2
I 2
      call chgmod (EXITxGRAPHICSxMODE)
      call errmsg (STOP, OPENxHERSHYxERROR)
E 2
      }
   }

return
end
E 1
