home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / M2V11-1.LHA / modula / amiga / DiskFont.def < prev    next >
Encoding:
Text File  |  1993-11-10  |  4.2 KB  |  133 lines

  1. DEFINITION FOR LIBRARY MODULE DiskFont ;
  2.  
  3. FROM SYSTEM    IMPORT BADDRESS, ADDRESS, SHORTSET, STRING, LONGSET ;
  4. FROM Exec    IMPORT Node, LibraryPtr ;
  5. FROM Graphics    IMPORT TextAttr, TextAttrPtr, TextFont, TTextAttr, TextFontPtr ;
  6. FROM Dos    IMPORT FileLockPtr ;
  7. FROM Utility    IMPORT TagItemPtr ;
  8.  
  9. (* diskfont library definitions *)
  10.  
  11. TYPE
  12.   FontContentsPtr    = POINTER TO FontContents    ;
  13.   TFontContentsPtr    = POINTER TO TFontContents    ;
  14.   FontContentsHeaderPtr    = POINTER TO FontContentsHeader ;
  15.   DiskFontHeaderPtr    = POINTER TO DiskFontHeader    ;
  16.   AvailFontsPtr        = POINTER TO AvailFontsRec    ;
  17.   TAvailFontsPtr    = POINTER TO TAvailFonts    ;
  18.   AvailFontsHeaderPtr    = POINTER TO AvailFontsHeader    ;
  19.  
  20. CONST
  21.   MAXFONTPATH = 256 ;   (* including null terminator *)
  22.  
  23. TYPE
  24.   FontContents = RECORD
  25.     fc_FileName : ARRAY [0..MAXFONTPATH-1] OF CHAR ;
  26.     fc_YSize    : CARDINAL ;
  27.     fc_Style    : SHORTSET ;
  28.     fc_Flags    : SHORTSET ;
  29.   END ;
  30.  
  31.   TFontContents = RECORD
  32.     tfc_FileName : ARRAY [0..MAXFONTPATH-3] OF CHAR ;
  33.     tfc_TagCount : CARDINAL ;    (* including the TAG_DONE tag *)
  34.  
  35.      (*    if tfc_TagCount is non-zero, tfc_FileName is overlayed with   *)
  36.      (*    Text Tags starting at:    TagItemPtr                  *)
  37.      (*      ADR(tfc_FileName[MAXFONTPATH-(tfc_TagCount*SIZE(TagItem))]) *)
  38.  
  39.     tfc_YSize : CARDINAL ;
  40.     tfc_Style : SHORTSET ;
  41.     tfc_Flags : SHORTSET ;
  42.   END ;
  43.  
  44. CONST
  45.   FCH_ID  = 00F00H ; (* FontContentsHeader, then FontContents   *)
  46.   TFCH_ID = 00F02H ; (* FontContentsHeader, then TFontContents  *)
  47.   OFCH_ID = 00F03H ; (* FontContentsHeader, then TFontContents, *)
  48.              (* associated with outline font        *)
  49.  
  50. TYPE
  51.   FontContentsHeader = RECORD
  52.     fch_FileID       : CARDINAL ;    (* FCH_ID                *)
  53.     fch_NumEntries : CARDINAL ;    (* the number of FontContents elements    *)
  54.     (* struct FontContents fch_FC[], or struct TFontContents fch_TFC[]; *)
  55.   END ;
  56.  
  57. CONST
  58.    DFH_ID    = 00F80H ;
  59.    MAXFONTNAME    = 32 ;    (* font name including ".font\0" *)
  60.  
  61. TYPE
  62.   DiskFontHeader = RECORD
  63.     (* the following 8 bytes are not actually considered a part of the    *)
  64.     (* DiskFontHeader, but immediately preceed it. The NextSegment is    *)
  65.     (* supplied by the linker/loader, and the ReturnCode is the code    *)
  66.     (* at the beginning of the font in case someone runs it...        *)
  67.     (*     ULONG dfh_NextSegment;            \* actually a BPTR    *)
  68.     (*     ULONG dfh_ReturnCode;            \* MOVEQ #0,D0 : RTS    *)
  69.     (* here then is the official start of the DiskFontHeader...        *)
  70.  
  71.     dfh_DF       : Node ;    (* node to link disk fonts       *)
  72.     dfh_FileID   : CARDINAL ;    (* DFH_ID               *)
  73.     dfh_Revision : CARDINAL ;    (* the font revision           *)
  74.  
  75.     CASE :LONGINT OF
  76.     |0 :dfh_Segment : BADDRESS ;    (* the segment address when loaded *)
  77.     |1 :dfh_TagList : TagItemPtr ;     (* destroyed during loading       *)
  78.                         (* used only if dfh_TF.tf_Style    *)
  79.                         (* FSB_TAGGED bit is set       *)
  80.     END ;
  81.     dfh_Name : ARRAY [0..MAXFONTNAME-1] OF CHAR ;
  82.                     (* the font name (null terminated) *)
  83.     dfh_TF    : TextFont ;    (* loaded TextFont structure       *)
  84.   END ;
  85.  
  86. CONST
  87.   AFB_MEMORY    =  0 ; AFF_MEMORY = {0} ;
  88.   AFB_DISK    =  1 ; AFF_DISK      = {1} ;
  89.   AFB_SCALED    =  2 ; AFF_SCALED = {2} ;
  90.   AFB_BITMAP    =  3 ; AFF_BITMAP = {3} ;
  91.  
  92.   AFB_TAGGED    = 16 ; AFF_TAGGED = {16}; (* return TAvailFonts *)
  93.  
  94.  
  95. TYPE
  96.   AvailFontsRec = RECORD
  97.     af_Type : BITSET   ;    (* MEMORY, DISK, or SCALED  *)
  98.     af_Attr : TextAttr ;    (* text attributes for font *)
  99.   END ;
  100.  
  101.   TAvailFonts = RECORD
  102.     taf_Type : BITSET  ;    (* MEMORY, DISK, or SCALED  *)
  103.     taf_Attr : TTextAttr ;    (* text attributes for font *)
  104.   END ;
  105.  
  106.   AvailFontsHeader = RECORD
  107.     afh_NumEntries : CARDINAL ;    (* number of AvailFonts elements *)
  108.     (* struct AvailFonts afh_AF[], or struct TAvailFonts afh_TAF[]; *)
  109.   END ;
  110.  
  111. VAR
  112.   DiskfontBase : LibraryPtr ;
  113.  
  114. PROCEDURE OpenDiskFont( textAttr : TextAttrPtr ) : TextFontPtr ;
  115.  
  116. PROCEDURE AvailFonts( buffer   : STRING ;
  117.               bufBytes : LONGINT ;
  118.               flags    : LONGSET ) : LONGINT ;
  119.  
  120. (*--- functions in V34 or higher (Release 1.3) ---*)
  121.  
  122. PROCEDURE NewFontContents( fontsLock : FileLockPtr ;
  123.                fontName  : STRING ) : FontContentsHeaderPtr ;
  124.  
  125. PROCEDURE DisposeFontContents( fontContentsHeader : FontContentsHeaderPtr ) ;
  126.  
  127. (*--- functions in V36 or higher (Release 2.0) ---*)
  128.  
  129. PROCEDURE NewScaledDiskFont( sourceFont   : TextFontPtr ;
  130.                  destTextAttr : TextFontPtr ) : DiskFontHeaderPtr ;
  131.  
  132. END DiskFont.
  133.