(DEFINE-FILE-INFO READTABLE "INTERLISP" PACKAGE "INTERLISP" BASE 10)
(FILECREATED "27-Sep-87 16:13:36" {DSK}<OST>FONTDECLS.;7 10151  

      changes to%:  (VARS FONTDECLSCOMS)

      previous date%: "25-Sep-87 22:24:36" {DSK}<OST>FONTDECLS.;6)


(PRETTYCOMPRINT FONTDECLSCOMS)

(RPAQQ FONTDECLSCOMS ((PROP MAKEFILE-ENVIRONMENT FONTDECLS)
                      (RECORDS FONTDESCRIPTOR CHARSETINFO)
                      (CONSTANTS WORDSPERCELL \MAXCHARSET \MAXTHINCHAR)
                      (MACROS FOLDHI UNFOLD \CREATECSINFOELEMENT \CREATEFONTCHARSETVECTOR 
                             \FGETIMAGEWIDTH \FGETOFFSET \FGETWIDTH \FSETIMAGEWIDTH \FSETOFFSET 
                             \FSETWIDTH \GETCHARSETINFO \SETCHARSETINFO)))

(PUTPROPS FONTDECLS MAKEFILE-ENVIRONMENT (:READTABLE "INTERLISP" :PACKAGE "INTERLISP" :BASE 10))
(DECLARE%: EVAL@COMPILE

(DATATYPE FONTDESCRIPTOR ((FONTDEVICE POINTER)
                          (\SFObsolete1 POINTER)             (* WAS CHARACTERBITMAP)
                                                             (* Bitmap containing the character 
                                                             images, indexed by \SFOffsets)
                          (FONTFAMILY POINTER)
                          (FONTSIZE POINTER)
                          (FONTFACE POINTER)
                          (\SFObsolete2 POINTER)             (* Was \SFWidths)
          
          (* The advance-width of each character, an array indexed by charcode.
          Usually the same as the imagewidth, but can differ for accents, kerns kerns.
          This is what should be used for stringwidth calculations.)

                          (\SFObsolete3 POINTER)             (* WAS \SFOffsets)
          
          (* Offset of each character into the image bitmap;
          X value of left edge)

                          (\SFObsolete4 POINTER)             (* Was \SFWidthsY)
                          (\SFObsolete5 WORD)                (* WAS FIRSTCHAR)
          
          (* Charcode of the first character that exists in the font)

                          (\SFObsolete6 WORD)                (* WAS LASTCHAR)
          
          (* Charcode of the last character that exists in the font)

                          (\SFAscent WORD)
                          (\SFDescent WORD)
                          (\SFHeight WORD)
                          (ROTATION WORD)
                          (FBBOX SIGNEDWORD)
                          (FBBOY SIGNEDWORD)
                          (FBBDX SIGNEDWORD)
                          (FBBDY SIGNEDWORD)
                          (\SFFACECODE BITS 8)
                          (\SFLKerns POINTER)
                          (\SFRWidths POINTER)
                          (FONTDEVICESPEC POINTER)
          
          (* Holds the spec by which the font is known to the printing device, if 
          coercion has been done)

                          (OTHERDEVICEFONTPROPS POINTER)     (* For individual devices to hang 
                                                             special information)
                          (FONTSCALE POINTER)
                          (FONTAVGCHARWIDTH WORD)
          
          (* Set in FONTCREATE, used to fix up the linelength when DSPFONT is called)

                          (FONTIMAGEWIDTHS POINTER)
          
          (* This is the image width, as opposed to the advanced width;
          initial hack for accents, kerning. Fields is referenced by FONTCREATE.)

                          (FONTCHARSETVECTOR POINTER)
          
          (* A 256-pointer block, with one pointer per "character set" --each group of 
          256 character codes. Each pointer is either NIL if there's no info for that 
          charset, or is a CHARSETINFO, containing widths, char bitmap, etc for the 
          characters in that charset.)

                          (FONTEXTRAFIELD2 POINTER))
                         FONTCHARSETVECTOR ← (\CREATEFONTCHARSETVECTOR))

(DATATYPE CHARSETINFO (WIDTHS 
          
          (* The advance-width of each character, an array indexed by charcode.
          Usually the same as the imagewidth, but can differ for accents, kerns kerns.
          This is what should be used for stringwidth calculations.)

                             OFFSETS
          
          (* Offset of each character into the image bitmap;
          X value of left edge)

                             IMAGEWIDTHS
          
          (* imagewidths is not automagically allocated since it is not always needed)

                             CHARSETBITMAP                   (* Bitmap containing the character 
                                                             images, indexed by OFFSETS)
                             YWIDTHS
                             (CHARSETASCENT WORD)            (* Max ascent for all characters in 
                                                             this CHARSET)
                             (CHARSETDESCENT WORD)           (* Max descent for all characters in 
                                                             this CHARSET)
                             )
                      WIDTHS ← (\CREATECSINFOELEMENT)
                      OFFSETS ← (\CREATECSINFOELEMENT))
)
(/DECLAREDATATYPE 'FONTDESCRIPTOR
       '(POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER WORD WORD WORD WORD WORD 
               WORD SIGNEDWORD SIGNEDWORD SIGNEDWORD SIGNEDWORD (BITS 8)
               POINTER POINTER POINTER POINTER POINTER WORD POINTER POINTER POINTER)
       '((FONTDESCRIPTOR 0 POINTER)
         (FONTDESCRIPTOR 2 POINTER)
         (FONTDESCRIPTOR 4 POINTER)
         (FONTDESCRIPTOR 6 POINTER)
         (FONTDESCRIPTOR 8 POINTER)
         (FONTDESCRIPTOR 10 POINTER)
         (FONTDESCRIPTOR 12 POINTER)
         (FONTDESCRIPTOR 14 POINTER)
         (FONTDESCRIPTOR 16 (BITS . 15))
         (FONTDESCRIPTOR 17 (BITS . 15))
         (FONTDESCRIPTOR 18 (BITS . 15))
         (FONTDESCRIPTOR 19 (BITS . 15))
         (FONTDESCRIPTOR 20 (BITS . 15))
         (FONTDESCRIPTOR 21 (BITS . 15))
         (FONTDESCRIPTOR 22 (SIGNEDBITS . 15))
         (FONTDESCRIPTOR 23 (SIGNEDBITS . 15))
         (FONTDESCRIPTOR 24 (SIGNEDBITS . 15))
         (FONTDESCRIPTOR 25 (SIGNEDBITS . 15))
         (FONTDESCRIPTOR 14 (BITS . 7))
         (FONTDESCRIPTOR 26 POINTER)
         (FONTDESCRIPTOR 28 POINTER)
         (FONTDESCRIPTOR 30 POINTER)
         (FONTDESCRIPTOR 32 POINTER)
         (FONTDESCRIPTOR 34 POINTER)
         (FONTDESCRIPTOR 36 (BITS . 15))
         (FONTDESCRIPTOR 38 POINTER)
         (FONTDESCRIPTOR 40 POINTER)
         (FONTDESCRIPTOR 42 POINTER))
       '44)
