aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llrender/llfontgl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llrender/llfontgl.cpp')
-rw-r--r--linden/indra/llrender/llfontgl.cpp41
1 files changed, 30 insertions, 11 deletions
diff --git a/linden/indra/llrender/llfontgl.cpp b/linden/indra/llrender/llfontgl.cpp
index 938dd73..253bf50 100644
--- a/linden/indra/llrender/llfontgl.cpp
+++ b/linden/indra/llrender/llfontgl.cpp
@@ -36,7 +36,7 @@
36#include "llfont.h" 36#include "llfont.h"
37#include "llfontgl.h" 37#include "llfontgl.h"
38#include "llgl.h" 38#include "llgl.h"
39#include "llglimmediate.h" 39#include "llrender.h"
40#include "v4color.h" 40#include "v4color.h"
41#include "llstl.h" 41#include "llstl.h"
42 42
@@ -56,6 +56,7 @@ LLFontGL* LLFontGL::sSansSerif = NULL;
56LLFontGL* LLFontGL::sSansSerifBig = NULL; 56LLFontGL* LLFontGL::sSansSerifBig = NULL;
57LLFontGL* LLFontGL::sSansSerifHuge = NULL; 57LLFontGL* LLFontGL::sSansSerifHuge = NULL;
58LLFontGL* LLFontGL::sSansSerifBold = NULL; 58LLFontGL* LLFontGL::sSansSerifBold = NULL;
59LLFontList* LLFontGL::sMonospaceFallback = NULL;
59LLFontList* LLFontGL::sSSFallback = NULL; 60LLFontList* LLFontGL::sSSFallback = NULL;
60LLFontList* LLFontGL::sSSSmallFallback = NULL; 61LLFontList* LLFontGL::sSSSmallFallback = NULL;
61LLFontList* LLFontGL::sSSBigFallback = NULL; 62LLFontList* LLFontGL::sSSBigFallback = NULL;
@@ -240,7 +241,7 @@ bool LLFontGL::loadFaceFallback(LLFontList *fontlistp, const LLString& fontname,
240 font_path = sys_path + *token_iter; 241 font_path = sys_path + *token_iter;
241 if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, TRUE)) 242 if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, TRUE))
242 { 243 {
243 llwarns << "Couldn't load font " << *token_iter << llendl; 244 LL_INFOS_ONCE("ViewerImages") << "Couldn't load font " << *token_iter << LL_ENDL;
244 delete fontp; 245 delete fontp;
245 fontp = NULL; 246 fontp = NULL;
246 } 247 }
@@ -267,7 +268,7 @@ bool LLFontGL::loadFace(LLFontGL *fontp, const LLString& fontname, const F32 poi
267 font_path = sys_path + fontname; 268 font_path = sys_path + fontname;
268 if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, FALSE)) 269 if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, FALSE))
269 { 270 {
270 llwarns << "Couldn't load font " << fontname << llendl; 271 LL_WARNS("ViewerImages") << "Couldn't load font " << fontname << LL_ENDL;
271 return false; 272 return false;
272 } 273 }
273 } 274 }
@@ -279,12 +280,12 @@ bool LLFontGL::loadFace(LLFontGL *fontp, const LLString& fontname, const F32 poi
279 280
280// static 281// static
281BOOL LLFontGL::initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale, 282BOOL LLFontGL::initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale,
282 const LLString& monospace_file, F32 monospace_size, 283 const LLString& monospace_file, F32 monospace_size,
283 const LLString& sansserif_file, 284 const LLString& sansserif_file,
284 const LLString& sanserif_fallback_file, F32 ss_fallback_scale, 285 const LLString& sanserif_fallback_file, F32 ss_fallback_scale,
285 F32 small_size, F32 medium_size, F32 big_size, F32 huge_size, 286 F32 small_size, F32 medium_size, F32 big_size, F32 huge_size,
286 const LLString& sansserif_bold_file, F32 bold_size, 287 const LLString& sansserif_bold_file, F32 bold_size,
287 const LLString& app_dir) 288 const LLString& app_dir)
288{ 289{
289 BOOL failed = FALSE; 290 BOOL failed = FALSE;
290 sVertDPI = (F32)llfloor(screen_dpi * y_scale); 291 sVertDPI = (F32)llfloor(screen_dpi * y_scale);
@@ -306,7 +307,21 @@ BOOL LLFontGL::initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale,
306 sMonospace->reset(); 307 sMonospace->reset();
307 } 308 }
308 309
309 failed |= !loadFace(sMonospace, monospace_file, monospace_size, NULL); 310 if (sMonospaceFallback)
311 {
312 delete sMonospaceFallback;
313 }
314 sMonospaceFallback = new LLFontList();
315 if (!loadFaceFallback(
316 sMonospaceFallback,
317 sanserif_fallback_file,
318 monospace_size * ss_fallback_scale))
319 {
320 delete sMonospaceFallback;
321 sMonospaceFallback = NULL;
322 }
323
324 failed |= !loadFace(sMonospace, monospace_file, monospace_size, sMonospaceFallback);
310 325
311 // 326 //
312 // Sans-serif fonts 327 // Sans-serif fonts
@@ -466,6 +481,9 @@ void LLFontGL::destroyDefaultFonts()
466 delete sSansSerifBold; 481 delete sSansSerifBold;
467 sSansSerifBold = NULL; 482 sSansSerifBold = NULL;
468 483
484 delete sMonospaceFallback;
485 sMonospaceFallback = NULL;
486
469 delete sSSHugeFallback; 487 delete sSSHugeFallback;
470 sSSHugeFallback = NULL; 488 sSSHugeFallback = NULL;
471 489
@@ -647,7 +665,8 @@ S32 LLFontGL::render(const LLWString &wstr,
647 665
648 mImageGLp->bind(0); 666 mImageGLp->bind(0);
649 667
650 gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Not guaranteed to be set correctly 668 // Not guaranteed to be set correctly
669 gGL.setSceneBlendType(LLRender::BT_ALPHA);
651 670
652 cur_x = ((F32)x * sScaleX); 671 cur_x = ((F32)x * sScaleX);
653 cur_y = ((F32)y * sScaleY); 672 cur_y = ((F32)y * sScaleY);