summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2016-12-16 09:16:29 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2016-12-16 21:37:06 +0000
commita813623240ac9614c8b2b8b890b9eb83663c72c1 (patch)
tree2d257285b6918a7ffe8a2e39ccc6a744a5e5d6f1
parent83675eeb30c92a17dd272894df34b89628de0142 (diff)
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. Reviewed-on: https://gerrit.libreoffice.org/32068 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org> (cherry picked from commit ab291ac3b8576a086cab60ffb64d60b046a271a2) Change-Id: Ia4bb426a21804517d3ec313ab7494ba121c5751b Reviewed-on: https://gerrit.libreoffice.org/32094 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
-rw-r--r--vcl/source/gdi/CommonSalLayout.cxx5
-rw-r--r--vcl/win/gdi/winlayout.cxx16
2 files changed, 9 insertions, 12 deletions
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 8ab8eb3abf9c..521d17806f9e 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -19,6 +19,9 @@
#include "CommonSalLayout.hxx"
+#if defined(_WIN32)
+#include <vcl/opengl/OpenGLHelper.hxx>
+#endif
#include <vcl/unohelp.hxx>
#include <scrptrun.h>
#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
@@ -195,7 +198,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 2d351758b2c6..cefe4b1b9edc 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3341,19 +3341,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)
{
@@ -3363,6 +3353,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;