2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
6 #include <diskfont/diskfont.h>
7 #include <proto/exec.h>
9 #include <proto/diskfont.h>
10 #include <proto/utility.h>
16 struct Library
*DiskfontBase
;
17 struct UtilityBase
*UtilityBase
;
21 void cleanup(char *msg
)
23 if (msg
) printf("aftest: %s\n", msg
);
27 if (UtilityBase
) CloseLibrary((struct Library
*)UtilityBase
);
28 if (DiskfontBase
) CloseLibrary(DiskfontBase
);
35 DiskfontBase
= OpenLibrary("diskfont.library", 0);
36 if (!DiskfontBase
) cleanup("Cant open diskfont.library!");
37 UtilityBase
= (struct UtilityBase
*) OpenLibrary("utility.library", 0);
38 if (!UtilityBase
) cleanup("Cant open utility.library!");
43 struct AvailFontsHeader
*afh
;
44 struct TAvailFonts
*af
;
46 ULONG bufsize
= 10000, shortage
;
50 buf
= AllocVec(bufsize
, MEMF_ANY
);
51 if (!buf
) cleanup("out of memory!");
55 shortage
= AvailFonts(buf
, bufsize
, AFF_MEMORY
| AFF_DISK
| AFF_BITMAP
| AFF_TAGGED
);
61 buf
= AllocVec(bufsize
, MEMF_ANY
);
62 if (!buf
) cleanup("out of memory!");
66 afh
= (struct AvailFontsHeader
*)buf
;
67 numentries
= afh
->afh_NumEntries
;
69 printf("numentries = %ld\n", (long)numentries
);
71 af
= (struct TAvailFonts
*)(buf
+ 2);
73 for(i
= 0; i
< numentries
;i
++)
76 printf("%s/%d [%d] flags = %x style = %x\n",
77 af
->taf_Attr
.tta_Name
,
78 af
->taf_Attr
.tta_YSize
,
80 af
->taf_Attr
.tta_Flags
,
81 af
->taf_Attr
.tta_Style
);
83 printf(" tags = %p istagged = %d\n", af
->taf_Attr
.tta_Tags
, (af
->taf_Attr
.tta_Style
& FSF_TAGGED
));
86 if ((af
->taf_Attr
.tta_Style
& FSF_TAGGED
) && (af
->taf_Attr
.tta_Tags
))
88 struct TagItem
*tag
, *tstate
= af
->taf_Attr
.tta_Tags
;
90 printf("tags = %p\n", af
->taf_Attr
.tta_Tags
);
93 while((tag
= NextTagItem(&tstate
)))
95 printf(" {%lx,%lx}\n", tag
->ti_Tag
, tag
->ti_Data
);
100 printf("#%ld: %s/%d [%d] flags = %x style = %x\n",
102 af
->taf_Attr
.tta_Name
,
103 af
->taf_Attr
.tta_YSize
,
105 af
->taf_Attr
.tta_Flags
,
106 af
->taf_Attr
.tta_Style
);
120 return 0; /* keep compiler happy */