vcl/source/gdi/CommonSalLayout.cxx | 6 ------ vcl/win/gdi/salfont.cxx | 37 +++++++++++++++++-------------------- vcl/win/gdi/winlayout.cxx | 16 +++++----------- 3 files changed, 22 insertions(+), 37 deletions(-)
New commits: commit ea95ced269dceb72681f0e4a21d87499153d5781 Author: Khaled Hosny <khaledho...@eglug.org> Date: Sun Nov 13 22:54:58 2016 +0200 Revert "tdf#103725: Fix horizontal scaling on Windows" This reverts commit 30fefcf71417f8c8644f5c0d3cb28c8c7f92a6c7. Thuough it works on my system, others report that it made things worse. A better fix is comming, hopefully. diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index a6536f1..1031b9c 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -95,13 +95,7 @@ void CommonSalLayout::getScale(double* nXScale, double* nYScale) unsigned int nUPEM = hb_face_get_upem(pHbFace); double nHeight(mrFontSelData.mnHeight); -#if defined(_WIN32) - // FIXME: we get very weird font width on Windows, the number below is - // âreverse engineeredâ so that I get the width Iâm expecting. - double nWidth(mrFontSelData.mnWidth ? mrFontSelData.mnWidth * 1.8285 : nHeight); -#else double nWidth(mrFontSelData.mnWidth ? mrFontSelData.mnWidth : nHeight); -#endif if (nYScale) *nYScale = nHeight / nUPEM; diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index 7f41fdd..f290bdd 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -1106,27 +1106,24 @@ HFONT WinSalGraphics::ImplDoSetFont( FontSelectPattern* i_pFont, float& o_rFontS LOGFONTW aLogFont; ImplGetLogFontFromFontSelect( getHDC(), i_pFont, aLogFont, true ); - if (!SalLayout::UseCommonLayout()) + // #i47675# limit font requests to MAXFONTHEIGHT + // TODO: share MAXFONTHEIGHT font instance + if( (-aLogFont.lfHeight <= MAXFONTHEIGHT) + && (+aLogFont.lfWidth <= MAXFONTHEIGHT) ) { - // #i47675# limit font requests to MAXFONTHEIGHT - // TODO: share MAXFONTHEIGHT font instance - if( (-aLogFont.lfHeight <= MAXFONTHEIGHT) - && (+aLogFont.lfWidth <= MAXFONTHEIGHT) ) - { - o_rFontScale = 1.0; - } - else if( -aLogFont.lfHeight >= +aLogFont.lfWidth ) - { - o_rFontScale = -aLogFont.lfHeight / (float)MAXFONTHEIGHT; - aLogFont.lfHeight = -MAXFONTHEIGHT; - aLogFont.lfWidth = FRound( aLogFont.lfWidth / o_rFontScale ); - } - else // #i95867# also limit font widths - { - o_rFontScale = +aLogFont.lfWidth / (float)MAXFONTHEIGHT; - aLogFont.lfWidth = +MAXFONTHEIGHT; - aLogFont.lfHeight = FRound( aLogFont.lfHeight / o_rFontScale ); - } + o_rFontScale = 1.0; + } + else if( -aLogFont.lfHeight >= +aLogFont.lfWidth ) + { + o_rFontScale = -aLogFont.lfHeight / (float)MAXFONTHEIGHT; + aLogFont.lfHeight = -MAXFONTHEIGHT; + aLogFont.lfWidth = FRound( aLogFont.lfWidth / o_rFontScale ); + } + else // #i95867# also limit font widths + { + o_rFontScale = +aLogFont.lfWidth / (float)MAXFONTHEIGHT; + aLogFont.lfWidth = +MAXFONTHEIGHT; + aLogFont.lfHeight = FRound( aLogFont.lfHeight / o_rFontScale ); } hNewFont = ::CreateFontIndirectW( &aLogFont ); diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index 335bb8c..b7882e3 100644 --- a/vcl/win/gdi/winlayout.cxx +++ b/vcl/win/gdi/winlayout.cxx @@ -3599,19 +3599,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) { @@ -3621,6 +3611,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;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits