Panda3D
Main Page
Classes
Files
File List
All
Classes
Functions
Variables
Enumerations
panda
src
text
fontPool.h
1
// Filename: fontPool.h
2
// Created by: drose (31Jan03)
3
//
4
////////////////////////////////////////////////////////////////////
5
//
6
// PANDA 3D SOFTWARE
7
// Copyright (c) Carnegie Mellon University. All rights reserved.
8
//
9
// All use of this software is subject to the terms of the revised BSD
10
// license. You should have received a copy of this license along
11
// with this source code in a file named "LICENSE."
12
//
13
////////////////////////////////////////////////////////////////////
14
15
#ifndef FONTPOOL_H
16
#define FONTPOOL_H
17
18
#include "pandabase.h"
19
20
#include "texture.h"
21
#include "textFont.h"
22
#include "filename.h"
23
#include "lightMutex.h"
24
#include "pmap.h"
25
26
////////////////////////////////////////////////////////////////////
27
// Class : FontPool
28
// Description : This is the preferred interface for loading fonts for
29
// the TextNode system. It is similar to ModelPool and
30
// TexturePool in that it unifies references to the same
31
// filename.
32
////////////////////////////////////////////////////////////////////
33
class
EXPCL_PANDA_TEXT
FontPool
{
34
PUBLISHED:
35
// These functions take string parameters instead of Filenames
36
// because the parameters may not be entirely an actual filename:
37
// they may be a filename followed by a face index.
38
39
INLINE
static
bool
has_font(
const
string
&filename);
40
INLINE
static
bool
verify_font(
const
string
&filename);
41
BLOCKING INLINE
static
TextFont
*load_font(
const
string
&filename);
42
INLINE
static
void
add_font(
const
string
&filename,
TextFont
*font);
43
INLINE
static
void
release_font(
const
string
&filename);
44
INLINE
static
void
release_all_fonts();
45
46
INLINE
static
int
garbage_collect();
47
48
INLINE
static
void
list_contents(ostream &out);
49
static
void
write(ostream &out);
50
51
private
:
52
INLINE
FontPool
();
53
54
bool
ns_has_font(
const
string
&str);
55
TextFont
*ns_load_font(
const
string
&str);
56
void
ns_add_font(
const
string
&str,
TextFont
*font);
57
void
ns_release_font(
const
string
&str);
58
void
ns_release_all_fonts();
59
int
ns_garbage_collect();
60
void
ns_list_contents(ostream &out)
const
;
61
62
static
void
lookup_filename(
const
string
&str,
string
&index_str,
63
Filename
&filename,
int
&face_index);
64
65
static
FontPool *get_ptr();
66
static
FontPool *_global_ptr;
67
68
LightMutex
_lock;
69
typedef
pmap<string, PT(TextFont) >
Fonts
;
70
Fonts
_fonts;
71
};
72
73
#include "fontPool.I"
74
75
#endif
pmap
This is our own Panda specialization on the default STL map.
Definition:
pmap.h:52
FontPool
This is the preferred interface for loading fonts for the TextNode system.
Definition:
fontPool.h:33
TextFont
An encapsulation of a font; i.e.
Definition:
textFont.h:36
Filename
The name of a file, such as a texture file or an Egg file.
Definition:
filename.h:44
LightMutex
This is a standard, non-reentrant mutex, similar to the Mutex class.
Definition:
lightMutex.h:45
Generated on Mon Feb 1 2016 13:44:39 for Panda3D by
1.8.5