New Fonts to complain about!
Thanks Drake! Tweaks panels to look good now that font is slightly wider
This commit is contained in:
@@ -31,11 +31,8 @@
|
||||
|
||||
// Freetype stuff
|
||||
#include <ft2build.h>
|
||||
|
||||
// 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);
|
||||
|
||||
@@ -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 <boost/tokenizer.hpp>
|
||||
|
||||
#if LL_WINDOWS
|
||||
#include "llwin32headerslean.h"
|
||||
#include <shlobj.h>
|
||||
#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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user