forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfontPool.h
More file actions
75 lines (61 loc) · 2.35 KB
/
fontPool.h
File metadata and controls
75 lines (61 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Filename: fontPool.h
// Created by: drose (31Jan03)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef FONTPOOL_H
#define FONTPOOL_H
#include "pandabase.h"
#include "texture.h"
#include "textFont.h"
#include "filename.h"
#include "lightMutex.h"
#include "pmap.h"
////////////////////////////////////////////////////////////////////
// Class : FontPool
// Description : 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.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA_TEXT FontPool {
PUBLISHED:
// These functions take string parameters instead of Filenames
// because the parameters may not be entirely an actual filename:
// they may be a filename followed by a face index.
INLINE static bool has_font(const string &filename);
INLINE static bool verify_font(const string &filename);
BLOCKING INLINE static TextFont *load_font(const string &filename);
INLINE static void add_font(const string &filename, TextFont *font);
INLINE static void release_font(const string &filename);
INLINE static void release_all_fonts();
INLINE static int garbage_collect();
INLINE static void list_contents(ostream &out);
static void write(ostream &out);
private:
INLINE FontPool();
bool ns_has_font(const string &str);
TextFont *ns_load_font(const string &str);
void ns_add_font(const string &str, TextFont *font);
void ns_release_font(const string &str);
void ns_release_all_fonts();
int ns_garbage_collect();
void ns_list_contents(ostream &out) const;
static void lookup_filename(const string &str, string &index_str,
Filename &filename, int &face_index);
static FontPool *get_ptr();
static FontPool *_global_ptr;
LightMutex _lock;
typedef pmap<string, PT(TextFont) > Fonts;
Fonts _fonts;
};
#include "fontPool.I"
#endif