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

Khaled Hosny khaledhosny at eglug.org
Fri Dec 16 14:57:53 UTC 2016


 vcl/source/gdi/CommonSalLayout.cxx |    3 ++-
 vcl/win/gdi/winlayout.cxx          |   16 +++++-----------
 2 files changed, 7 insertions(+), 12 deletions(-)

New commits:
commit ab291ac3b8576a086cab60ffb64d60b046a271a2
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Fri Dec 16 09:16:29 2016 +0200

    tdf#104159: Fix caching glyphs of non-UI fonts
    
    Partially reverts "tdf#103725: Fix horizontal scaling on Windows",
    which didn't work on newer Windows versions anyway.
    
    This reverts commit a5750d92b2136d60d698b41ef5760f2efac0ffce.
    
    Change-Id: Ia4bb426a21804517d3ec313ab7494ba121c5751b
    Reviewed-on: https://gerrit.libreoffice.org/32068
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index d68534f..af8ebfa 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -19,6 +19,7 @@
 
 #include "CommonSalLayout.hxx"
 
+#include <vcl/opengl/OpenGLHelper.hxx>
 #include <vcl/unohelp.hxx>
 #include <scrptrun.h>
 #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
@@ -195,7 +196,7 @@ CommonSalLayout::CommonSalLayout(HDC hDC, WinFontInstance& rWinFontInstance, con
     }
 
     // Calculate the mnAveWidthFactor, see the comment where it is used.
-    if (mrFontSelData.mnWidth)
+    if (mrFontSelData.mnWidth && ! OpenGLHelper::isVCLOpenGLEnabled())
     {
         double nUPEM = hb_face_get_upem(hb_font_get_face(mpHbFont));
 
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 57ac16f..b60ce1b 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -496,19 +496,9 @@ std::vector<Rectangle> D2DWriteTextOutRenderer::GetGlyphInkBoxes(uint16_t * pGid
 bool D2DWriteTextOutRenderer::GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** ppFontFace, float * lfSize) const
 {
     bool succeeded = false;
-    IDWriteFont* pFont;
-
-    LOGFONTW aLogFont;
-    HFONT hFont = static_cast<HFONT>(::GetCurrentObject(hDC, OBJ_FONT));
-    GetObjectW(hFont, sizeof(LOGFONTW), &aLogFont);
     try
     {
-        succeeded = SUCCEEDED(mpGdiInterop->CreateFontFromLOGFONT(&aLogFont, &pFont));
-        if (succeeded)
-        {
-            succeeded = SUCCEEDED(pFont->CreateFontFace(ppFontFace));
-            pFont->Release();
-        }
+        succeeded = SUCCEEDED(mpGdiInterop->CreateFontFaceFromHdc(hDC, ppFontFace));
     }
     catch (const std::exception& e)
     {
@@ -518,6 +508,10 @@ bool D2DWriteTextOutRenderer::GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** p
 
     if (succeeded)
     {
+        LOGFONTW aLogFont;
+        HFONT hFont = static_cast<HFONT>(::GetCurrentObject(hDC, OBJ_FONT));
+
+        GetObjectW(hFont, sizeof(LOGFONTW), &aLogFont);
         float dpix, dpiy;
         mpRT->GetDpi(&dpix, &dpiy);
         *lfSize = aLogFont.lfHeight * 96.0f / dpiy;


More information about the Libreoffice-commits mailing list