From eed5671681cc508fe0f06b06018e5a14894d4f32 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Wed, 13 Mar 2019 14:21:38 +0200 Subject: SL-10610 mac fix for showing special characters --- indra/llrender/llfontregistry.cpp | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp index 3c829596ce..10896ecb5d 100644 --- a/indra/llrender/llfontregistry.cpp +++ b/indra/llrender/llfontregistry.cpp @@ -44,6 +44,8 @@ using std::map; bool font_desc_init_from_xml(LLXMLNodePtr node, LLFontDescriptor& desc); bool init_from_xml(LLFontRegistry* registry, LLXMLNodePtr node); +const std::string MACOSX_FONT_PATH_LIBRARY = "/Library/Fonts/"; + LLFontDescriptor::LLFontDescriptor(): mStyle(0) { @@ -434,24 +436,35 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) ++file_name_it) { LLFontGL *fontp = new LLFontGL; - std::string font_path = local_path + *file_name_it; + string_vec_t font_paths; + font_paths.push_back(local_path + *file_name_it); + font_paths.push_back(sys_path + *file_name_it); +#if LL_DARWIN + font_paths.push_back(MACOSX_FONT_PATH_LIBRARY + *file_name_it); +#endif // *HACK: Fallback fonts don't render, so we can use that to suppress // creation of OpenGL textures for test apps. JC BOOL is_fallback = !is_first_found || !mCreateGLTextures; F32 extra_scale = (is_fallback)?fallback_scale:1.0; - if (!fontp->loadFace(font_path, extra_scale * point_size, - LLFontGL::sVertDPI, LLFontGL::sHorizDPI, 2, is_fallback)) + F32 point_size_scale = extra_scale * point_size; + bool is_font_loaded = false; + for(string_vec_t::iterator font_paths_it = font_paths.begin(); + font_paths_it != font_paths.end(); + ++font_paths_it) { - font_path = sys_path + *file_name_it; - - if (!fontp->loadFace(font_path, extra_scale * point_size, + if (fontp->loadFace(*font_paths_it, point_size_scale, LLFontGL::sVertDPI, LLFontGL::sHorizDPI, 2, is_fallback)) { - LL_INFOS_ONCE("LLFontRegistry") << "Couldn't load font " << *file_name_it << " from path " << local_path << LL_ENDL; - delete fontp; - fontp = NULL; + is_font_loaded = true; + break; } } + if(!is_font_loaded) + { + LL_INFOS_ONCE("LLFontRegistry") << "Couldn't load font " << *file_name_it << LL_ENDL; + delete fontp; + fontp = NULL; + } if(fontp) { -- cgit v1.2.3