from panda3d.core import FontPool
- class FontPool
- static add_font(filename: str, font: TextFont)
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.
- static garbage_collect() int
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.
- static has_font(filename: str) bool
Returns true if the font has ever been loaded, false otherwise.
- static list_contents(out: ostream)
Lists the contents of the font pool to the indicated output stream.
- static load_font(filename: str) TextFont
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.
- static release_all_fonts()
Releases all fonts in the pool and restores the pool to the empty state.
- static release_font(filename: str)
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.
- static verify_font(filename: str) bool
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.