New bitmap method SetRGBConversionFunction which can be used to
[tangerine.git] / rom / graphics / openfont.c
blob674d8af9b01be90a8713f153e3879ddcaf94dc6d
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$ $Log
5 Desc: Graphics function OpenFont()
6 Lang: english
7 */
8 #include <aros/debug.h>
9 #include "graphics_intern.h"
10 #include <graphics/text.h>
12 #include <string.h>
14 /*****************************************************************************
16 NAME */
17 #include <graphics/text.h>
18 #include <proto/graphics.h>
20 AROS_LH1(struct TextFont *, OpenFont,
22 /* SYNOPSIS */
23 AROS_LHA(struct TextAttr *, textAttr, A0),
25 /* LOCATION */
26 struct GfxBase *, GfxBase, 12, Graphics)
28 /* FUNCTION
30 INPUTS
32 RESULT
34 NOTES
36 EXAMPLE
38 BUGS
40 SEE ALSO
42 INTERNALS
44 HISTORY
45 29-10-95 digulla automatically created from
46 graphics_lib.fd and clib/graphics_protos.h
48 *****************************************************************************/
50 AROS_LIBFUNC_INIT
51 AROS_LIBBASE_EXT_DECL(struct GfxBase *,GfxBase)
53 struct TextFont *tf, *best_so_far = NULL;
54 WORD bestmatch = 0;
56 ASSERT_VALID_PTR(textAttr);
58 if (!textAttr->ta_Name) return NULL;
60 /* Search for font in the fontlist */
61 Forbid();
62 ForeachNode(&GfxBase->TextFonts, tf)
64 if (0 == strcmp(tf->tf_Message.mn_Node.ln_Name, textAttr->ta_Name))
66 UWORD match;
67 struct TagItem *tags = NULL;
68 struct TextAttr match_ta =
70 tf->tf_Message.mn_Node.ln_Name,
71 tf->tf_YSize,
72 tf->tf_Style,
73 tf->tf_Flags
76 if (ExtendFont(tf, NULL))
78 tags = ((struct TextFontExtension *)tf->tf_Extension)->tfe_Tags;
81 match = WeighTAMatch(textAttr, &match_ta, tags);
82 if (match > bestmatch)
84 bestmatch = match;
85 best_so_far = tf;
90 if (best_so_far) best_so_far->tf_Accessors ++;
92 Permit();
94 return best_so_far;
96 AROS_LIBFUNC_EXIT
98 } /* OpenFont */