diff options
author | Kitty Barnett <develop@catznip.com> | 2019-10-27 16:41:38 +0200 |
---|---|---|
committer | Kitty Barnett <develop@catznip.com> | 2019-10-27 16:41:38 +0200 |
commit | 05566ce7a7e1895a5b3ab2f9df2587dac63429e1 (patch) | |
tree | d74096c225ee496a8ecc57c7864d1eb6767773eb /indra/llrender/llfontfreetype.cpp | |
parent | 4e2b2f662ad3f7b2e09f9451227bbf7018d91708 (diff) |
Font debugging aid to dump descriptors + individual textures
Diffstat (limited to 'indra/llrender/llfontfreetype.cpp')
-rw-r--r-- | indra/llrender/llfontfreetype.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
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; |