-Font init cleanup. Now has a dedicated position in startup initilization.
This commit is contained in:
@@ -125,31 +125,6 @@ bool findOrCreateFont(LLFontGL*& fontp, const LLFontDescriptor& desc)
|
||||
return (fontp != NULL);
|
||||
}
|
||||
|
||||
// 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 create_gl_textures)
|
||||
{
|
||||
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,create_gl_textures);
|
||||
sFontRegistry->parseFontInfo("fonts.xml");
|
||||
}
|
||||
else
|
||||
{
|
||||
sFontRegistry->reset();
|
||||
}
|
||||
|
||||
return loadDefaultFonts();
|
||||
}
|
||||
|
||||
void LLFontGL::destroyGL()
|
||||
{
|
||||
@@ -956,6 +931,27 @@ void LLFontGL::removeEmbeddedChar( llwchar wc ) const
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFontGL::initClass(F32 screen_dpi, F32 x_scale, F32 y_scale, const std::string& app_dir, const std::vector<std::string>& xui_paths, bool create_gl_textures)
|
||||
{
|
||||
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,create_gl_textures);
|
||||
sFontRegistry->parseFontInfo("fonts.xml");
|
||||
}
|
||||
else
|
||||
{
|
||||
sFontRegistry->reset();
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
@@ -90,15 +90,9 @@ public:
|
||||
LLFontGL();
|
||||
~LLFontGL();
|
||||
|
||||
void init(); // Internal init, or reinitialization
|
||||
|
||||
void reset(); // Reset a font after GL cleanup. ONLY works on an already loaded font.
|
||||
|
||||
|
||||
static BOOL initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale,
|
||||
const std::string& app_dir,
|
||||
const std::vector<std::string>& xui_paths,
|
||||
bool create_gl_textures = true);
|
||||
|
||||
void destroyGL();
|
||||
|
||||
/* virtual*/ BOOL loadFace(const std::string& filename, const F32 point_size, const F32 vert_dpi, const F32 horz_dpi, const S32 components, BOOL is_fallback);
|
||||
@@ -173,6 +167,8 @@ public:
|
||||
void addEmbeddedChar( llwchar wc, LLTexture* image, const LLWString& label) const;
|
||||
void removeEmbeddedChar( llwchar wc ) const;
|
||||
|
||||
static void initClass(F32 screen_dpi, F32 x_scale, F32 y_scale, const std::string& app_dir, const std::vector<std::string>& xui_paths, bool create_gl_textures = true);
|
||||
|
||||
// Load sans-serif, sans-serif-small, etc.
|
||||
// Slow, requires multiple seconds to load fonts.
|
||||
static bool loadDefaultFonts();
|
||||
|
||||
@@ -1987,10 +1987,18 @@ bool idle_startup()
|
||||
if (STATE_MULTIMEDIA_INIT == LLStartUp::getStartupState())
|
||||
{
|
||||
LLStartUp::multimediaInit();
|
||||
LLStartUp::setStartupState( STATE_SEED_GRANTED_WAIT );
|
||||
LLStartUp::setStartupState( STATE_FONT_INIT );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Loading fonts takes several seconds
|
||||
if (STATE_FONT_INIT == LLStartUp::getStartupState())
|
||||
{
|
||||
LLStartUp::fontInit();
|
||||
LLStartUp::setStartupState( STATE_SEED_GRANTED_WAIT );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Wait for Seed Cap Grant
|
||||
//---------------------------------------------------------------------
|
||||
@@ -3757,6 +3765,7 @@ std::string LLStartUp::startupStateToString(EStartupState state)
|
||||
RTNENUM( STATE_LOGIN_DOWNLOADING );
|
||||
RTNENUM( STATE_LOGIN_PROCESS_RESPONSE );
|
||||
RTNENUM( STATE_WORLD_INIT );
|
||||
RTNENUM( STATE_FONT_INIT );
|
||||
RTNENUM( STATE_SEED_GRANTED_WAIT );
|
||||
RTNENUM( STATE_SEED_CAP_GRANTED );
|
||||
RTNENUM( STATE_WORLD_WAIT );
|
||||
@@ -3831,6 +3840,15 @@ void LLStartUp::multimediaInit()
|
||||
LLViewerParcelMedia::initClass();
|
||||
}
|
||||
|
||||
void LLStartUp::fontInit()
|
||||
{
|
||||
LL_DEBUGS("AppInit") << "Initializing fonts...." << LL_ENDL;
|
||||
std::string msg = LLTrans::getString("LoginInitializingFonts");
|
||||
set_startup_status(0.45f, msg.c_str(), gAgent.mMOTD.c_str());
|
||||
display_startup();
|
||||
|
||||
LLFontGL::loadDefaultFonts();
|
||||
}
|
||||
|
||||
void LLStartUp::initNameCache()
|
||||
{
|
||||
|
||||
@@ -61,6 +61,7 @@ typedef enum {
|
||||
STATE_LOGIN_PROCESS_RESPONSE, // Check authentication reply
|
||||
STATE_WORLD_INIT, // Start building the world
|
||||
STATE_MULTIMEDIA_INIT, // Init the rest of multimedia library
|
||||
STATE_FONT_INIT, // Load default fonts
|
||||
STATE_SEED_GRANTED_WAIT, // Wait for seed cap grant
|
||||
STATE_SEED_CAP_GRANTED, // Have seed cap grant
|
||||
STATE_WORLD_WAIT, // Waiting for simulator
|
||||
@@ -95,6 +96,8 @@ public:
|
||||
static void multimediaInit();
|
||||
// Initialize LLViewerMedia multimedia engine.
|
||||
|
||||
// Load default fonts not already loaded at start screen
|
||||
static void fontInit();
|
||||
|
||||
static void initNameCache();
|
||||
|
||||
|
||||
@@ -1541,14 +1541,19 @@ LLViewerWindow::LLViewerWindow(
|
||||
LLViewerTextureManager::init() ;
|
||||
gBumpImageList.init();
|
||||
|
||||
// Create container for all sub-views
|
||||
mRootView = new LLRootView("root", mWindowRectScaled, FALSE);
|
||||
|
||||
// Init font system, but don't actually load the fonts yet
|
||||
// because our window isn't onscreen and they take several
|
||||
// seconds to parse.
|
||||
if (!gNoRender)
|
||||
{
|
||||
// Init default fonts
|
||||
initFonts();
|
||||
LLFontGL::initClass( gSavedSettings.getF32("FontScreenDPI"),
|
||||
mDisplayScale.mV[VX],
|
||||
mDisplayScale.mV[VY],
|
||||
gDirUtilp->getAppRODataDir(),
|
||||
LLUICtrlFactory::getXUIPaths());
|
||||
}
|
||||
// Create container for all sub-views
|
||||
mRootView = new LLRootView("root", mWindowRectScaled, FALSE);
|
||||
|
||||
// Make avatar head look forward at start
|
||||
mCurrentMousePoint.mX = getWindowWidthScaled() / 2;
|
||||
@@ -4828,11 +4833,13 @@ void LLViewerWindow::restoreGL(const std::string& progress_message)
|
||||
void LLViewerWindow::initFonts(F32 zoom_factor)
|
||||
{
|
||||
LLFontGL::destroyAllGL();
|
||||
LLFontGL::initDefaultFonts( gSavedSettings.getF32("FontScreenDPI"),
|
||||
// Initialize with possibly different zoom factor
|
||||
LLFontGL::initClass( gSavedSettings.getF32("FontScreenDPI"),
|
||||
mDisplayScale.mV[VX] * zoom_factor,
|
||||
mDisplayScale.mV[VY] * zoom_factor,
|
||||
gDirUtilp->getAppRODataDir(),
|
||||
LLUICtrlFactory::getXUIPaths());
|
||||
LLFontGL::loadDefaultFonts();
|
||||
}
|
||||
void LLViewerWindow::toggleFullscreen(BOOL show_progress)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<string name="LoginPrecaching">Loading world...</string>
|
||||
<string name="LoginInitializingBrowser">Initializing embedded web browser...</string>
|
||||
<string name="LoginInitializingMultimedia">Initializing multimedia...</string>
|
||||
<string name="LoginInitializingFonts">Loading fonts...</string>
|
||||
<string name="LoginVerifyingCache">Verifying cache files (can take 60-90 seconds)...</string>
|
||||
<string name="LoginProcessingResponse">Processing Response...</string>
|
||||
<string name="LoginInitializingWorld">Initializing World...</string>
|
||||
|
||||
Reference in New Issue
Block a user