diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/llrender/llfontregistry.h | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llrender/llfontregistry.h | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/linden/indra/llrender/llfontregistry.h b/linden/indra/llrender/llfontregistry.h new file mode 100644 index 0000000..523e184 --- /dev/null +++ b/linden/indra/llrender/llfontregistry.h | |||
@@ -0,0 +1,114 @@ | |||
1 | /** | ||
2 | * @file llfontregistry.h | ||
3 | * @author Brad Payne | ||
4 | * @brief Storage for fonts. | ||
5 | * | ||
6 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | ||
7 | * | ||
8 | * Copyright (c) 2008-2009, Linden Research, Inc. | ||
9 | * | ||
10 | * Second Life Viewer Source Code | ||
11 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
12 | * to you under the terms of the GNU General Public License, version 2.0 | ||
13 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
14 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
15 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
16 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
17 | * | ||
18 | * There are special exceptions to the terms and conditions of the GPL as | ||
19 | * it is applied to this Source Code. View the full text of the exception | ||
20 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
21 | * online at | ||
22 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
23 | * | ||
24 | * By copying, modifying or distributing this software, you acknowledge | ||
25 | * that you have read and understood your obligations described above, | ||
26 | * and agree to abide by those obligations. | ||
27 | * | ||
28 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
30 | * COMPLETENESS OR PERFORMANCE. | ||
31 | * $/LicenseInfo$ | ||
32 | */ | ||
33 | |||
34 | #ifndef LL_LLFONTREGISTRY_H | ||
35 | #define LL_LLFONTREGISTRY_H | ||
36 | |||
37 | #include "llxmlnode.h" | ||
38 | |||
39 | class LLFontGL; | ||
40 | |||
41 | typedef std::vector<std::string> string_vec_t; | ||
42 | |||
43 | class LLFontDescriptor | ||
44 | { | ||
45 | public: | ||
46 | LLFontDescriptor(); | ||
47 | LLFontDescriptor(const std::string& name, const std::string& size, const U8 style); | ||
48 | LLFontDescriptor(const std::string& name, const std::string& size, const U8 style, const string_vec_t& file_names); | ||
49 | LLFontDescriptor normalize() const; | ||
50 | |||
51 | bool operator<(const LLFontDescriptor& b) const; | ||
52 | |||
53 | bool isTemplate() const; | ||
54 | |||
55 | const std::string& getName() const { return mName; } | ||
56 | void setName(const std::string& name) { mName = name; } | ||
57 | const std::string& getSize() const { return mSize; } | ||
58 | void setSize(const std::string& size) { mSize = size; } | ||
59 | const std::vector<std::string>& getFileNames() const { return mFileNames; } | ||
60 | std::vector<std::string>& getFileNames() { return mFileNames; } | ||
61 | const U8 getStyle() const { return mStyle; } | ||
62 | void setStyle(U8 style) { mStyle = style; } | ||
63 | |||
64 | private: | ||
65 | std::string mName; | ||
66 | std::string mSize; | ||
67 | string_vec_t mFileNames; | ||
68 | U8 mStyle; | ||
69 | }; | ||
70 | |||
71 | class LLFontRegistry | ||
72 | { | ||
73 | public: | ||
74 | LLFontRegistry(const string_vec_t& xui_paths); | ||
75 | ~LLFontRegistry(); | ||
76 | |||
77 | // Load standard font info from XML file(s). | ||
78 | bool parseFontInfo(const std::string& xml_filename); | ||
79 | bool initFromXML(LLXMLNodePtr node); | ||
80 | |||
81 | // Clear cached glyphs for all fonts. | ||
82 | void reset(); | ||
83 | |||
84 | // Destroy all fonts. | ||
85 | void clear(); | ||
86 | |||
87 | // GL cleanup | ||
88 | void destroyGL(); | ||
89 | |||
90 | LLFontGL *getFont(const LLFontDescriptor& desc); | ||
91 | const LLFontDescriptor *getMatchingFontDesc(const LLFontDescriptor& desc); | ||
92 | const LLFontDescriptor *getClosestFontTemplate(const LLFontDescriptor& desc); | ||
93 | |||
94 | bool nameToSize(const std::string& size_name, F32& size); | ||
95 | |||
96 | void dump(); | ||
97 | |||
98 | const string_vec_t& getUltimateFallbackList() const { return mUltimateFallbackList; } | ||
99 | |||
100 | private: | ||
101 | LLFontGL *createFont(const LLFontDescriptor& desc); | ||
102 | typedef std::map<LLFontDescriptor,LLFontGL*> font_reg_map_t; | ||
103 | typedef std::map<std::string,F32> font_size_map_t; | ||
104 | |||
105 | // Given a descriptor, look up specific font instantiation. | ||
106 | font_reg_map_t mFontMap; | ||
107 | // Given a size name, look up the point size. | ||
108 | font_size_map_t mFontSizes; | ||
109 | |||
110 | string_vec_t mUltimateFallbackList; | ||
111 | string_vec_t mXUIPaths; | ||
112 | }; | ||
113 | |||
114 | #endif // LL_LLFONTREGISTRY_H | ||