From b8e4f9515e2ede004646eb24c2ba5c0cf6b95e89 Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Wed, 11 Feb 2015 16:06:33 -0800 Subject: [PATCH] Fix setTextFormat() font update (legacy) --- legacy/project/src/common/TextField.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/legacy/project/src/common/TextField.cpp b/legacy/project/src/common/TextField.cpp index 63825bece..245476267 100644 --- a/legacy/project/src/common/TextField.cpp +++ b/legacy/project/src/common/TextField.cpp @@ -2186,7 +2186,20 @@ void CharGroup::ApplyFormat(TextFormat *inFormat) inFormat->bold.Apply(mFormat->bold); inFormat->bullet.Apply(mFormat->bullet); inFormat->color.Apply(mFormat->color); + + Font* cacheFont = mFont; + WString cacheFontName = mFormat->font.Get(); + inFormat->font.Apply(mFormat->font); + + if (cacheFontName != mFormat->font.Get()) + { + mFont = 0; + mFontHeight = 0; + mFlags = 0; + if (cacheFont) cacheFont->DecRef(); + } + inFormat->indent.Apply(mFormat->indent); inFormat->italic.Apply(mFormat->italic); inFormat->kerning.Apply(mFormat->kerning);