2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Hook for getting font descriptions from memory font list in mem
11 #include <proto/graphics.h>
12 #include <proto/dos.h>
13 #include <graphics/text.h>
14 #include <graphics/gfxbase.h>
15 #include "diskfont_intern.h"
17 #include <aros/debug.h>
19 /****************************************************************************************/
21 /* Userdata needed by the MemoryFontHook */
24 /* Pointer to the current font in the memory font list */
25 struct TextFont
*CurrentFont
;
26 struct TTextAttr currattr
;
29 /****************************************************************************************/
35 /****************************************************************************************/
37 APTR
MF_IteratorInit(struct DiskfontBase_intern
*DiskfontBase
)
39 struct MFData
*mfdata
;
41 mfdata
= AllocVec(sizeof(struct MFData
), MEMF_ANY
|MEMF_CLEAR
);
45 /* To prevent race conditions */
48 /* Get the first font */
49 mfdata
->CurrentFont
= (struct TextFont
*)GetHead(&GfxBase
->TextFonts
);
54 /****************************************************************************************/
56 /**********************/
57 /* MF_IteratorGetNext */
58 /**********************/
60 /****************************************************************************************/
62 struct TTextAttr
*MF_IteratorGetNext(APTR iterator
, struct DiskfontBase_intern
*DiskfontBase
)
64 struct MFData
*mfdata
= (struct MFData
*)iterator
;
65 struct TextFont
*currfont
;
67 if (mfdata
==NULL
|| mfdata
->CurrentFont
==NULL
)
70 currfont
= mfdata
->CurrentFont
;
72 mfdata
->currattr
.tta_Tags
= NULL
;
73 mfdata
->currattr
.tta_Name
= currfont
->tf_Message
.mn_Node
.ln_Name
;
74 mfdata
->currattr
.tta_YSize
= currfont
->tf_YSize
;
75 mfdata
->currattr
.tta_Style
= currfont
->tf_Style
;
76 mfdata
->currattr
.tta_Flags
= currfont
->tf_Flags
;
78 if (ExtendFont(currfont
, 0L))
80 mfdata
->currattr
.tta_Tags
= TFE(currfont
->tf_Extension
)->tfe_Tags
;
81 if (mfdata
->currattr
.tta_Tags
) mfdata
->currattr
.tta_Style
|= FSF_TAGGED
;
85 mfdata
->CurrentFont
= (struct TextFont
*)GetSucc(mfdata
->CurrentFont
);
87 return &mfdata
->currattr
;
90 /****************************************************************************************/
96 /****************************************************************************************/
98 VOID
MF_IteratorFree(APTR iterator
, struct DiskfontBase_intern
*DiskfontBase
)
100 struct MFData
*mfdata
= (struct MFData
*)iterator
;
106 /****************************************************************************************/