FontPool

Inheritance:

Methods of FontPool:

addFont
static void FontPool::add_font(string const &filename, TextFont *font);

Description: Adds the indicated already-loaded font to the pool. The font will always replace any previously-loaded font in the pool that had the same filename.

garbageCollect
static int FontPool::garbage_collect(void);

Description: Releases only those fonts in the pool that have a reference count of exactly 1; i.e. only those fonts that are not being used outside of the pool. Returns the number of fonts released.

hasFont
static bool FontPool::has_font(string const &filename);

These functions take string parameters instead of Filenames because that's somewhat more convenient to the scripting language.
Filename: fontPool.I Created by: drose (31Jan03)
PANDA 3D SOFTWARE Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
All use of this software is subject to the terms of the Panda 3d Software license. You should have received a copy of this license along with this source code; you will also find a current copy of the license at http://etc.cmu.edu/panda3d/docs/license/ .
To contact the maintainers of this program write to panda3d-general@lists.sourceforge.net .
Description: Returns true if the font has ever been loaded, false otherwise.

listContents
static void FontPool::list_contents(ostream &out);

Description: Lists the contents of the font pool to the indicated output stream.

loadFont
static TextFont *FontPool::load_font(string const &filename);

Description: Loads the given filename up into a font, if it has not already been loaded, and returns the new font. If a font with the same filename was previously loaded, returns that one instead. If the font file cannot be found, returns NULL.

releaseAllFonts
static void FontPool::release_all_fonts(void);

Description: Releases all fonts in the pool and restores the pool to the empty state.

releaseFont
static void FontPool::release_font(string const &filename);

Description: Removes the indicated font from the pool, indicating it will never be loaded again; the font may then be freed. If this function is never called, a reference count will be maintained on every font every loaded, and fonts will never be freed.

verifyFont
static bool FontPool::verify_font(string const &filename);

These functions take string parameters instead of Filenames because that's somewhat more convenient to the scripting language.
Description: Loads the given filename up into a font, if it has not already been loaded, and returns true to indicate success, or false to indicate failure. If this returns true, it is guaranteed that a subsequent call to load_font() with the same font name will return a valid Font pointer.

write
static void FontPool::write(ostream &out);

Description: Lists the contents of the font pool to the indicated output stream.