summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2020-09-21 15:47:31 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-10-19 12:20:44 +0200
commit6137de745606e9ccee94119fd1f8b7a90c4aa323 (patch)
tree8aa5891b84fa2710a8c518dcbcb1b77e968b5da0 /vcl
parenta3f93ced82f8d4d122468cc4a1c4298141d67507 (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>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/win/salgdi.h2
-rw-r--r--vcl/win/gdi/salfont.cxx31
-rw-r--r--vcl/win/gdi/winlayout.cxx2
3 files changed, 5 insertions, 30 deletions
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index a717286737c0..bec473b296b4 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 3f6082a6b92d..f37ae89a00a8 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -65,8 +65,6 @@
using namespace vcl;
-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);
@@ -1645,9 +1622,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() );
@@ -1676,9 +1652,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 3438e3b79deb..feda998d5759 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);
}