diff options
author | Noel Grandin <noel@peralex.com> | 2020-09-21 15:47:31 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-10-27 10:35:20 +0100 |
commit | df49ea498788d1c7fb440504f3a17ca9f4d82c13 (patch) | |
tree | f56f7c9f43a6a37e206edbcef65d90b3bf46daf0 /vcl | |
parent | 36f307d8472fdeb19d03746794ebb2b8fcec907f (diff) |
tdf#127047 fix printing very large font sizes to pdf
The clamping of font sizes was done in #i47675 and #i95867
to deal with issues in the Windows font libraries which are
presumably no longer a problem.
Change-Id: I124a3ff746953ce4d7d934506e76e6d0cba48307
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103113
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104817
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/win/salgdi.h | 2 | ||||
-rw-r--r-- | vcl/win/gdi/salfont.cxx | 31 | ||||
-rw-r--r-- | vcl/win/gdi/winlayout.cxx | 2 |
3 files changed, 5 insertions, 30 deletions
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index 5fe6645e7d2c..83c6b6f2d8d1 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -184,7 +184,7 @@ private: bool DrawCachedGlyphs(const GenericSalLayout& rLayout); public: - HFONT ImplDoSetFont(FontSelectPattern const & i_rFont, const PhysicalFontFace * i_pFontFace, float& o_rFontScale, HFONT& o_rOldFont); + HFONT ImplDoSetFont(FontSelectPattern const & i_rFont, const PhysicalFontFace * i_pFontFace, HFONT& o_rOldFont); HDC getHDC() const { return mhLocalDC; } void setHDC(HDC aNew) { mhLocalDC = aNew; } diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index ce1a8bd610a0..1ed293888b2c 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -65,8 +65,6 @@ using namespace vcl; -static const int MAXFONTHEIGHT = 2048; - static FIXED FixedFromDouble( double d ) { const long l = static_cast<long>( d * 65536. ); @@ -846,7 +844,6 @@ void ImplGetLogFontFromFontSelect( HDC hDC, HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern const & i_rFont, const PhysicalFontFace * i_pFontFace, - float& o_rFontScale, HFONT& o_rOldFont) { HFONT hNewFont = nullptr; @@ -854,25 +851,6 @@ HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern const & i_rFont, LOGFONTW aLogFont; ImplGetLogFontFromFontSelect( getHDC(), i_rFont, i_pFontFace, aLogFont ); - // #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 ); - } hNewFont = ::CreateFontIndirectW( &aLogFont ); HDC hdcScreen = nullptr; @@ -1579,9 +1557,8 @@ bool WinSalGraphics::CreateFontSubset( const OUString& rToFile, // TODO: much better solution: move SetFont and restoration of old font to caller ScopedFont aOldFont(*this); - float fScale = 1.0; HFONT hOldFont = nullptr; - ImplDoSetFont(aIFSD, pFont, fScale, hOldFont); + ImplDoSetFont(aIFSD, pFont, hOldFont); WinFontFace const * pWinFontData = static_cast<WinFontFace const *>(pFont); @@ -1698,9 +1675,8 @@ const void* WinSalGraphics::GetEmbedFontData(const PhysicalFontFace* pFont, long ScopedFont aOldFont(*this); - float fScale = 0.0; HFONT hOldFont = nullptr; - ImplDoSetFont(aIFSD, pFont, fScale, hOldFont); + ImplDoSetFont(aIFSD, pFont, hOldFont); // get the raw font file data RawFontData aRawFontData( getHDC() ); @@ -1729,9 +1705,8 @@ void WinSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont, // TODO: much better solution: move SetFont and restoration of old font to caller ScopedFont aOldFont(*this); - float fScale = 0.0; HFONT hOldFont = nullptr; - ImplDoSetFont(aIFSD, pFont, fScale, hOldFont); + ImplDoSetFont(aIFSD, pFont, hOldFont); // get raw font file data const RawFontData xRawFontData( getHDC() ); diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index 884b1be6e670..0565409212bb 100644 --- a/vcl/win/gdi/winlayout.cxx +++ b/vcl/win/gdi/winlayout.cxx @@ -448,7 +448,7 @@ void WinFontInstance::SetGraphics(WinSalGraphics *pGraphics) if (m_hFont) return; HFONT hOrigFont; - m_hFont = m_pGraphics->ImplDoSetFont(GetFontSelectPattern(), GetFontFace(), m_fScale, hOrigFont); + m_hFont = m_pGraphics->ImplDoSetFont(GetFontSelectPattern(), GetFontFace(), hOrigFont); SelectObject(m_pGraphics->getHDC(), hOrigFont); } |