vcl/win/gdi/salfont.cxx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
New commits: commit 5d39c2013374727b1c8f147b8b99d54402a7ff02 Author: Khaled Hosny <khaledho...@eglug.org> Date: Wed Nov 2 01:37:21 2016 +0200 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 diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index 8d6f065..d0c00a6 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);
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits