3 // This source code has been donated to the Public Domain. Do
4 // whatever you want with it.
6 // A module to take care of all of gnash's loaded fonts.
9 #include "gnashconfig.h" // HAVE_ZLIB_H, USE_SWFTREE
14 #include "DefineShapeTag.h"
15 #include "LineStyle.h"
16 #include "movie_definition.h"
18 // Define to the name of a default font.
19 #define DEFAULT_FONT_NAME "_sans"
25 std::vector
< boost::intrusive_ptr
<Font
> > s_fonts
;
26 boost::intrusive_ptr
<Font
> _defaultFont
;
41 boost::intrusive_ptr
<Font
>
44 if ( _defaultFont
) return _defaultFont
;
45 _defaultFont
= new Font(DEFAULT_FONT_NAME
);
50 get_font(const std::string
& name
, bool bold
, bool italic
)
52 // Dumb linear search.
53 for (unsigned int i
= 0; i
< s_fonts
.size(); i
++)
55 Font
* f
= s_fonts
[i
].get();
57 if ( f
->matches(name
, bold
, italic
) )
62 Font
* f
= new Font(name
, bold
, italic
);
72 // Make sure font isn't already in the list.
73 for (unsigned int i
= 0; i
< s_fonts
.size(); i
++)
75 assert(s_fonts
[i
] != f
);
84 } // end namespace fontlib
85 } // end namespace gnash
92 // indent-tabs-mode: t