summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorRick Pasetto <rick@lindenlab.com>2009-10-15 17:39:17 -0700
committerRick Pasetto <rick@lindenlab.com>2009-10-15 17:39:17 -0700
commitf1beac1a70e74bef5caf4850bd9146a583e00739 (patch)
tree04dcca497b5b93d18d2b2cd093fa5fc3b2393925 /indra/llrender
parent9a7f79cbcf57c46e797d2e5626d534055f9a256d (diff)
parentdce043b3177eb9a7d017af2a7e9f889a18668e77 (diff)
Merge from remote repo
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llfontgl.cpp7
-rw-r--r--indra/llrender/llfontgl.h1
-rw-r--r--indra/llrender/llfontregistry.cpp5
3 files changed, 12 insertions, 1 deletions
diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp
index f7bab3de67..16c99599cf 100644
--- a/indra/llrender/llfontgl.cpp
+++ b/indra/llrender/llfontgl.cpp
@@ -910,6 +910,13 @@ LLFontGL* LLFontGL::getFontByName(const std::string& name)
}
}
+//static
+LLFontGL* LLFontGL::getFontDefault()
+{
+ return getFontSansSerif(); // Fallback to sans serif as default font
+}
+
+
// static
std::string LLFontGL::getFontPathSystem()
{
diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h
index ad84b6d641..d6d6436aee 100644
--- a/indra/llrender/llfontgl.h
+++ b/indra/llrender/llfontgl.h
@@ -167,6 +167,7 @@ public:
static LLFontGL* getFont(const LLFontDescriptor& desc);
// Use with legacy names like "SANSSERIF_SMALL" or "OCRA"
static LLFontGL* getFontByName(const std::string& name);
+ static LLFontGL* getFontDefault(); // default fallback font
static std::string getFontPathLocal();
static std::string getFontPathSystem();
diff --git a/indra/llrender/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp
index 45573cd817..7a3d6ec4f2 100644
--- a/indra/llrender/llfontregistry.cpp
+++ b/indra/llrender/llfontregistry.cpp
@@ -380,7 +380,10 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc)
LLFontDescriptor nearest_exact_desc = *match_desc;
nearest_exact_desc.setSize(norm_desc.getSize());
font_reg_map_t::iterator it = mFontMap.find(nearest_exact_desc);
- if (it != mFontMap.end())
+ // If we fail to find a font in the fonts directory, it->second might be NULL.
+ // We shouldn't construcnt a font with a NULL mFontFreetype.
+ // This may not be the best solution, but it at least prevents a crash.
+ if (it != mFontMap.end() && it->second != NULL)
{
llinfos << "-- matching font exists: " << nearest_exact_desc.getName() << " size " << nearest_exact_desc.getSize() << " style " << ((S32) nearest_exact_desc.getStyle()) << llendl;