/
diskfont.pas
135 lines (96 loc) · 3.04 KB
/
diskfont.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
unit diskfont;
// unit diskfont for morphos
{$UNITPATH ../Trinity/}
{$PACKRECORDS 2}
interface
uses
TriniTypes, Exec, AGraphics;
const
MAXFONTPATH = 256;
type
PFontContents = ^TFontContents;
TFontContents = record
fc_FileName : packed array[0..MAXFONTPATH-1] of char;
fc_YSize : UWORD;
fc_Style : UBYTE;
fc_Flags : UBYTE;
end;
PTFontContents = ^TTFontContents;
TTFontContents = record
tfc_FileName : packed array[0..MAXFONTPATH-3] of char;
tfc_TagCount : UWORD;
tfc_YSize : UWORD;
tfc_Style : UBYTE;
tfc_Flags : UBYTE;
end;
const
FCH_ID = $0f00;
TFCH_ID = $0f02;
OFCH_ID = $0f03;
type
PFontContentsHeader = ^TFontContentsHeader;
TFontContentsHeader = record
fch_FileID : UWORD;
fch_NumEntries : UWORD;
end;
const
DFH_ID = $0f80;
MAXFONTNAME = 32;
type
PDiskFontHeader = ^TDiskFontHeader;
TDiskFontHeader = record
dfh_DF : TNode;
dfh_FileID : UWORD;
dfh_Revision : UWORD;
dfh_Segment : SLONG;
dfh_Name : packed array [0..MAXFONTNAME-1] of char;
dfh_TF : TTextFont;
end;
//const
// dfh_TagList dfh_Segment
const
AFB_MEMORY = 0;
AFF_MEMORY = (1 shl AFB_MEMORY);
AFB_DISK = 1;
AFF_DISK = (1 shl AFB_DISK);
AFB_SCALED = 2;
AFF_SCALED = (1 shl AFB_SCALED);
AFB_BITMAP = 3;
AFF_BITMAP = (1 shl AFB_BITMAP);
AFB_TAGGED = 16;
AFF_TAGGED = (1 shl AFB_TAGGED);
type
PAvailFonts = ^TAvailFonts;
TAvailFonts = record
af_Type : UWORD;
af_Attr : TTextAttr;
end;
PTAvailFonts = ^TTAvailFonts;
TTAvailFonts = record
taf_Type : UWORD;
taf_Attr : TTextAttr;
end;
PAvailFontsHeader = ^TAvailFontsHeader;
TAvailFontsHeader = record
afh_NumEntries: UWORD;
end;
const
DISKFONTNAME : PChar = 'diskfont.library';
var
DiskfontBase : pLibrary;
function OpenDiskFont(textAttr: pTextAttr location 'a0'): pTextFont; syscall DiskfontBase 030;
function AvailFonts(buffer: STRPTR location 'a0'; bufBytes: SLONG location 'd0'; flags: SLONG location 'd1'): SLONG; syscall DiskfontBase 036;
function NewFontContents(fontsLock: BPTR location 'a0'; fontName: STRPTR location 'a1'): pFontContentsHeader; syscall DiskfontBase 042;
procedure DisposeFontContents(fontContentsHeader: pFontContentsHeader location 'a1'); syscall DiskfontBase 048;
function NewScaledDiskFont(sourceFont: pTextFont location 'a0'; destTextAttr: pTextAttr location 'a1'): pDiskFontHeader; syscall DiskfontBase 054;
//*** V45 ***/
function GetDiskFontCtrl(tagid: SLONG location 'd0'): SLONG; syscall DiskfontBase 060;
procedure SetDiskFontCtrlA(taglist: pTagItem location 'a0'); syscall DiskfontBase 066;
// Varargs version
procedure SetDiskFontCtrl(tagArray: array of ULONG);
implementation
procedure SetDiskFontCtrl(tagArray: array of ULONG);
begin
SetDiskFontCtrlA(@tagArray);
end;
end.