aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llrender/llfontgl.h
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-30 13:04:20 -0500
committerJacek Antonelli2009-04-30 13:07:16 -0500
commitca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch)
tree8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/llrender/llfontgl.h
parentSecond Life viewer sources 1.22.11 (diff)
downloadmeta-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/llfontgl.h74
1 files changed, 39 insertions, 35 deletions
diff --git a/linden/indra/llrender/llfontgl.h b/linden/indra/llrender/llfontgl.h
index 97bdd1a..6cb1727 100644
--- a/linden/indra/llrender/llfontgl.h
+++ b/linden/indra/llrender/llfontgl.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 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 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 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -39,8 +40,16 @@
39#include "llcoord.h" 40#include "llcoord.h"
40#include "llrect.h" 41#include "llrect.h"
41 42
43#include "llfontregistry.h"
44
42class LLColor4; 45class LLColor4;
43 46
47// Key used to request a font.
48class LLFontDescriptor;
49
50// Structure used to store previously requested fonts.
51class LLFontRegistry;
52
44class LLFontGL : public LLFont 53class LLFontGL : public LLFont
45{ 54{
46public: 55public:
@@ -85,18 +94,13 @@ public:
85 LLFontGL &operator=(const LLFontGL &source); 94 LLFontGL &operator=(const LLFontGL &source);
86 95
87 static BOOL initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale, 96 static BOOL initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale,
88 const std::string& monospace_file, F32 monospace_size, 97 const std::string& app_dir,
89 const std::string& sansserif_file, 98 const std::vector<std::string>& xui_paths);
90 const std::string& sansserif_fallback_file, F32 ss_fallback_scale,
91 F32 small_size, F32 medium_size, F32 large_size, F32 huge_size,
92 const std::string& sansserif_bold_file, F32 bold_size,
93 const std::string& app_dir = LLStringUtil::null);
94 99
95 static void destroyDefaultFonts(); 100 static void destroyDefaultFonts();
96 static void destroyGL(); 101 static void destroyAllGL();
102 void destroyGL();
97 103
98 static bool loadFaceFallback(LLFontList *fontp, const std::string& fontname, const F32 point_size);
99 static bool loadFace(LLFontGL *fontp, const std::string& fontname, const F32 point_size, LLFontList *fallback_fontp);
100 /* virtual*/ BOOL loadFace(const std::string& filename, 104 /* virtual*/ BOOL loadFace(const std::string& filename,
101 const F32 point_size, const F32 vert_dpi, const F32 horz_dpi, 105 const F32 point_size, const F32 vert_dpi, const F32 horz_dpi,
102 const S32 components, BOOL is_fallback); 106 const S32 components, BOOL is_fallback);
@@ -180,7 +184,7 @@ public:
180 F32* drawn_pixels = NULL) const; 184 F32* drawn_pixels = NULL) const;
181 185
182 // Returns the index of the first complete characters from text that can be drawn in max_pixels 186 // Returns the index of the first complete characters from text that can be drawn in max_pixels
183 // starting on the right side (at character start_pos). 187 // given that the character at start_pos should be the last character (or as close to last as possible).
184 virtual S32 firstDrawableChar(const llwchar* wchars, F32 max_pixels, S32 text_len, S32 start_pos=S32_MAX, S32 max_chars = S32_MAX) const; 188 virtual S32 firstDrawableChar(const llwchar* wchars, F32 max_pixels, S32 text_len, S32 start_pos=S32_MAX, S32 max_chars = S32_MAX) const;
185 189
186 // Returns the index of the character closest to pixel position x (ignoring text to the right of max_pixels and max_chars) 190 // Returns the index of the character closest to pixel position x (ignoring text to the right of max_pixels and max_chars)
@@ -191,12 +195,11 @@ public:
191 195
192 LLImageGL *getImageGL() const; 196 LLImageGL *getImageGL() const;
193 197
194 void addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label); 198 void addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label) const;
195 void addEmbeddedChar( llwchar wc, LLImageGL* image, const LLWString& label); 199 void addEmbeddedChar( llwchar wc, LLImageGL* image, const LLWString& label) const;
196 void removeEmbeddedChar( llwchar wc ); 200 void removeEmbeddedChar( llwchar wc ) const;
197 201
198 static std::string nameFromFont(const LLFontGL* fontp); 202 static std::string nameFromFont(const LLFontGL* fontp);
199 static LLFontGL* fontFromName(const std::string& name);
200 203
201 static std::string nameFromHAlign(LLFontGL::HAlign align); 204 static std::string nameFromHAlign(LLFontGL::HAlign align);
202 static LLFontGL::HAlign hAlignFromName(const std::string& name); 205 static LLFontGL::HAlign hAlignFromName(const std::string& name);
@@ -227,20 +230,14 @@ public:
227 static BOOL sDisplayFont ; 230 static BOOL sDisplayFont ;
228 static std::string sAppDir; // For loading fonts 231 static std::string sAppDir; // For loading fonts
229 232
230 static LLFontGL* sMonospace; // medium 233 static LLFontGL* getFontMonospace();
231 static LLFontList* sMonospaceFallback; 234 static LLFontGL* getFontSansSerifSmall();
232 235 static LLFontGL* getFontSansSerif();
233 static LLFontGL* sSansSerifSmall; // small 236 static LLFontGL* getFontSansSerifBig();
234 static LLFontList* sSSSmallFallback; 237 static LLFontGL* getFontSansSerifHuge();
235 static LLFontGL* sSansSerif; // medium 238 static LLFontGL* getFontSansSerifBold();
236 static LLFontList* sSSFallback; 239 static LLFontGL* getFontExtChar();
237 static LLFontGL* sSansSerifBig; // large 240 static LLFontGL* getFont(const LLFontDescriptor& desc);
238 static LLFontList* sSSBigFallback;
239 static LLFontGL* sSansSerifHuge; // very large
240 static LLFontList* sSSHugeFallback;
241
242 static LLFontGL* sSansSerifBold; // medium, bolded
243 static LLFontList* sSSBoldFallback;
244 241
245 static LLColor4 sShadowColor; 242 static LLColor4 sShadowColor;
246 243
@@ -248,19 +245,26 @@ public:
248 friend class LLHUDText; 245 friend class LLHUDText;
249 246
250protected: 247protected:
251 /*virtual*/ BOOL addChar(const llwchar wch); 248 /*virtual*/ BOOL addChar(const llwchar wch) const;
252 static std::string getFontPathLocal();
253 static std::string getFontPathSystem();
254 249
255protected: 250protected:
256 LLPointer<LLImageRaw> mRawImageGLp;
257 LLPointer<LLImageGL> mImageGLp;
258 typedef std::map<llwchar,embedded_data_t*> embedded_map_t; 251 typedef std::map<llwchar,embedded_data_t*> embedded_map_t;
259 embedded_map_t mEmbeddedChars; 252 mutable embedded_map_t mEmbeddedChars;
260 253
254 LLFontDescriptor mFontDesc;
255
256 // Registry holds all instantiated fonts.
257 static LLFontRegistry* sFontRegistry;
258
261public: 259public:
260 static std::string getFontPathLocal();
261 static std::string getFontPathSystem();
262
262 static LLCoordFont sCurOrigin; 263 static LLCoordFont sCurOrigin;
263 static std::vector<LLCoordFont> sOriginStack; 264 static std::vector<LLCoordFont> sOriginStack;
265
266 const LLFontDescriptor &getFontDesc() const { return mFontDesc; }
267 void setFontDesc(const LLFontDescriptor& font_desc) { mFontDesc = font_desc; }
264}; 268};
265 269
266#endif 270#endif