2
This file is part of the Free Pascal run time library.
4
A file in Amiga system run time library.
5
Copyright (c) 1998-2003 by Nils Sjoholm
6
member of the Amiga RTL development team.
8
See the file COPYING.FPC, included in this distribution,
9
for details about the copyright.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
**********************************************************************}
19
Added the defines use_amiga_smartlink and
20
use_auto_openlib. Implemented autoopening
24
Update for AmigaOS 3.9.
25
FUNCTION GetDiskFontCtrl
26
PROCEDURE SetDiskFontCtrlA
27
Varargs for SetDiskFontCtrl is in
29
Changed startup for library.
32
Changed cardinal > longword.
35
nils.sjoholm@mailbox.swipnet.se Nils Sjoholm
38
{$I useamigasmartlink.inc}
39
{$ifdef use_amiga_smartlink}
41
{$endif use_amiga_smartlink}
47
uses exec, graphics,utility;
55
pFontContents = ^tFontContents;
56
tFontContents = record
57
fc_FileName : Array [0..MAXFONTPATH-1] of Char;
64
pTFontContents = ^tTFontContents;
65
tTFontContents = record
66
tfc_FileName : Array[0..MAXFONTPATH-3] of Char;
85
pFontContentsHeader = ^tFontContentsHeader;
86
tFontContentsHeader = record
88
fch_NumEntries : Word;
98
pDiskFontHeader = ^tDiskFontHeader;
99
tDiskFontHeader = record
103
dfh_Segment : Longint;
104
dfh_Name : Array [0..MAXFONTNAME-1] of Char;
124
pAvailFonts = ^tAvailFonts;
130
pTAvailFonts = ^tTAvailFonts;
131
tTAvailFonts = record
133
taf_Attr : tTTextAttr;
136
pAvailFontsHeader = ^tAvailFontsHeader;
137
tAvailFontsHeader = record
138
afh_NumEntries : Word;
142
DISKFONTNAME : PChar = 'diskfont.library';
144
VAR DiskfontBase : pLibrary;
146
FUNCTION AvailFonts(buffer : pCHAR; bufBytes : LONGINT; flags : LONGINT) : LONGINT;
147
PROCEDURE DisposeFontContents(fontContentsHeader : pFontContentsHeader);
148
FUNCTION NewFontContents(fontsLock : BPTR; fontName : pCHAR) : pFontContentsHeader;
149
FUNCTION NewScaledDiskFont(sourceFont : pTextFont; destTextAttr : pTextAttr) : pDiskFontHeader;
150
FUNCTION OpenDiskFont(textAttr : pTextAttr) : pTextFont;
151
FUNCTION GetDiskFontCtrl(tagid : LONGINT) : LONGINT;
152
PROCEDURE SetDiskFontCtrlA(taglist : pTagItem);
154
{Here we read how to compile this unit}
155
{You can remove this include and use a define instead}
156
{$I useautoopenlib.inc}
157
{$ifdef use_init_openlib}
158
procedure InitDISKFONTLibrary;
159
{$endif use_init_openlib}
161
{This is a variable that knows how the unit is compiled}
163
DISKFONTIsCompiledHow : longint;
168
If you don't use array of const then just remove tagsarray
171
{$ifndef dont_use_openlib}
173
{$endif dont_use_openlib}
175
FUNCTION AvailFonts(buffer : pCHAR; bufBytes : LONGINT; flags : LONGINT) : LONGINT;
182
MOVEA.L DiskfontBase,A6
189
PROCEDURE DisposeFontContents(fontContentsHeader : pFontContentsHeader);
193
MOVEA.L fontContentsHeader,A1
194
MOVEA.L DiskfontBase,A6
200
FUNCTION NewFontContents(fontsLock : BPTR; fontName : pCHAR) : pFontContentsHeader;
206
MOVEA.L DiskfontBase,A6
213
FUNCTION NewScaledDiskFont(sourceFont : pTextFont; destTextAttr : pTextAttr) : pDiskFontHeader;
217
MOVEA.L sourceFont,A0
218
MOVEA.L destTextAttr,A1
219
MOVEA.L DiskfontBase,A6
226
FUNCTION OpenDiskFont(textAttr : pTextAttr) : pTextFont;
231
MOVEA.L DiskfontBase,A6
238
FUNCTION GetDiskFontCtrl(tagid : LONGINT) : LONGINT;
243
MOVEA.L DiskfontBase,A6
250
PROCEDURE SetDiskFontCtrlA(taglist : pTagItem);
255
MOVEA.L DiskfontBase,A6
262
{ Change VERSION and LIBVERSION to proper values }
264
VERSION : string[2] = '0';
265
LIBVERSION : longword = 0;
267
{$ifdef use_init_openlib}
268
{$Info Compiling initopening of diskfont.library}
269
{$Info don't forget to use InitDISKFONTLibrary in the beginning of your program}
272
diskfont_exit : Pointer;
274
procedure ClosediskfontLibrary;
276
ExitProc := diskfont_exit;
277
if DiskfontBase <> nil then begin
278
CloseLibrary(DiskfontBase);
283
procedure InitDISKFONTLibrary;
286
DiskfontBase := OpenLibrary(DISKFONTNAME,LIBVERSION);
287
if DiskfontBase <> nil then begin
288
diskfont_exit := ExitProc;
289
ExitProc := @ClosediskfontLibrary;
291
MessageBox('FPC Pascal Error',
292
'Can''t open diskfont.library version ' + VERSION + #10 +
293
'Deallocating resources and closing down',
300
DISKFONTIsCompiledHow := 2;
301
{$endif use_init_openlib}
303
{$ifdef use_auto_openlib}
304
{$Info Compiling autoopening of diskfont.library}
307
diskfont_exit : Pointer;
309
procedure ClosediskfontLibrary;
311
ExitProc := diskfont_exit;
312
if DiskfontBase <> nil then begin
313
CloseLibrary(DiskfontBase);
320
DiskfontBase := OpenLibrary(DISKFONTNAME,LIBVERSION);
321
if DiskfontBase <> nil then begin
322
diskfont_exit := ExitProc;
323
ExitProc := @ClosediskfontLibrary;
324
DISKFONTIsCompiledHow := 1;
326
MessageBox('FPC Pascal Error',
327
'Can''t open diskfont.library version ' + VERSION + #10 +
328
'Deallocating resources and closing down',
333
{$endif use_auto_openlib}
335
{$ifdef dont_use_openlib}
337
DISKFONTIsCompiledHow := 3;
338
{$Warning No autoopening of diskfont.library compiled}
339
{$Warning Make sure you open diskfont.library yourself}
340
{$endif dont_use_openlib}
343
END. (* UNIT DISKFONT *)
346
$Log: diskfont.pas,v $
347
Revision 1.5 2003/02/10 17:59:46 nils
348
* fixes for delphi mode
350
Revision 1.4 2003/02/07 20:48:36 nils
351
* update for amigaos 3.9
353
* changed startcode for library
355
Revision 1.3 2003/01/14 18:46:04 nils
356
* added defines use_amia_smartlink and use_auto_openlib
358
* implemented autoopening of library
360
Revision 1.2 2002/11/18 20:52:58 nils