// static BOOL LLFontGL::initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale, const std::string& app_dir, const std::vector<std::string>& xui_paths) { bool succ = true; sVertDPI = (F32)llfloor(screen_dpi * y_scale); sHorizDPI = (F32)llfloor(screen_dpi * x_scale); sScaleX = x_scale; sScaleY = y_scale; sAppDir = app_dir; // Font registry init if (!sFontRegistry) { sFontRegistry = new LLFontRegistry(xui_paths); sFontRegistry->parseFontInfo("fonts.xml"); } else { sFontRegistry->reset(); } // Force standard fonts to get generated up front. // This is primarily for error detection purposes. succ &= (NULL != getFontSansSerifSmall()); succ &= (NULL != getFontSansSerif()); succ &= (NULL != getFontSansSerifBig()); succ &= (NULL != getFontSansSerifHuge()); succ &= (NULL != getFontSansSerifBold()); succ &= (NULL != getFontMonospace()); succ &= (NULL != getFontExtChar()); return succ; }
// static LLFontGL* LLFontGL::getFontByName(const std::string& name) { // check for most common fonts first if (name == "SANSSERIF") { return getFontSansSerif(); } else if (name == "SANSSERIF_SMALL") { return getFontSansSerifSmall(); } else if (name == "SANSSERIF_BIG") { return getFontSansSerifBig(); } else if (name == "SMALL" || name == "OCRA") { // *BUG: Should this be "MONOSPACE"? Do we use "OCRA" anymore? // Does "SMALL" mean "SERIF"? return getFontMonospace(); } else { return NULL; } }
// Force standard fonts to get generated up front. // This is primarily for error detection purposes. // Don't do this during initClass because it can be slow and we want to get // the viewer window on screen first. JC // static bool LLFontGL::loadDefaultFonts() { bool succ = true; succ &= (NULL != getFontSansSerifSmall()); succ &= (NULL != getFontSansSerif()); succ &= (NULL != getFontSansSerifBig()); succ &= (NULL != getFontSansSerifHuge()); succ &= (NULL != getFontSansSerifBold()); succ &= (NULL != getFontMonospace()); succ &= (NULL != getFontExtChar()); return succ; }