1 #include <diskfont/diskfont.h>
2 #include <proto/exec.h>
4 #include <proto/diskfont.h>
5 #include <proto/utility.h>
11 struct Library
*DiskfontBase
;
12 struct UtilityBase
*UtilityBase
;
16 void cleanup(char *msg
)
18 if (msg
) printf("aftest: %s\n", msg
);
20 if (buf
) FreeVec(buf
);
22 if (UtilityBase
) CloseLibrary((struct Library
*)UtilityBase
);
23 if (DiskfontBase
) CloseLibrary(DiskfontBase
);
30 DiskfontBase
= OpenLibrary("diskfont.library", 0);
31 if (!DiskfontBase
) cleanup("Cant open diskfont.library!");
32 UtilityBase
= (struct UtilityBase
*) OpenLibrary("utility.library", 0);
33 if (!UtilityBase
) cleanup("Cant open utility.library!");
38 struct AvailFontsHeader
*afh
;
39 struct TAvailFonts
*af
;
41 ULONG bufsize
= 10000, shortage
;
45 buf
= AllocVec(bufsize
, MEMF_ANY
);
46 if (!buf
) cleanup("out of memory!");
50 shortage
= AvailFonts(buf
, bufsize
, AFF_MEMORY
| AFF_DISK
| AFF_BITMAP
| AFF_TAGGED
);
56 buf
= AllocVec(bufsize
, MEMF_ANY
);
57 if (!buf
) cleanup("out of memory!");
61 afh
= (struct AvailFontsHeader
*)buf
;
62 numentries
= afh
->afh_NumEntries
;
64 printf("numentries = %ld\n", (long)numentries
);
66 af
= (struct TAvailFonts
*)(buf
+ 2);
68 for(i
= 0; i
< numentries
;i
++)
71 printf("%s/%d [%d] flags = %x style = %x\n",
72 af
->taf_Attr
.tta_Name
,
73 af
->taf_Attr
.tta_YSize
,
75 af
->taf_Attr
.tta_Flags
,
76 af
->taf_Attr
.tta_Style
);
78 printf(" tags = %p istagged = %d\n", af
->taf_Attr
.tta_Tags
, (af
->taf_Attr
.tta_Style
& FSF_TAGGED
));
81 if ((af
->taf_Attr
.tta_Style
& FSF_TAGGED
) && (af
->taf_Attr
.tta_Tags
))
84 const struct TagItem
*tstate
= af
->taf_Attr
.tta_Tags
;
86 printf("tags = %p\n", af
->taf_Attr
.tta_Tags
);
89 while((tag
= NextTagItem(&tstate
)))
91 printf(" {%lx,%lx}\n", tag
->ti_Tag
, tag
->ti_Data
);
96 printf("#%ld: %s/%d [%d] flags = %x style = %x\n",
98 af
->taf_Attr
.tta_Name
,
99 af
->taf_Attr
.tta_YSize
,
101 af
->taf_Attr
.tta_Flags
,
102 af
->taf_Attr
.tta_Style
);
116 return 0; /* keep compiler happy */