2 Copyright © 1995-96, The AROS Development Team. All rights reserved.
5 Desc: Demo/test of diskfont/AvailFonts()
10 #include <proto/diskfont.h>
11 #include <proto/exec.h>
12 #include <diskfont/diskfont.h>
13 #include <exec/memory.h>
16 #include <proto/dos.h>
19 #include <aros/debug.h>
21 struct Library
*DiskfontBase
;
23 int main(int argc
, char ** argv
)
28 struct AvailFontsHeader
*afh
;
29 struct AvailFonts
*afptr
;
31 /* Try to guess how many bytes are needed */
34 if (!(DiskfontBase
= OpenLibrary("diskfont.library", 0L)))
36 VPrintf ("Couldn't open diskfont.library\n", NULL
);
42 afh
= (struct AvailFontsHeader
*)AllocMem(afsize
, MEMF_ANY
);
45 afshortage
= AvailFonts((STRPTR
)afh
, afsize
, AFF_MEMORY
|AFF_DISK
);
50 afh
= (struct AvailFontsHeader
*)(-1L);
53 } while (afshortage
&& afh
);
57 /* Print some info about the fonts */
60 pargs
[0] = afh
->afh_NumEntries
;
61 VPrintf("Number of fonts found: %ld\n", pargs
);
63 /* Get pointer to the first AvailFonts item */
64 afptr
= (struct AvailFonts
*)&afh
[1];
66 for (count
= afh
->afh_NumEntries
; count
; count
--)
68 pargs
[0] = afptr
->af_Type
;
69 pargs
[1] = (IPTR
)afptr
->af_Attr
.ta_Name
;
70 pargs
[2] = afptr
->af_Attr
.ta_YSize
;
71 pargs
[3] = afptr
->af_Attr
.ta_Style
;
72 pargs
[4] = afptr
->af_Attr
.ta_Flags
;
74 VPrintf ("[%ld] Font name: %-30.s Font YSize: %ld Style: 0x%lx Flags 0x%lx\n", pargs
);
80 CloseLibrary(DiskfontBase
);