diff --git a/indra/cmake/ViewerMiscLibs.cmake b/indra/cmake/ViewerMiscLibs.cmake index 71bf0bd0b..2984f5261 100644 --- a/indra/cmake/ViewerMiscLibs.cmake +++ b/indra/cmake/ViewerMiscLibs.cmake @@ -15,3 +15,5 @@ else (NOT STANDALONE) endif(LINUX AND ${ARCH} STREQUAL "x86_64") set(STANDALONE ON) endif(NOT STANDALONE) + +use_prebuilt_binary(fonts) diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index 9c5579119..f954d2cc8 100644 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -31,11 +31,8 @@ // Freetype stuff #include - -// For some reason, this won't work if it's not wrapped in the ifdef -#ifdef FT_FREETYPE_H #include FT_FREETYPE_H -#endif + #include "llerror.h" #include "llimage.h" @@ -279,7 +276,7 @@ F32 LLFontFreetype::getXAdvance(const LLFontGlyphInfo* glyph) const F32 LLFontFreetype::getXKerning(llwchar char_left, llwchar char_right) const { - if (mFTFace == NULL) + if (mFTFace == nullptr) return 0.0; //llassert(!mIsFallback); @@ -298,7 +295,7 @@ F32 LLFontFreetype::getXKerning(llwchar char_left, llwchar char_right) const F32 LLFontFreetype::getXKerning(const LLFontGlyphInfo* left_glyph_info, const LLFontGlyphInfo* right_glyph_info) const { - if (mFTFace == NULL) + if (mFTFace == nullptr) return 0.0; U32 left_glyph = left_glyph_info ? left_glyph_info->mGlyphIndex : 0; @@ -487,20 +484,12 @@ void LLFontFreetype::renderGlyph(const U32 glyph_index) const if (mFTFace == NULL) return; - FT_Error error = FT_Load_Glyph(mFTFace, glyph_index, FT_LOAD_DEFAULT); -#ifdef SHOW_ASSERT - if (error) + if (FT_Load_Glyph(mFTFace, glyph_index, FT_LOAD_RENDER | FT_LOAD_TARGET_LIGHT) != 0) { - LL_ERRS() << "FT_Load_Glyph returned " << error << LL_ENDL; + // If glyph fails to load and/or render, render a fallback character + llassert_always(!FT_Load_Char(mFTFace, L'?', FT_LOAD_RENDER | FT_LOAD_TARGET_LIGHT)); } -#endif - error = FT_Render_Glyph(mFTFace->glyph, gFontRenderMode); -#ifdef SHOW_ASSERT - if (error) - { - LL_ERRS() << "FT_Render_Glyph returned " << error << LL_ENDL; - } -#endif + mRenderGlyphCount++; } @@ -568,6 +557,7 @@ U8 LLFontFreetype::getStyle() const { return mStyle; } + void LLFontFreetype::setSubImageLuminanceAlpha(const U32 x, const U32 y, const U32 bitmap_num, const U32 width, const U32 height, const U8 *data, S32 stride) const { LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_num); diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index bb9f6e4c8..1dea74985 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -26,24 +26,28 @@ #include "linden_common.h" - - #include "llfontgl.h" // Linden library includes +#include "llfasttimer.h" #include "llfontfreetype.h" #include "llfontbitmapcache.h" #include "llfontregistry.h" #include "llgl.h" #include "llrender.h" -#include "lltexture.h" -#include "v4color.h" #include "llstl.h" -#include "llfasttimer.h" +#include "v4color.h" +#include "lltexture.h" +#include "lldir.h" // Third party library includes #include +#if LL_WINDOWS +#include "llwin32headerslean.h" +#include +#endif + const S32 BOLD_OFFSET = 1; // static class members @@ -52,7 +56,7 @@ F32 LLFontGL::sHorizDPI = 96.f; F32 LLFontGL::sScaleX = 1.f; F32 LLFontGL::sScaleY = 1.f; BOOL LLFontGL::sDisplayFont = TRUE ; -std::string LLFontGL::sAppDir; +std::string LLFontGL::sFontDir; LLColor4U LLFontGL::sShadowColor(0, 0, 0, 255); LLFontRegistry* LLFontGL::sFontRegistry = NULL; @@ -937,7 +941,7 @@ void LLFontGL::initClass(F32 screen_dpi, F32 x_scale, F32 y_scale, const std::st sHorizDPI = (F32)llfloor(screen_dpi * x_scale); sScaleX = x_scale; sScaleY = y_scale; - sAppDir = app_dir; + sFontDir = app_dir; // Font registry init if (!sFontRegistry) @@ -997,7 +1001,7 @@ void LLFontGL::destroyAllGL() // static U8 LLFontGL::getStyleFromString(const std::string &style) { - S32 ret = 0; + U8 ret = 0; if (style.find("NORMAL") != style.npos) { ret |= NORMAL; @@ -1115,6 +1119,7 @@ LLFontGL::VAlign LLFontGL::vAlignFromName(const std::string& name) //else leave baseline return gl_vfont_align; } + //static LLFontGL* LLFontGL::getFontMonospace() { @@ -1203,59 +1208,67 @@ LLFontGL* LLFontGL::getFontDefault() return getFontSansSerif(); // Fallback to sans serif as default font } +static std::string sSystemFontPath; // static std::string LLFontGL::getFontPathSystem() { - std::string system_path; + if (!sSystemFontPath.empty()) return sSystemFontPath; - // Try to figure out where the system's font files are stored. - char *system_root = NULL; #if LL_WINDOWS - system_root = getenv("SystemRoot"); /* Flawfinder: ignore */ - if (!system_root) + wchar_t* pPath = nullptr; + if (SHGetKnownFolderPath(FOLDERID_Fonts, 0, nullptr, &pPath) == S_OK) { - LL_WARNS() << "SystemRoot not found, attempting to load fonts from default path." << LL_ENDL; - } -#endif - - if (system_root) - { - system_path = llformat("%s/fonts/", system_root); + sSystemFontPath = ll_convert_wide_to_string(pPath, CP_UTF8) + gDirUtilp->getDirDelimiter(); + LL_INFOS() << "from SHGetKnownFolderPath(): " << sSystemFontPath << LL_ENDL; + CoTaskMemFree(pPath); + pPath = nullptr; } else { -#if LL_WINDOWS - // HACK for windows 98/Me - system_path = "/WINDOWS/FONTS/"; + // Try to figure out where the system's font files are stored. + auto system_root = LLStringUtil::getenv("SystemRoot"); + if (! system_root.empty()) + { + sSystemFontPath = gDirUtilp->add(system_root, "fonts") + gDirUtilp->getDirDelimiter(); + LL_INFOS() << "from SystemRoot: " << sSystemFontPath << LL_ENDL; + } + else + { + LL_WARNS() << "SystemRoot not found, attempting to load fonts from default path." << LL_ENDL; + // HACK for windows 98/Me + sSystemFontPath = "/WINDOWS/FONTS/"; + } + } + #elif LL_DARWIN // HACK for Mac OS X - system_path = "/System/Library/Fonts/"; + sSystemFontPath = "/System/Library/Fonts/"; #endif - } - return system_path; + return sSystemFontPath; } +static std::string sLocalFontPath; // static std::string LLFontGL::getFontPathLocal() { - std::string local_path; + if (!sLocalFontPath.empty()) return sLocalFontPath; // Backup files if we can't load from system fonts directory. // We could store this in an end-user writable directory to allow // end users to switch fonts. - if (LLFontGL::sAppDir.length()) + if (!LLFontGL::sFontDir.empty()) { // use specified application dir to look for fonts - local_path = LLFontGL::sAppDir + "/fonts/"; + sLocalFontPath = gDirUtilp->add(LLFontGL::sFontDir, "fonts") + gDirUtilp->getDirDelimiter(); } else { // assume working directory is executable directory - local_path = "./fonts/"; + sLocalFontPath = "./fonts/"; } - return local_path; + return sLocalFontPath; } LLFontGL::LLFontGL(const LLFontGL &source) diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h index 1c5a9f94f..4c1d409be 100644 --- a/indra/llrender/llfontgl.h +++ b/indra/llrender/llfontgl.h @@ -214,7 +214,8 @@ public: static F32 sScaleX; static F32 sScaleY; static BOOL sDisplayFont ; - static std::string sAppDir; // For loading fonts + static std::string sFontDir; // For loading fonts + private: friend class LLFontRegistry; friend class LLTextBillboard; @@ -235,7 +236,6 @@ protected: // Registry holds all instantiated fonts. static LLFontRegistry* sFontRegistry; - }; #endif diff --git a/indra/llrender/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp index 98ee83193..7e11477e8 100644 --- a/indra/llrender/llfontregistry.cpp +++ b/indra/llrender/llfontregistry.cpp @@ -225,7 +225,7 @@ std::string currentOsName() return "Windows"; #elif LL_DARWIN return "Mac"; -#elif LL_SDL +#elif LL_SDL || LL_MESA_HEADLESS return "Linux"; #else return ""; @@ -426,7 +426,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) LLFontFreetype::font_vector_t fontlist; LLFontGL *result = NULL; - // Snarf all fonts we can into fontlistp. First will get pulled + // Snarf all fonts we can into fontlist. First will get pulled // off the list and become the "head" font, set to non-fallback. // Rest will consitute the fallback list. BOOL is_first_found = TRUE; @@ -441,7 +441,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) ++file_name_it) { LLFontGL *fontp = new LLFontGL; - std::string font_path = local_path + *file_name_it; + std::string font_path = gDirUtilp->add(local_path, *file_name_it); // *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; @@ -449,12 +449,12 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) if (!fontp->loadFace(font_path, extra_scale * point_size, LLFontGL::sVertDPI, LLFontGL::sHorizDPI, 2, is_fallback)) { - font_path = sys_path + *file_name_it; + font_path = gDirUtilp->add(sys_path, *file_name_it); if (!fontp->loadFace(font_path, extra_scale * point_size, LLFontGL::sVertDPI, LLFontGL::sHorizDPI, 2, is_fallback)) { - LL_INFOS_ONCE("LLFontRegistry") << "Couldn't load font " << *file_name_it << LL_ENDL; + LL_INFOS_ONCE("LLFontRegistry") << "Couldn't load font " << *file_name_it << " from path " << font_path << LL_ENDL; delete fontp; fontp = NULL; } @@ -491,6 +491,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) { LL_WARNS() << "createFont failed in some way" << LL_ENDL; } + mFontMap[norm_desc] = result; return result; } @@ -533,19 +534,19 @@ void LLFontRegistry::destroyGL() LLFontGL *LLFontRegistry::getFont(const LLFontDescriptor& orig_desc) { - LLFontDescriptor norm_desc = orig_desc.normalize(); + LLFontDescriptor desc = orig_desc.normalize(); - font_reg_map_t::iterator it = mFontMap.find(norm_desc); + font_reg_map_t::iterator it = mFontMap.find(desc); if (it != mFontMap.end()) return it->second; else { - LLFontGL *fontp = createFont(orig_desc); + LLFontGL *fontp = createFont(desc); if (!fontp) { - LL_WARNS() << "getFont failed, name " << orig_desc.getName() - <<" style=[" << ((S32) orig_desc.getStyle()) << "]" - << " size=[" << orig_desc.getSize() << "]" << LL_ENDL; + LL_WARNS() << "getFont failed, name " << desc.getName() + <<" style=[" << ((S32) desc.getStyle()) << "]" + << " size=[" << desc.getSize() << "]" << LL_ENDL; } return fontp; } diff --git a/indra/newview/fonts/DejaVuSansCondensed-Bold.ttf b/indra/newview/fonts/DejaVuSansCondensed-Bold.ttf deleted file mode 100644 index 9edd89c3d..000000000 Binary files a/indra/newview/fonts/DejaVuSansCondensed-Bold.ttf and /dev/null differ diff --git a/indra/newview/fonts/DejaVuSansCondensed.ttf b/indra/newview/fonts/DejaVuSansCondensed.ttf deleted file mode 100644 index 826e619b7..000000000 Binary files a/indra/newview/fonts/DejaVuSansCondensed.ttf and /dev/null differ diff --git a/indra/newview/fonts/DejaVuSansMono.ttf b/indra/newview/fonts/DejaVuSansMono.ttf deleted file mode 100644 index 19d188832..000000000 Binary files a/indra/newview/fonts/DejaVuSansMono.ttf and /dev/null differ diff --git a/indra/newview/fonts/DroidSans-Bold.ttf b/indra/newview/fonts/DroidSans-Bold.ttf deleted file mode 100644 index d065b64eb..000000000 Binary files a/indra/newview/fonts/DroidSans-Bold.ttf and /dev/null differ diff --git a/indra/newview/fonts/DroidSans.ttf b/indra/newview/fonts/DroidSans.ttf deleted file mode 100644 index ad1efca88..000000000 Binary files a/indra/newview/fonts/DroidSans.ttf and /dev/null differ diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index cbf54b892..a159713b4 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1635,6 +1635,17 @@ std::string LLViewerWindow::translateString(const char* tag, return LLTrans::getString( std::string(tag), args_copy); } +static const std::string font_dir() +{ + return gDirUtilp->getExecutableDir() + #if LL_DARWIN + + "../Resources/" + #elif !defined(LL_WINDOWS) + + "../" + #endif + ; +} + // // Classes // @@ -1803,7 +1814,7 @@ LLViewerWindow::LLViewerWindow( LLFontGL::initClass( gSavedSettings.getF32("FontScreenDPI"), mDisplayScale.mV[VX], mDisplayScale.mV[VY], - gDirUtilp->getAppRODataDir()); + font_dir()); } // Create container for all sub-views LLView::Params rvp; @@ -5473,7 +5484,8 @@ void LLViewerWindow::initFonts(F32 zoom_factor) LLFontGL::initClass( gSavedSettings.getF32("FontScreenDPI"), mDisplayScale.mV[VX] * zoom_factor, mDisplayScale.mV[VY] * zoom_factor, - gDirUtilp->getAppRODataDir()); + font_dir()); + // Force font reloads, which can be very slow LLFontGL::loadDefaultFonts(); } void LLViewerWindow::toggleFullscreen(BOOL show_progress) diff --git a/indra/newview/skins/default/xui/en-us/floater_inventory_view_finder.xml b/indra/newview/skins/default/xui/en-us/floater_inventory_view_finder.xml index 798d49417..0ac5ff196 100644 --- a/indra/newview/skins/default/xui/en-us/floater_inventory_view_finder.xml +++ b/indra/newview/skins/default/xui/en-us/floater_inventory_view_finder.xml @@ -2,7 +2,7 @@ + name="Inventory Finder" title="inventory_recent_items" width="168"> @@ -77,7 +77,7 @@ halign="center" height="20" label="None" label_selected="None" left="8" mouse_opaque="true" name="None" scale_image="true" width="100" /> Links: - + Any Only None diff --git a/indra/newview/skins/default/xui/en-us/floater_tools.xml b/indra/newview/skins/default/xui/en-us/floater_tools.xml index e4e2dac92..8af6defa7 100644 --- a/indra/newview/skins/default/xui/en-us/floater_tools.xml +++ b/indra/newview/skins/default/xui/en-us/floater_tools.xml @@ -189,8 +189,8 @@ font="SansSerifSmall" height="15" initial_value="true" label="Use Grid" left_delta="0" mouse_opaque="true" name="checkbox snap to grid" width="134" /> diff --git a/indra/newview/skins/default/xui/en-us/fonts.xml b/indra/newview/skins/default/xui/en-us/fonts.xml index 9ed679b43..a3899f239 100644 --- a/indra/newview/skins/default/xui/en-us/fonts.xml +++ b/indra/newview/skins/default/xui/en-us/fonts.xml @@ -3,8 +3,15 @@ DejaVuSansCondensed.ttf + NotoSansDisplay-Regular.ttf + SourceHanSansJP-Regular.otf + SourceHanSansKR-Regular.otf + SourceHanSansCN-Regular.otf + SourceHanSansHK-Regular.otf + SourceHanSansTW-Regular.otf YuGothR.ttc + meiryo.TTC MSGOTHIC.TTC gulim.ttc simhei.ttf @@ -22,14 +29,48 @@ - - DroidSans.ttf - - DroidSans-Bold.ttf + DejaVuSansCondensed-Bold.ttf + NotoSansDisplay-Bold.ttf + SourceHanSansJP-Bold.otf + SourceHanSansKR-Bold.otf + SourceHanSansCN-Bold.otf + SourceHanSansHK-Bold.otf + SourceHanSansTW-Bold.otf + + + + DroidSans.ttf + + + + DroidSans-Bold.ttf + DejaVuSansCondensed-Bold.ttf + NotoSansDisplay-Bold.ttf + SourceHanSansJP-Bold.otf + SourceHanSansKR-Bold.otf + SourceHanSansCN-Bold.otf + SourceHanSansHK-Bold.otf + SourceHanSansTW-Bold.otf + + + + DejaVuSansCondensed-Oblique.ttf + NotoSansDisplay-Italic.ttf + + + + DejaVuSansCondensed-BoldOblique.ttf + NotoSansDisplay-BoldItalic.ttf - DejaVuSans.ttf + DejaVuSansCondensed.ttf - DejaVuSansBold.ttf + DejaVuSansCondensed-Bold.ttf - DejaVuSansOblique.ttf + DejaVuSansCondensed-Oblique.ttf - DejaVuSansBoldOblique.ttf + DejaVuSansCondensed-BoldOblique.ttf - diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_system.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_system.xml index abdee1a6c..4d3b11bb4 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_system.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_system.xml @@ -117,7 +117,7 @@ Drop a landmark below to autoteleport there in the last 20 seconds before region restarts - Drop a backup landmark to autoteleport to below, should you already be at the above + Drop a backup landmark to autoteleport to below, should you already be at above diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml index 72d9b4c51..6dd9e25ae 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml @@ -17,7 +17,7 @@ Sound played when regions will restart: - + diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_general.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_general.xml index 52cb051d1..74e915cf9 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_general.xml @@ -1,6 +1,6 @@ - + My Home My Last Location @@ -28,7 +28,7 @@ - + Rating: I want to access content rated: diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_grids.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_grids.xml index d556bafed..ab5ef0ff5 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_grids.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_grids.xml @@ -66,7 +66,7 @@ follows="left|top|right" border_visible="false" mouse_opaque="false" drop_shadow_visible="true" border_drop_shadow_visible="false" />