summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@aliftype.com>2022-09-05 19:36:25 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2022-09-06 07:19:57 +0200
commite75631211b596df3997f6fe6eb5422b931bd0384 (patch)
tree5e6040071c9545a738f4b6c50b5eba2842d5a26e
parentfeb8d07333544ff2206489b786b7af30744d014a (diff)
vcl: Create HFNT on WinFontFace when needed
I’m seeing frequent CI failures with warnings like: warn:sfx.appl:13336:18148:sfx2/source/appl/app.cxx:147: No DDE-Service possible. Error: 16399 warn:vcl:13336:18148:vcl/win/gdi/salvd.cxx:99: CreateCompatibleDC failed: There are no more files. Lets see if this is causing us to hit the GDI object limit. Change-Id: I1257ac7e701277814b5d17b40192ad3bc81a8e0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139449 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--vcl/inc/win/salgdi.h2
-rw-r--r--vcl/win/gdi/salfont.cxx7
2 files changed, 5 insertions, 4 deletions
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index ef7cdf210c94..b107308ec10b 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -80,7 +80,7 @@ private:
BYTE mnPitchAndFamily;
bool mbAliasSymbolsHigh;
bool mbAliasSymbolsLow;
- HFONT mhFont;
+ LOGFONTW maLogFont;
};
/** Class that creates (and destroys) a compatible Device Context.
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 7614bbf4390c..200780426a5b 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -586,7 +586,7 @@ WinFontFace::WinFontFace(const ENUMLOGFONTEXW& rEnumFont, const NEWTEXTMETRICW&
mnPitchAndFamily(rMetric.tmPitchAndFamily),
mbAliasSymbolsHigh( false ),
mbAliasSymbolsLow( false ),
- mhFont(CreateFontIndirectW(&rEnumFont.elfLogFont))
+ maLogFont(rEnumFont.elfLogFont)
{
if (meWinCharSet == SYMBOL_CHARSET)
{
@@ -612,7 +612,6 @@ WinFontFace::WinFontFace(const ENUMLOGFONTEXW& rEnumFont, const NEWTEXTMETRICW&
WinFontFace::~WinFontFace()
{
- DeleteFont(mhFont);
}
sal_IntPtr WinFontFace::GetFontId() const
@@ -686,7 +685,8 @@ hb_blob_t* WinFontFace::GetHbTable(hb_tag_t nTag) const
unsigned char* pBuffer = nullptr;
HDC hDC(::GetDC(nullptr));
- HFONT hOldFont = ::SelectFont(hDC, mhFont);
+ HFONT hFont = ::CreateFontIndirectW(&maLogFont);
+ HFONT hOldFont = ::SelectFont(hDC, hFont);
nLength = ::GetFontData(hDC, OSL_NETDWORD(nTag), 0, nullptr, 0);
if (nLength > 0 && nLength != GDI_ERROR)
@@ -696,6 +696,7 @@ hb_blob_t* WinFontFace::GetHbTable(hb_tag_t nTag) const
}
::SelectFont(hDC, hOldFont);
+ ::DeleteFont(hFont);
::ReleaseDC(nullptr, hDC);
hb_blob_t* pBlob = nullptr;