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
)
27 struct AvailFontsHeader
*afh
;
28 struct AvailFonts
*afptr
;
30 /* Try to guess how many bytes are needed */
33 if (!(DiskfontBase
= OpenLibrary("diskfont.library", 0L)))
35 VPrintf ("Couldn't open diskfont.library\n", NULL
);
41 afh
= (struct AvailFontsHeader
*)AllocMem(afsize
, MEMF_ANY
);
44 afshortage
= AvailFonts((STRPTR
)afh
, afsize
, AFF_MEMORY
|AFF_DISK
);
49 afh
= (struct AvailFontsHeader
*)(-1L);
52 } while (afshortage
&& afh
);
56 /* Print some info about the fonts */
59 Printf("Number of fonts found: %ld\n", (ULONG
)afh
->afh_NumEntries
);
61 /* Get pointer to the first AvailFonts item */
62 afptr
= (struct AvailFonts
*)&afh
[1];
64 for (count
= afh
->afh_NumEntries
; count
; count
--)
66 Printf ("[%ld] Font name: %-30.s Font YSize: %ld Style: 0x%lx Flags 0x%lx\n",
67 (ULONG
)afptr
->af_Type
, afptr
->af_Attr
.ta_Name
,
68 (ULONG
)afptr
->af_Attr
.ta_YSize
,
69 (ULONG
)afptr
->af_Attr
.ta_Style
,
70 (ULONG
)afptr
->af_Attr
.ta_Flags
);
77 CloseLibrary(DiskfontBase
);