[Libreoffice-commits] core.git: vcl/win

Khaled Hosny khaledhosny at eglug.org
Sat May 12 18:00:46 UTC 2018


 vcl/win/gdi/salfont.cxx   |    1 +
 vcl/win/gdi/winlayout.cxx |    3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit e8d48dd75a1bb31b5bc500bc79fb80384a09bcc6
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Sat May 12 15:11:10 2018 +0200

    Fixup 23c5125148a8110d88385b29570bf0b7d4400458
    
    It was asserting for me at startup on Windows.
    
    Change-Id: I81d7b0dd58fd912c5fc255c3a7fa0878e841737e
    Reviewed-on: https://gerrit.libreoffice.org/54160
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index e1c26ed902a2..2d6512154e2a 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -997,6 +997,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int nFa
     const RawFontData aHheaRawData(getHDC(), nHheaTag);
     const RawFontData aOS2RawData(getHDC(), nOS2Tag);
 
+    mpWinFontEntry[nFallbackLevel]->SetHDC(getHDC());
     rxFontMetric->SetMinKashida(mpWinFontEntry[nFallbackLevel]->GetKashidaWidth());
 
     // get the font metric
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 95034c97372b..656681a46a8a 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -342,7 +342,7 @@ static hb_blob_t* getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pU
 hb_font_t* WinFontInstance::ImplInitHbFont()
 {
     assert(m_hDC);
-    m_hFont = static_cast<HFONT>(GetCurrentObject(m_hDC, OBJ_FONT));
+    assert(m_hFont);
     hb_font_t* pHbFont = InitHbFont(hb_face_create_for_tables(getFontTable, m_hFont, nullptr));
 
     // Calculate the AverageWidthFactor, see LogicalFontInstance::GetScale().
@@ -378,6 +378,7 @@ void WinFontInstance::SetHDC(const HDC hDC)
         return;
     ReleaseHbFont();
     m_hDC = hDC;
+    m_hFont = static_cast<HFONT>(GetCurrentObject(m_hDC, OBJ_FONT));
 }
 
 bool WinSalGraphics::CacheGlyphs(const GenericSalLayout& rLayout)


More information about the Libreoffice-commits mailing list