[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/win
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Sep 20 15:43:56 UTC 2018
vcl/win/gdi/salfont.cxx | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
New commits:
commit fbc3818a70bad11f2b28d005d97c3491a41f711e
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Sep 4 17:24:03 2018 +0200
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Sep 20 17:43:30 2018 +0200
tdf#119340 WIN don't always re-init the HFONT
After all the LogicalFontInstance refactoring, its FontSelectData
is now immutable, so the HFONT will never need to be changed.
Therefore we can skip the HFONT lookup in WinSalGraphics::SetFont,
if the WinFontInstance already has it set.
All the HFONT handling (basically WinSalGraphics::ImplDoSetFont)
should be moved to the WinFontInstance to further clean this up.
Reviewed-on: https://gerrit.libreoffice.org/59988
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
(cherry picked from commit 7e7a1ff3926e86705199aa9814089e90f01c02ed)
Conflicts:
vcl/win/gdi/salfont.cxx
Change-Id: I1c9a9e3414677d77f0f007d7ace653bb53b8474d
Reviewed-on: https://gerrit.libreoffice.org/60721
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index ae0042706e04..81c8d3a92628 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -857,11 +857,6 @@ HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern const * i_pFont,
g_BoundRectCache.clear();
HFONT hNewFont = nullptr;
- HDC hdcScreen = nullptr;
- if( mbVirDev )
- // only required for virtual devices, see below for details
- hdcScreen = GetDC(nullptr);
-
LOGFONTW aLogFont;
ImplGetLogFontFromFontSelect( getHDC(), i_pFont, i_pFontFace, aLogFont );
@@ -884,8 +879,12 @@ HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern const * i_pFont,
aLogFont.lfWidth = +MAXFONTHEIGHT;
aLogFont.lfHeight = FRound( aLogFont.lfHeight / o_rFontScale );
}
-
hNewFont = ::CreateFontIndirectW( &aLogFont );
+
+ HDC hdcScreen = nullptr;
+ if( mbVirDev )
+ // only required for virtual devices, see below for details
+ hdcScreen = GetDC(nullptr);
if( hdcScreen )
{
// select font into screen hdc first to get an antialiased font
@@ -957,7 +956,15 @@ void WinSalGraphics::SetFont( const FontSelectPattern* pFont, int nFallbackLevel
mpWinFontEntry[ nFallbackLevel ] = reinterpret_cast<WinFontInstance*>( pFont->mpFontInstance );
HFONT hOldFont = nullptr;
- HFONT hNewFont = ImplDoSetFont(pFont, nullptr, mfFontScale[ nFallbackLevel ], hOldFont);
+ HFONT hNewFont = mpWinFontEntry[ nFallbackLevel ] ? mpWinFontEntry[ nFallbackLevel ]->GetHFONT() : nullptr;
+ if (!hNewFont)
+ {
+ hNewFont = ImplDoSetFont(pFont->GetFontSelectPattern(), pFont->GetFontFace(), mfFontScale[ nFallbackLevel ], hOldFont);
+ mpWinFontEntry[ nFallbackLevel ]->SetHFONT(hNewFont);
+ }
+ else
+ hOldFont = ::SelectFont( getHDC(), hNewFont );
+
mfCurrentFontScale = mfFontScale[nFallbackLevel];
if( !mhDefFont )
@@ -986,7 +993,6 @@ void WinSalGraphics::SetFont( const FontSelectPattern* pFont, int nFallbackLevel
// store new font in correct layer
if (mpWinFontEntry[nFallbackLevel])
{
- mpWinFontEntry[nFallbackLevel]->SetHFONT(hNewFont);
// now the font is live => update font face
const WinFontFace* pFontFace = static_cast<const WinFontFace*>(mpWinFontEntry[nFallbackLevel]->GetFontFace());
pFontFace->UpdateFromHDC(getHDC());
More information about the Libreoffice-commits
mailing list