diff options
Diffstat (limited to 'linden/indra')
-rw-r--r-- | linden/indra/llrender/llfontregistry.cpp | 38 | ||||
-rw-r--r-- | linden/indra/llrender/llfontregistry.h | 14 | ||||
-rw-r--r-- | linden/indra/newview/skins/default/xui/en-us/fonts.xml | 9 |
3 files changed, 52 insertions, 9 deletions
diff --git a/linden/indra/llrender/llfontregistry.cpp b/linden/indra/llrender/llfontregistry.cpp index 619228e..cbd0d5a 100644 --- a/linden/indra/llrender/llfontregistry.cpp +++ b/linden/indra/llrender/llfontregistry.cpp | |||
@@ -177,6 +177,9 @@ LLFontRegistry::LLFontRegistry(const string_vec_t& xui_paths) | |||
177 | // This is potentially a slow directory traversal, so we want to | 177 | // This is potentially a slow directory traversal, so we want to |
178 | // cache the result. | 178 | // cache the result. |
179 | mUltimateFallbackList = LLWindow::getDynamicFallbackFontList(); | 179 | mUltimateFallbackList = LLWindow::getDynamicFallbackFontList(); |
180 | |||
181 | std::string font_choice = gSavedSettings.getString("FontChoice"); | ||
182 | setAlias("SansSerif", font_choice); | ||
180 | } | 183 | } |
181 | 184 | ||
182 | LLFontRegistry::~LLFontRegistry() | 185 | LLFontRegistry::~LLFontRegistry() |
@@ -511,6 +514,13 @@ LLFontGL *LLFontRegistry::getFont(const LLFontDescriptor& orig_desc) | |||
511 | { | 514 | { |
512 | LLFontDescriptor norm_desc = orig_desc.normalize(); | 515 | LLFontDescriptor norm_desc = orig_desc.normalize(); |
513 | 516 | ||
517 | if (hasAlias(norm_desc.getName())) | ||
518 | { | ||
519 | // llinfos << "Font " << norm_desc.getName() << " is alias for " | ||
520 | // << expandAlias(norm_desc.getName()) << llendl; | ||
521 | norm_desc.setName(expandAlias(norm_desc.getName())); | ||
522 | } | ||
523 | |||
514 | font_reg_map_t::iterator it = mFontMap.find(norm_desc); | 524 | font_reg_map_t::iterator it = mFontMap.find(norm_desc); |
515 | if (it != mFontMap.end()) | 525 | if (it != mFontMap.end()) |
516 | return it->second; | 526 | return it->second; |
@@ -649,3 +659,31 @@ void LLFontRegistry::dump() | |||
649 | } | 659 | } |
650 | } | 660 | } |
651 | } | 661 | } |
662 | |||
663 | |||
664 | |||
665 | std::string LLFontRegistry::expandAlias(std::string alias_name) | ||
666 | { | ||
667 | font_alias_map_t::iterator it = mFontAliases.find(alias_name); | ||
668 | if (it != mFontAliases.end()) | ||
669 | { | ||
670 | return it->second; | ||
671 | } | ||
672 | return alias_name; | ||
673 | } | ||
674 | |||
675 | void LLFontRegistry::setAlias(std::string alias_name, std::string orig_name) | ||
676 | { | ||
677 | mFontAliases[alias_name] = orig_name; | ||
678 | } | ||
679 | |||
680 | void LLFontRegistry::clearAlias(std::string alias_name) | ||
681 | { | ||
682 | mFontAliases.erase(alias_name); | ||
683 | } | ||
684 | |||
685 | bool LLFontRegistry::hasAlias(std::string alias_name) | ||
686 | { | ||
687 | font_alias_map_t::iterator it = mFontAliases.find(alias_name); | ||
688 | return (it != mFontAliases.end()); | ||
689 | } | ||
diff --git a/linden/indra/llrender/llfontregistry.h b/linden/indra/llrender/llfontregistry.h index 523e184..0add372 100644 --- a/linden/indra/llrender/llfontregistry.h +++ b/linden/indra/llrender/llfontregistry.h | |||
@@ -97,15 +97,29 @@ public: | |||
97 | 97 | ||
98 | const string_vec_t& getUltimateFallbackList() const { return mUltimateFallbackList; } | 98 | const string_vec_t& getUltimateFallbackList() const { return mUltimateFallbackList; } |
99 | 99 | ||
100 | // If alias_name is a defined alias, returns the original name. | ||
101 | // Otherwise returns alias_name itself. | ||
102 | std::string expandAlias(std::string alias_name); | ||
103 | // Define alias_name as an alias of orig_name. | ||
104 | void setAlias(std::string alias_name, std::string orig_name); | ||
105 | // Undefines the alias alias_name. Does nothing if it's not an alias. | ||
106 | void clearAlias(std::string alias_name); | ||
107 | // True if the alias is defined. | ||
108 | bool hasAlias(std::string alias_name); | ||
109 | |||
110 | |||
100 | private: | 111 | private: |
101 | LLFontGL *createFont(const LLFontDescriptor& desc); | 112 | LLFontGL *createFont(const LLFontDescriptor& desc); |
102 | typedef std::map<LLFontDescriptor,LLFontGL*> font_reg_map_t; | 113 | typedef std::map<LLFontDescriptor,LLFontGL*> font_reg_map_t; |
103 | typedef std::map<std::string,F32> font_size_map_t; | 114 | typedef std::map<std::string,F32> font_size_map_t; |
115 | typedef std::map<std::string,std::string> font_alias_map_t; | ||
104 | 116 | ||
105 | // Given a descriptor, look up specific font instantiation. | 117 | // Given a descriptor, look up specific font instantiation. |
106 | font_reg_map_t mFontMap; | 118 | font_reg_map_t mFontMap; |
107 | // Given a size name, look up the point size. | 119 | // Given a size name, look up the point size. |
108 | font_size_map_t mFontSizes; | 120 | font_size_map_t mFontSizes; |
121 | // Given an alias name, look up the original name. | ||
122 | font_alias_map_t mFontAliases; | ||
109 | 123 | ||
110 | string_vec_t mUltimateFallbackList; | 124 | string_vec_t mUltimateFallbackList; |
111 | string_vec_t mXUIPaths; | 125 | string_vec_t mXUIPaths; |
diff --git a/linden/indra/newview/skins/default/xui/en-us/fonts.xml b/linden/indra/newview/skins/default/xui/en-us/fonts.xml index 5d831c6..df1356b 100644 --- a/linden/indra/newview/skins/default/xui/en-us/fonts.xml +++ b/linden/indra/newview/skins/default/xui/en-us/fonts.xml | |||
@@ -18,15 +18,6 @@ | |||
18 | </os> | 18 | </os> |
19 | </font> | 19 | </font> |
20 | 20 | ||
21 | <font name="SansSerif" comment="Name of san-serif font (Truetype file name)"> | ||
22 | <file>DejaVuSansCondensed.ttf</file> | ||
23 | </font> | ||
24 | |||
25 | <font name="SansSerifBold" | ||
26 | comment="Name of bold sans-serif font" | ||
27 | font_style="Bold"> | ||
28 | <file>DejaVuSansCondensed-Bold.ttf</file> | ||
29 | </font> | ||
30 | 21 | ||
31 | <font name="Monospace" | 22 | <font name="Monospace" |
32 | comment="Name of monospace font"> | 23 | comment="Name of monospace font"> |