summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/source/gdi/CommonSalLayout.cxx3
-rw-r--r--vcl/win/gdi/winlayout.cxx16
2 files changed, 7 insertions, 12 deletions
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index d68534fcedce..af8ebfa55898 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 57ac16f8f8d6..b60ce1b4a54f 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;