From 05566ce7a7e1895a5b3ab2f9df2587dac63429e1 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Sun, 27 Oct 2019 16:41:38 +0200 Subject: Font debugging aid to dump descriptors + individual textures --- indra/llrender/llfontbitmapcache.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llrender/llfontbitmapcache.h') 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; } -- cgit v1.2.3 From 9cfdb278de30e4a22d5d38fd08305fd40a905d80 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Mon, 28 Oct 2019 23:40:41 +0200 Subject: Support for COLR/CPAL fonts --- indra/llrender/llfontbitmapcache.h | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'indra/llrender/llfontbitmapcache.h') diff --git a/indra/llrender/llfontbitmapcache.h b/indra/llrender/llfontbitmapcache.h index 7e0e905756..f68af0d2b6 100644 --- a/indra/llrender/llfontbitmapcache.h +++ b/indra/llrender/llfontbitmapcache.h @@ -30,6 +30,13 @@ #include #include "lltrace.h" +enum class EFontGlyphType : U32 +{ + Grayscale = 0, + Color, + Count +}; + // Maintain a collection of bitmaps containing rendered glyphs. // Generalizes the single-bitmap logic from LLFontFreetype and LLFontGL. class LLFontBitmapCache : public LLTrace::MemTrackable @@ -39,36 +46,35 @@ public: ~LLFontBitmapCache(); // Need to call this once, before caching any glyphs. - void init(S32 num_components, - S32 max_char_width, + void init(S32 max_char_width, S32 max_char_height); void reset(); - BOOL nextOpenPos(S32 width, S32 &posX, S32 &posY, S32 &bitmapNum); + BOOL nextOpenPos(S32 width, S32& posX, S32& posY, EFontGlyphType bitmapType, U32& bitmapNum); void destroyGL(); - LLImageRaw *getImageRaw(U32 bitmapNum = 0) const; - LLImageGL *getImageGL(U32 bitmapNum = 0) const; - + LLImageRaw* getImageRaw(EFontGlyphType bitmapType, U32 bitmapNum) const; + LLImageGL* getImageGL(EFontGlyphType bitmapType, U32 bitmapNum) const; + S32 getMaxCharWidth() const { return mMaxCharWidth; } - S32 getNumBitmaps() const { return mImageRawVec.size(); } - S32 getNumComponents() const { return mNumComponents; } + U32 getNumBitmaps(EFontGlyphType bitmapType) const { return (bitmapType < EFontGlyphType::Count) ? mImageRawVec[static_cast(bitmapType)].size() : 0; } S32 getBitmapWidth() const { return mBitmapWidth; } S32 getBitmapHeight() const { return mBitmapHeight; } +protected: + static U32 getNumComponents(EFontGlyphType bitmap_type); + private: - S32 mNumComponents; S32 mBitmapWidth; S32 mBitmapHeight; - S32 mBitmapNum; + S32 mCurrentOffsetX[static_cast(EFontGlyphType::Count)]; + S32 mCurrentOffsetY[static_cast(EFontGlyphType::Count)]; S32 mMaxCharWidth; S32 mMaxCharHeight; - S32 mCurrentOffsetX; - S32 mCurrentOffsetY; - std::vector > mImageRawVec; - std::vector > mImageGLVec; + std::vector> mImageRawVec[static_cast(EFontGlyphType::Count)]; + std::vector> mImageGLVec[static_cast(EFontGlyphType::Count)]; }; #endif //LL_LLFONTBITMAPCACHE_H -- cgit v1.2.3 From 418308bc7ce4e9924d6280f784222ba45172eea4 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Wed, 6 Nov 2019 12:34:26 +0100 Subject: Characters can have more than one representation in LLFontFreetype * By default all viewer text will use B/W glyphs * Added temporary use_color attribute to LLTextBase for testing --- indra/llrender/llfontbitmapcache.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llrender/llfontbitmapcache.h') diff --git a/indra/llrender/llfontbitmapcache.h b/indra/llrender/llfontbitmapcache.h index f68af0d2b6..5d0094fd69 100644 --- a/indra/llrender/llfontbitmapcache.h +++ b/indra/llrender/llfontbitmapcache.h @@ -34,7 +34,8 @@ enum class EFontGlyphType : U32 { Grayscale = 0, Color, - Count + Count, + Unspecified, }; // Maintain a collection of bitmaps containing rendered glyphs. -- cgit v1.2.3 From bab70f6f152952ce755188d29bea1cfd8821a4be Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Mon, 29 Aug 2022 00:00:31 +0200 Subject: Review + resolve minor issues --- indra/llrender/llfontbitmapcache.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/llrender/llfontbitmapcache.h') diff --git a/indra/llrender/llfontbitmapcache.h b/indra/llrender/llfontbitmapcache.h index 5d0094fd69..6b339e9afd 100644 --- a/indra/llrender/llfontbitmapcache.h +++ b/indra/llrender/llfontbitmapcache.h @@ -68,12 +68,12 @@ protected: static U32 getNumComponents(EFontGlyphType bitmap_type); private: - S32 mBitmapWidth; - S32 mBitmapHeight; - S32 mCurrentOffsetX[static_cast(EFontGlyphType::Count)]; - S32 mCurrentOffsetY[static_cast(EFontGlyphType::Count)]; - S32 mMaxCharWidth; - S32 mMaxCharHeight; + S32 mBitmapWidth = 0; + S32 mBitmapHeight = 0; + S32 mCurrentOffsetX[static_cast(EFontGlyphType::Count)] = { 1 }; + S32 mCurrentOffsetY[static_cast(EFontGlyphType::Count)] = { 1 }; + S32 mMaxCharWidth = 0; + S32 mMaxCharHeight = 0; std::vector> mImageRawVec[static_cast(EFontGlyphType::Count)]; std::vector> mImageGLVec[static_cast(EFontGlyphType::Count)]; }; -- cgit v1.2.3