refactored some code. compiles now without suppresing any warning with gcc-6.3.0.
[AROS.git] / rom / graphics / remfont.c
blob650e07a1205557bb6ba2826a3bec288251678164
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Remove a font from the list of public available fonts.
6 Lang: english
7 */
8 #include <aros/debug.h>
9 #include "graphics_intern.h"
10 #include <proto/exec.h>
12 /*****************************************************************************
14 NAME */
15 #include <graphics/text.h>
16 #include <proto/graphics.h>
18 AROS_LH1(void, RemFont,
20 /* SYNOPSIS */
21 AROS_LHA(struct TextFont *, textFont, A1),
23 /* LOCATION */
24 struct GfxBase *, GfxBase, 81, Graphics)
26 /* FUNCTION
27 Remove a font from the list of public available fonts. Afterwards,
28 you can close it.
30 INPUTS
31 textFont - Remove this font.
33 RESULT
34 None.
36 NOTES
38 EXAMPLE
40 BUGS
42 SEE ALSO
43 OpenFont(), CloseFont(), SetFont(), AddFont()
45 INTERNALS
47 HISTORY
49 *****************************************************************************/
51 AROS_LIBFUNC_INIT
53 struct TextFontExtension *tfe;
54 BOOL can_remove = TRUE;
56 ASSERT_VALID_PTR(textFont);
58 Forbid();
59 tfe = (struct TextFontExtension *)textFont->tf_Extension;
60 if (tfe)
62 if ((tfe->tfe_MatchWord == TFE_MATCHWORD) && (tfe->tfe_BackPtr == textFont))
64 if (tfe->tfe_Flags0 & TE0F_NOREMFONT)
66 can_remove = FALSE;
72 if (can_remove)
74 if (!(textFont->tf_Flags & FPF_REMOVED))
76 textFont->tf_Flags |= FPF_REMOVED;
77 Remove (&textFont->tf_Message.mn_Node);
79 #if DEBUG
80 else
82 D(bug("Someone tried to remove font which is already removed!"));
84 #endif
86 StripFont(textFont);
90 Permit();
92 AROS_LIBFUNC_EXIT
94 } /* RemFont */