[Libreoffice-commits] core.git: vcl/win
Khaled Hosny
khaledhosny at eglug.org
Tue Nov 1 23:42:25 UTC 2016
vcl/win/gdi/salfont.cxx | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
New commits:
commit 5d39c2013374727b1c8f147b8b99d54402a7ff02
Author: Khaled Hosny <khaledhosny at 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);
More information about the Libreoffice-commits
mailing list