home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Pascal / HISOFTPASCAL2,0-3.DMS / in.adf / Units / Diskfont.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-05-20  |  4.0 KB  |  220 lines

  1. unit Diskfont;
  2.  
  3. INTERFACE
  4. uses Exec, AmigaDOS, Graphics, Utility;
  5.  
  6.  
  7. type
  8.     pAvailFonts = ^tAvailFonts;
  9.     tAvailFonts = record
  10.         af_Type: word;
  11.         af_Attr: tTextAttr;
  12.         end;
  13.  
  14.     pFontContentsHeader = ^tFontContentsHeader;
  15.     tFontContentsHeader = record
  16.         fch_FileID: word;
  17.         fch_NumEntries: word;
  18.         end;
  19.  
  20.     pTFontContents = ^tTFontContents;
  21.     tTFontContents = record
  22.         tfc_FileName: array [0..253] of byte;
  23.         tfc_TagCount: word;
  24.         tfc_YSize: word;
  25.         tfc_Style: byte;
  26.         tfc_Flags: byte;
  27.         end;
  28.  
  29.     pFontContents = ^tFontContents;
  30.     tFontContents = record
  31.         fc_FileName: array [0..255] of byte;
  32.         fc_YSize: word;
  33.         fc_Style: byte;
  34.         fc_Flags: byte;
  35.         end;
  36.  
  37.     pDiskFontHeader = ^tDiskFontHeader;
  38.     tDiskFontHeader = record
  39.         dfh_DF: tNode;
  40.         dfh_FileID: word;
  41.         dfh_Revision: word;
  42.         case integer of
  43.         0: (
  44.         dfh_TagList: tTagItem;
  45.         );
  46.         1: (
  47.         dfh_Segment: longint;
  48.         dfh_Name: array [0..31] of byte;
  49.         dfh_TF: tTextFont;
  50.         );
  51.         end;
  52.  
  53.     pAvailFontsHeader = ^tAvailFontsHeader;
  54.     tAvailFontsHeader = record
  55.         afh_NumEntries: word;
  56.         end;
  57.  
  58.     pTAvailFonts = ^tTAvailFonts;
  59.     tTAvailFonts = record
  60.         taf_Type: word;
  61.         taf_Attr: tTTextAttr;
  62.         end;
  63.  
  64.  
  65.  
  66. var
  67.     DiskfontBase: pLibrary;
  68.  
  69.  
  70. const
  71.     OT_Level0 = $80000000;
  72.     OT_BName = $8000A005;
  73.     OT_Level1 = $80001000;
  74.     OT_Level2 = $80002000;
  75.     OT_Level3 = $80003000;
  76.     OT_IName = $8000A006;
  77.     OTS_Black = $D8;
  78.     OTS_SemiBold = $98;
  79.     OTS_DemiLight = $58;
  80.     AFB_SCALED = 2;
  81.     AFB_TAGGED = $10;
  82.     OTS_Bold = $B8;
  83.     AFF_SCALED = 4;
  84.     AFF_TAGGED = $10000;
  85.     OTS_ExtraBlack = $E8;
  86.     OTS_LeftItalic = 2;
  87.     MAXFONTNAME = $20;
  88.     OTH_SemiExpanded = $B0;
  89.     TFCH_ID = $F02;
  90.     OTS_UltraBlack = $F8;
  91.     OTSUFFIX = '.otag';
  92.     OTH_Expanded = $D0;
  93.     OTS_Book = $78;
  94.     OT_SerifFlag = $80001014;
  95.     OTS_ExtraBold = $C8;
  96.     OTS_Italic = 1;
  97.     OT_FileIdent = $80001001;
  98.     OTS_SemiLight = $68;
  99.     OT_IsFixed = $80002013;
  100.     OTH_Condensed = $70;
  101.     MAXFONTPATH = $100;
  102.     OTE_Bullet = 'bullet';
  103.     OTS_Thin = $28;
  104.     OTS_Light = $48;
  105.     OTH_Normal = $90;
  106.     OTH_ExtraExpanded = $F0;
  107.     OT_MAXAVAILSIZES = $14;
  108.     FCH_ID = $F00;
  109.     OTS_Medium = $88;
  110.     DFH_ID = $F80;
  111.     OT_SpaceFactor = $80002018;
  112.     OT_Spec = $80001100;
  113.     OT_Engine = $80009002;
  114.     OTS_ExtraThin = $18;
  115.     OTS_ExtraLight = $38;
  116.     OT_SpaceWidth = $80002012;
  117.     OT_YSizeFactor = $80001011;
  118.     OTS_UltraThin = 8;
  119.     OT_DotSize = $80000002;
  120.     OT_Family = $80009003;
  121.     OT_DeviceDPI = $80000001;
  122.     AFB_MEMORY = 0;
  123.     OTH_Compressed = $50;
  124.     OT_SpecCount = $80001100;
  125.     OT_AvailSizes = $80009020;
  126.     AFF_MEMORY = 1;
  127.     OT_Indirect = $8000;
  128.     OT_InhibitAlgoStyle = $80002019;
  129.     OT_PointHeight = $80000008;
  130.     OTS_Upright = 0;
  131.     OT_StemWeight = $80001015;
  132.     OTH_ExtraCompressed = $30;
  133.     OT_BIName = $8000A007;
  134.     OT_SymbolSet = $80001010;
  135.     OTH_UltraCompressed = $10;
  136.     OT_PointSize = $80000010;
  137.     OT_SlantStyle = $80001016;
  138.     AFB_DISK = 1;
  139.     AFF_DISK = 2;
  140.     OT_Spec1 = $80001101;
  141.     OTS_DemiBold = $A8;
  142.     OT_HorizStyle = $80001017;
  143.  
  144.  
  145. function OpenDiskFont (textAttr: pTextAttr): pTextFont;
  146. function AvailFonts
  147.         (buffer: pAvailFontsHeader;
  148.         bufBytes: longint;
  149.         flags: long): longint;
  150.  
  151. function NewFontContents
  152.         (fontsLock: BPTR;
  153.         fontName: STRPTR): pFontContentsHeader;
  154.  
  155. procedure DisposeFontContents (fontContentsHeader: pFontContentsHeader);
  156. function NewScaledDiskFont
  157.         (sourceFont: pTextFont;
  158.         destTextAttr: pTTextAttr): pDiskFontHeader;
  159.  
  160.  
  161.  
  162. IMPLEMENTATION
  163. function OpenDiskFont; xassembler;
  164. asm
  165.     move.l    a6,-(sp)
  166.     move.l    8(sp),a0
  167.     move.l    DiskfontBase,a6
  168.     jsr        -$1E(a6)
  169.     move.l    d0,$C(sp)
  170.     move.l    (sp)+,a6
  171. end;
  172.  
  173. function AvailFonts; xassembler;
  174. asm
  175.     move.l    a6,-(sp)
  176.     lea        8(sp),a6
  177.     move.l    (a6)+,d1
  178.     move.l    (a6)+,d0
  179.     move.l    (a6)+,a0
  180.     move.l    DiskfontBase,a6
  181.     jsr        -$24(a6)
  182.     move.l    d0,$14(sp)
  183.     move.l    (sp)+,a6
  184. end;
  185.  
  186. function NewFontContents; xassembler;
  187. asm
  188.     move.l    a6,-(sp)
  189.     lea        8(sp),a6
  190.     move.l    (a6)+,a1
  191.     move.l    (a6)+,a0
  192.     move.l    DiskfontBase,a6
  193.     jsr        -$2A(a6)
  194.     move.l    d0,$10(sp)
  195.     move.l    (sp)+,a6
  196. end;
  197.  
  198. procedure DisposeFontContents; xassembler;
  199. asm
  200.     move.l    a6,-(sp)
  201.     move.l    8(sp),a1
  202.     move.l    DiskfontBase,a6
  203.     jsr        -$30(a6)
  204.     move.l    (sp)+,a6
  205. end;
  206.  
  207. function NewScaledDiskFont; xassembler;
  208. asm
  209.     move.l    a6,-(sp)
  210.     lea        8(sp),a6
  211.     move.l    (a6)+,a1
  212.     move.l    (a6)+,a0
  213.     move.l    DiskfontBase,a6
  214.     jsr        -$36(a6)
  215.     move.l    d0,$10(sp)
  216.     move.l    (sp)+,a6
  217. end;
  218.  
  219. end.
  220.