summaryrefslogtreecommitdiff
path: root/vcl/win
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2016-11-02 01:37:21 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2016-11-02 01:37:21 +0200
commit5d39c2013374727b1c8f147b8b99d54402a7ff02 (patch)
tree9d3f1eedebfc690e2b3d83a2aecfd0b040a283d8 /vcl/win
parent3f04f3f08b4ea58648ad06555405117098415de7 (diff)
tdf#71603: Create a new DC for the font fallback
For some reason re-using the DC from SalGraphics results in GetFontData() returning GDI_ERROR and we fail to read the font’s “cmap” table. The wired thing is that this happens only for fonts that were not used before, so if you open a document directly the fallback works but if you open start center or blank Writer document you get no fallback. GDI is “interesting”. Change-Id: Ic23095cabbd2623717271ce5d89bea75dca76a9a
Diffstat (limited to 'vcl/win')
-rw-r--r--vcl/win/gdi/salfont.cxx16
1 files changed, 10 insertions, 6 deletions
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 8d6f0656b1fa..d0c00a63a4d5 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -146,7 +146,15 @@ class WinGlyphFallbackSubstititution
: public ImplGlyphFallbackFontSubstitution
{
public:
- explicit WinGlyphFallbackSubstititution( HDC );
+ explicit WinGlyphFallbackSubstititution()
+ {
+ mhDC = GetDC(nullptr);
+ };
+
+ ~WinGlyphFallbackSubstititution()
+ {
+ ReleaseDC(nullptr, mhDC);
+ };
bool FindFontSubstitute( FontSelectPattern&, OUString& rMissingChars ) const override;
private:
@@ -154,10 +162,6 @@ private:
bool HasMissingChars(PhysicalFontFace*, OUString& rMissingChars) const;
};
-inline WinGlyphFallbackSubstititution::WinGlyphFallbackSubstititution( HDC hDC )
-: mhDC( hDC )
-{}
-
// does a font face hold the given missing characters?
bool WinGlyphFallbackSubstititution::HasMissingChars(PhysicalFontFace* pFace, OUString& rMissingChars) const
{
@@ -1677,7 +1681,7 @@ void WinSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection )
SalEnumFontsProcExW, reinterpret_cast<LPARAM>(&aInfo), 0 );
// set glyph fallback hook
- static WinGlyphFallbackSubstititution aSubstFallback( getHDC() );
+ static WinGlyphFallbackSubstititution aSubstFallback;
static WinPreMatchFontSubstititution aPreMatchFont;
pFontCollection->SetFallbackHook( &aSubstFallback );
pFontCollection->SetPreMatchHook(&aPreMatchFont);