1 {
2     This file is part of the Free Pascal run time library.
3     Copyright (c) 2014 by Free Pascal development team
4 
5     diskfont.library functions
6 
7     See the file COPYING.FPC, included in this distribution,
8     for details about the copyright.
9 
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 
14  **********************************************************************}
15 
16 unit diskfont;
17 
18 interface
19 
20 uses exec, agraphics,utility;
21 
22 const
23   MAXFONTPATH = 256;
24 
25 type
26   PFontContents = ^TFontContents;
27   TFontContents = record
28     fc_FileName: array[0..MAXFONTPATH - 1] of Char;
29     fc_YSize: Word;
30     fc_Style: Byte;
31     fc_Flags: Byte;
32   end;
33 
34   PTFontContents = ^TTFontContents;
35   TTFontContents = record
36     tfc_FileName: array[0..MAXFONTPATH - 3] of Char;
37     tfc_TagCount: Word;
38     tfc_YSize: Word;
39     tfc_Style,
40     tfc_Flags: Byte;
41    end;
42 
43 const
44   FCH_ID   = $0f00;
45   TFCH_ID  = $0f02;
46   OFCH_ID  = $0f03;
47 
48 type
49   PFontContentsHeader = ^TFontContentsHeader;
50   TFontContentsHeader = record
51     fch_FileID: Word;
52     fch_NumEntries: Word;
53   end;
54 
55 const
56   DFH_ID = $0f80;
57   MAXFONTNAME = 32;
58 
59 type
60   PDiskFontHeader = ^TDiskFontHeader;
61   TDiskFontHeader = record
62     dfh_DF: TNode;
63     dfh_FileID: Word;
64     dfh_Revision: Word;
65     dfh_Segment: Longint;
66     dfh_Name: array [0..MAXFONTNAME-1] of Char;
67     dfh_TF: TTextFont;
68   end;
69 
70 const
71   AFB_MEMORY          = 0;
72   AFF_MEMORY          = 1;
73   AFB_DISK            = 1;
74   AFF_DISK            = 2;
75   AFB_SCALED          = 2;
76   AFF_SCALED          = $0004;
77   AFB_BITMAP          = 3;
78   AFF_BITMAP          = $0008;
79   AFB_TAGGED          = 16;
80   AFF_TAGGED          = $10000;
81 
82 type
83   PAvailFonts = ^TAvailFonts;
84   TAvailFonts = record
85     af_Type: Word;
86     af_Attr: TTextAttr;
87   end;
88 
89   PTAvailFonts = ^TTAvailFonts;
90   TTAvailFonts = record
91     taf_Type: Word;
92     taf_Attr: TTTextAttr;
93   end;
94 
95   PAvailFontsHeader = ^TAvailFontsHeader;
96   TAvailFontsHeader = record
97     afh_NumEntries: Word;
98   end;
99 
100 const
101   DISKFONTNAME: PChar = 'diskfont.library';
102 
103 var
104   DiskfontBase: PLibrary;
105 
AvailFontsnull106 function AvailFonts(Buffer: PChar; BufBytes: LongInt; Flags: LongInt): LongInt; syscall DiskfontBase 6;
107 procedure DisposeFontContents(FontContentsHeader: PFontContentsHeader); syscall DiskfontBase 8;
NewFontContentsnull108 function NewFontContents(FontsLock: BPTR; FontName: PChar): PFontContentsHeader; syscall DiskfontBase 7;
NewScaledDiskFontnull109 function NewScaledDiskFont(SourceFont: PTextFont; DestTextAttr: PTextAttr): PDiskFontHeader; syscall DiskfontBase 9;
OpenDiskFontnull110 function OpenDiskFont(TextAttr: PTextAttr): PTextFont; syscall DiskfontBase 5;
GetDiskFontCtrlnull111 //function GetDiskFontCtrl(tagid: LongInt): LongInt;
112 //procedure SetDiskFontCtrlA(taglist: PTagItem);
113 
114 implementation
115 
116 initialization
117   DiskfontBase := OpenLibrary(DISKFONTNAME, 36);
118 finalization
119   CloseLibrary(DiskfontBase);
120 end.
121 
122 
123 
124