(/DECLAREDATATYPE 'CHARSETINFO '(POINTER POINTER POINTER POINTER POINTER WORD WORD)
       '((CHARSETINFO 0 POINTER)
         (CHARSETINFO 2 POINTER)
         (CHARSETINFO 4 POINTER)
         (CHARSETINFO 6 POINTER)
         (CHARSETINFO 8 POINTER)
         (CHARSETINFO 10 (BITS . 15))
         (CHARSETINFO 11 (BITS . 15)))
       '12)
(DECLARE%: EVAL@COMPILE 

(RPAQQ WORDSPERCELL 2)

(RPAQQ \MAXCHARSET 255)

(RPAQQ \MAXTHINCHAR 255)

(CONSTANTS WORDSPERCELL \MAXCHARSET \MAXTHINCHAR)
)
(DECLARE%: EVAL@COMPILE 
[PUTPROPS FOLDHI MACRO (X (PROG [(FORM (CAR X))
                                 (DIVISOR (CAR (CONSTANTEXPRESSIONP (CADR X]
                                (OR (AND DIVISOR (POWEROFTWOP DIVISOR))
                                    (\ILLEGAL.ARG (CADR X)))
                                (RETURN (LIST 'LRSH (LIST 'IPLUS FORM (SUB1 DIVISOR))
                                              (SUB1 (INTEGERLENGTH DIVISOR]
[PUTPROPS UNFOLD MACRO (X (PROG [(FORM (CAR X))
                                 (DIVISOR (CAR (CONSTANTEXPRESSIONP (CADR X]
                                (OR (AND DIVISOR (POWEROFTWOP DIVISOR))
                                    (\ILLEGAL.ARG (CADR X)))
                                (RETURN (LIST 'LLSH FORM (SUB1 (INTEGERLENGTH DIVISOR]
[PUTPROPS \CREATECSINFOELEMENT MACRO (NIL (\ALLOCBLOCK (FOLDHI (IPLUS \MAXTHINCHAR 3)
                                                              WORDSPERCELL]
(PUTPROPS \CREATEFONTCHARSETVECTOR MACRO (NIL (* Allocates a block for the character set records)
                                              (\ALLOCBLOCK (ADD1 \MAXCHARSET)
                                                     T)))
(PUTPROPS \FGETIMAGEWIDTH MACRO ((IMAGEWIDTHSBLOCK CHAR8CODE)
                                 (\GETBASE IMAGEWIDTHSBLOCK CHAR8CODE)))
(PUTPROPS \FGETOFFSET DMACRO ((OFFSETSBLOCK CHAR8CODE)
                              (\GETBASE OFFSETSBLOCK CHAR8CODE)))
(PUTPROPS \FGETWIDTH DMACRO ((WIDTHSBLOCK CHAR8CODE)
                             (\GETBASE WIDTHSBLOCK CHAR8CODE)))
(PUTPROPS \FSETIMAGEWIDTH DMACRO ((WIDTHSBLOCK INDEX WIDTH)
                                  (\PUTBASE WIDTHSBLOCK INDEX WIDTH)))
(PUTPROPS \FSETOFFSET DMACRO ((OFFSETSBLOCK CHAR8CODE OFFSET)
                              (\PUTBASE OFFSETSBLOCK CHAR8CODE OFFSET)))
(PUTPROPS \FSETWIDTH DMACRO ((WIDTHSBLOCK INDEX WIDTH)
                             (\PUTBASE WIDTHSBLOCK INDEX WIDTH)))
[PUTPROPS \GETCHARSETINFO MACRO ((CHARSET FONTDESC NOSLUG?)
                                 (* * fetches the charsetinfo for charset CHARSET in fontdescriptor 
                                    FONTDESC. If NIL, then creates the required charset.)
                                 (* * NOSLUG? means don't create an empty (slug)
                                    csinfo if the charset is not found, just return NIL)
                                 (OR (\GETBASEPTR (ffetch FONTCHARSETVECTOR of FONTDESC)
                                            (UNFOLD CHARSET 2))
                                     (\CREATECHARSET CHARSET FONTDESC NOSLUG?]
(PUTPROPS \SETCHARSETINFO MACRO ((CHARSETVECTOR CHARSET CSINFO)
                                 (\RPLPTR CHARSETVECTOR (UNFOLD CHARSET 2)
                                        CSINFO)))
)
(DECLARE%: DONTCOPY
  (FILEMAP (NIL)))
STOP