diff options
| -rw-r--r-- | indra/llrender/llfontbitmapcache.h | 1 | ||||
| -rw-r--r-- | indra/llrender/llfontfreetype.cpp | 33 | ||||
| -rw-r--r-- | indra/llrender/llfontfreetype.h | 1 | ||||
| -rw-r--r-- | indra/llrender/llfontgl.cpp | 20 | ||||
| -rw-r--r-- | indra/llrender/llfontgl.h | 4 | ||||
| -rw-r--r-- | indra/llrender/llfontregistry.cpp | 11 | ||||
| -rw-r--r-- | indra/llrender/llfontregistry.h | 1 | ||||
| -rw-r--r-- | indra/newview/llviewermenu.cpp | 4 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/menu_login.xml | 26 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 12 | 
10 files changed, 113 insertions, 0 deletions
diff --git a/indra/llrender/llfontbitmapcache.h b/indra/llrender/llfontbitmapcache.h index 75df3a94a7..7e0e905756 100644 --- a/indra/llrender/llfontbitmapcache.h +++ b/indra/llrender/llfontbitmapcache.h @@ -53,6 +53,7 @@ public:   	LLImageGL *getImageGL(U32 bitmapNum = 0) const;  	S32 getMaxCharWidth() const { return mMaxCharWidth; } +	S32 getNumBitmaps() const { return mImageRawVec.size(); }  	S32 getNumComponents() const { return mNumComponents; }  	S32 getBitmapWidth() const { return mBitmapWidth; }  	S32 getBitmapHeight() const { return mBitmapHeight; } diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index c41730ebaa..78bc6ac433 100644 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -40,8 +40,10 @@  #include FT_FREETYPE_H  #endif +#include "lldir.h"  #include "llerror.h"  #include "llimage.h" +#include "llimagepng.h"  //#include "llimagej2c.h"  #include "llmath.h"	// Linden math  #include "llstring.h" @@ -657,6 +659,37 @@ const std::string &LLFontFreetype::getName() const  	return mName;  } +static void dumpFontBitmap(const LLImageRaw* image_raw, const std::string& file_name) +{ +	LLPointer<LLImagePNG> tmpImage = new LLImagePNG(); +	if ( (tmpImage->encode(image_raw, 0.0f)) && (tmpImage->save(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, file_name))) ) +	{ +		LL_INFOS("Font") << "Successfully saved " << file_name << LL_ENDL; +	} +	else +	{ +		LL_WARNS("Font") << "Failed to save " << file_name << LL_ENDL; +	} +} + +void LLFontFreetype::dumpFontBitmaps() const +{ +	// Dump all the regular bitmaps +	for (int idx = 0, cnt = mFontBitmapCachep->getNumBitmaps(); idx < cnt; idx++) +	{ +		dumpFontBitmap(mFontBitmapCachep->getImageRaw(idx), llformat("%s_%d_%d_%d.png", mFTFace->family_name, (int)(mPointSize * 10), mStyle, idx)); +	} + +//	// Dump all the color bitmaps (if any) +//	if (mFontColorBitmapCachep) +//	{ +//		for (int idxBitmap = 0, cntBitmap = mFontColorBitmapCachep->getNumBitmaps(); idxBitmap < cntBitmap; idxBitmap++) +//		{ +//			dumpFontBitmap(mFontColorBitmapCachep->getImageRaw(idxBitmap), llformat("%s_%d_%d_clr_%d.png", mFTFace->family_name, (int)mPointSize, mStyle, idxBitmap)); +//		} +//	} +} +  const LLFontBitmapCache* LLFontFreetype::getFontBitmapCache() const  {  	return mFontBitmapCachep; diff --git a/indra/llrender/llfontfreetype.h b/indra/llrender/llfontfreetype.h index 1afe84e770..a25cc18fcf 100644 --- a/indra/llrender/llfontfreetype.h +++ b/indra/llrender/llfontfreetype.h @@ -143,6 +143,7 @@ public:  	const std::string& getName() const; +	void       dumpFontBitmaps() const;  	const LLFontBitmapCache* getFontBitmapCache() const;  	void setStyle(U8 style); diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 86a4c35e6d..990a3e8281 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -831,6 +831,26 @@ void LLFontGL::initClass(F32 screen_dpi, F32 x_scale, F32 y_scale, const std::st  	}  } +void LLFontGL::dumpTextures() +{ +	if (mFontFreetype.notNull()) +	{ +		mFontFreetype->dumpFontBitmaps(); +	} +} + +// static +void LLFontGL::dumpFonts() +{ +	sFontRegistry->dump(); +} + +// static +void LLFontGL::dumpFontTextures() +{ +	sFontRegistry->dumpTextures(); +} +  // 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 diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h index 10891faed9..b1a433f97d 100644 --- a/indra/llrender/llfontgl.h +++ b/indra/llrender/llfontgl.h @@ -163,6 +163,10 @@ public:  	static void initClass(F32 screen_dpi, F32 x_scale, F32 y_scale, const std::string& app_dir, bool create_gl_textures = true); +	       void dumpTextures(); +	static void dumpFonts(); +	static void dumpFontTextures(); +  	// Load sans-serif, sans-serif-small, etc.  	// Slow, requires multiple seconds to load fonts.  	static bool loadDefaultFonts(); diff --git a/indra/llrender/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp index dbe71e2882..5ab2ab046e 100644 --- a/indra/llrender/llfontregistry.cpp +++ b/indra/llrender/llfontregistry.cpp @@ -721,6 +721,17 @@ void LLFontRegistry::dump()  	}  } +void LLFontRegistry::dumpTextures() +{ +	for (const auto& fontEntry : mFontMap) +	{ +		if (fontEntry.second) +		{ +			fontEntry.second->dumpTextures(); +		} +	} +} +  const string_vec_t& LLFontRegistry::getUltimateFallbackList() const   {   	return mUltimateFallbackList; diff --git a/indra/llrender/llfontregistry.h b/indra/llrender/llfontregistry.h index e30c81c630..b1259ef4e7 100644 --- a/indra/llrender/llfontregistry.h +++ b/indra/llrender/llfontregistry.h @@ -94,6 +94,7 @@ public:  	bool nameToSize(const std::string& size_name, F32& size);  	void dump(); +	void dumpTextures();  	const string_vec_t& getUltimateFallbackList() const; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 52b2c631fa..f99cbedcbe 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -9121,6 +9121,10 @@ void initialize_menus()  	//Develop (clear cache immediately)  	commit.add("Develop.ClearCache", boost::bind(&handle_cache_clear_immediately) ); +	// Develop (Fonts debugging) +	commit.add("Develop.Fonts.Dump", boost::bind(&LLFontGL::dumpFonts)); +	commit.add("Develop.Fonts.DumpTextures", boost::bind(&LLFontGL::dumpFontTextures)); +  	// Admin >Object  	view_listener_t::addMenu(new LLAdminForceTakeCopy(), "Admin.ForceTakeCopy");  	view_listener_t::addMenu(new LLAdminHandleObjectOwnerSelf(), "Admin.HandleObjectOwnerSelf"); diff --git a/indra/newview/skins/default/xui/en/menu_login.xml b/indra/newview/skins/default/xui/en/menu_login.xml index 07b3cc3bd8..93795be474 100644 --- a/indra/newview/skins/default/xui/en/menu_login.xml +++ b/indra/newview/skins/default/xui/en/menu_login.xml @@ -168,6 +168,32 @@        <menu_item_separator />        <menu         create_jump_keys="true" +       label="Fonts" +       name="Fonts" +       tear_off="true"> +        <menu_item_call +         label="Show Font Test" +         name="Show Font Test"> +          <menu_item_call.on_click +           function="Floater.Show" +           parameter="font_test" /> +        </menu_item_call> +        <menu_item_separator /> +        <menu_item_call +         label="Dump Fonts" +         name="Dump Fonts"> +          <menu_item_call.on_click +           function="Develop.Fonts.Dump" /> +        </menu_item_call> +        <menu_item_call +         label="Dump Font Textures" +         name="Dump Font Textures"> +          <menu_item_call.on_click +           function="Develop.Fonts.DumpTextures" /> +        </menu_item_call> +      </menu> +      <menu +       create_jump_keys="true"         label="UI Tests"         name="UI Tests"         tear_off="true"> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 7bb7b5d62c..d92e633e87 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3195,6 +3195,18 @@               parameter="https://cryptic-ridge-1632.herokuapp.com/"/>            </menu_item_call>            <menu_item_call +           label="Dump Fonts" +           name="Dump Fonts"> +            <menu_item_call.on_click +             function="Develop.Fonts.Dump" /> +          </menu_item_call> +          <menu_item_call +           label="Dump Font Textures" +           name="Dump Font Textures"> +            <menu_item_call.on_click +             function="Develop.Fonts.DumpTextures" /> +          </menu_item_call> +          <menu_item_call               label="Dump SelectMgr"               name="Dump SelectMgr">                  <menu_item_call.on_click  | 
