Squashed commit of 'sdl-hidd' branch
[cake.git] / rom / graphics / stripfont.c
blobbc3e2e867fc2302d5c99e3657c36aa35c4cbed22
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function StripFont()
6 Lang: english
7 */
8 #include <proto/graphics.h>
9 #include <proto/exec.h>
10 #include <proto/utility.h>
11 #include <proto/oop.h>
12 #include "graphics_intern.h"
14 /*****************************************************************************
16 NAME */
17 #include <clib/graphics_protos.h>
19 AROS_LH1(void, StripFont,
21 /* SYNOPSIS */
22 AROS_LHA(struct TextFont *, font, A0),
24 /* LOCATION */
25 struct GfxBase *, GfxBase, 137, Graphics)
27 /* FUNCTION
28 Removes a TextFontExtension from a font.
30 INPUTS
31 font - font to remove extension from.
33 RESULT
35 NOTES
37 EXAMPLE
39 BUGS
41 SEE ALSO
42 ExtendFont(), ExtendFontTags()
43 INTERNALS
45 HISTORY
46 27-11-96 digulla automatically created from
47 graphics_lib.fd and clib/graphics_protos.h
49 *****************************************************************************/
51 AROS_LIBFUNC_INIT
53 struct TextFontExtension *tfe;
54 struct tfe_hashnode *hn;
56 /* Valid parameter ? */
57 if (font == NULL)
58 return;
60 /* Does the font have an extension ? */
62 ObtainSemaphore(&PrivGBase(GfxBase)->fontsem);
64 hn = tfe_hashlookup(font, GfxBase);
65 if (NULL != hn)
67 tfe = hn->ext;
69 if (hn->font_bitmap) OOP_DisposeObject(hn->font_bitmap);
70 if (hn->chunky_colorfont) FreeVec(hn->chunky_colorfont);
72 /* Remove the hashitem (tfe_hashdelete() has semaphore protection) */
73 tfe_hashdelete(font, GfxBase);
75 if (NULL != tfe)
77 font->tf_Extension = tfe->tfe_OrigReplyPort;
79 /* Font is not tagged anymore */
80 font->tf_Style &= ~FSF_TAGGED;
82 FreeTagItems(tfe->tfe_Tags);
83 FreeMem(tfe, sizeof (struct TextFontExtension_intern));
88 ReleaseSemaphore(&PrivGBase(GfxBase)->fontsem);
90 return;
92 AROS_LIBFUNC_EXIT
93 } /* StripFont */