FontPool

from panda3d.core import FontPool
class FontPool

Bases: DTOOL_SUPER_BASE

This is the preferred interface for loading fonts for the TextNode system. It is similar to ModelPool and TexturePool in that it unifies references to the same filename.

Inheritance diagram

Inheritance diagram of FontPool

__init__(*args, **kwargs)
addFont()

C++ Interface: add_font(str filename, TextFont font)

/**
  • 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.

*/

add_font()

C++ Interface: add_font(str filename, TextFont font)

/**
  • 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()

C++ Interface: garbage_collect()

/**
  • 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.

*/

garbage_collect()

C++ Interface: garbage_collect()

/**
  • 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()

C++ Interface: has_font(str filename)

/**
  • Returns true if the font has ever been loaded, false otherwise.

*/

has_font()

C++ Interface: has_font(str filename)

/**
  • Returns true if the font has ever been loaded, false otherwise.

*/

listContents()

C++ Interface: list_contents(ostream out)

/**
  • Lists the contents of the font pool to the indicated output stream.

*/

list_contents()

C++ Interface: list_contents(ostream out)

/**
  • Lists the contents of the font pool to the indicated output stream.

*/

loadFont()

C++ Interface: load_font(str filename)

/**
  • 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.

*/

load_font()

C++ Interface: load_font(str filename)

/**
  • 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()

C++ Interface: release_all_fonts()

/**
  • Releases all fonts in the pool and restores the pool to the empty state.

*/

releaseFont()

C++ Interface: release_font(str filename)

/**
  • 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 ever loaded,

  • and fonts will never be freed.

*/

release_all_fonts()

C++ Interface: release_all_fonts()

/**
  • Releases all fonts in the pool and restores the pool to the empty state.

*/

release_font()

C++ Interface: release_font(str filename)

/**
  • 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 ever loaded,

  • and fonts will never be freed.

*/

verifyFont()

C++ Interface: verify_font(str filename)

/**
  • 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.

*/

verify_font()

C++ Interface: verify_font(str filename)

/**
  • 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()

C++ Interface: write(ostream out)

/**
  • Lists the contents of the font pool to the indicated output stream.

*/