2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Graphics function OpenFont()
8 #include <aros/debug.h>
9 #include "graphics_intern.h"
10 #include <graphics/text.h>
14 /*****************************************************************************
17 #include <graphics/text.h>
18 #include <proto/graphics.h>
20 AROS_LH1(struct TextFont
*, OpenFont
,
23 AROS_LHA(const struct TextAttr
*, textAttr
, A0
),
26 struct GfxBase
*, GfxBase
, 12, Graphics
)
29 Searches for a text font which best matches the specified attributes.
32 textAttr - pointer to a TextAttr or TTextAttr font description.
35 Returns NULL if the font can't be found.
44 CloseFont(), SetFont(), diskfont.library/OpenDiskFont()
49 29-10-95 digulla automatically created from
50 graphics_lib.fd and clib/graphics_protos.h
52 *****************************************************************************/
56 struct TextFont
*tf
, *best_so_far
= NULL
;
59 ASSERT_VALID_PTR(textAttr
);
61 if (!textAttr
->ta_Name
) return NULL
;
63 /* Search for font in the fontlist */
65 ForeachNode(&GfxBase
->TextFonts
, tf
)
67 if (0 == strcmp(tf
->tf_Message
.mn_Node
.ln_Name
, textAttr
->ta_Name
))
70 struct TagItem
*tags
= NULL
;
71 struct TextAttr match_ta
=
73 tf
->tf_Message
.mn_Node
.ln_Name
,
79 if (ExtendFont(tf
, NULL
))
81 tags
= ((struct TextFontExtension
*)tf
->tf_Extension
)->tfe_Tags
;
84 match
= WeighTAMatch(textAttr
, &match_ta
, tags
);
85 if (match
> bestmatch
)
93 if (best_so_far
) best_so_far
->tf_Accessors
++;