diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2016-02-03 10:13:00 +1100 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2016-02-04 03:17:26 +0000 |
commit | 697d445ed0c7b60e463243db89af32e2145b475b (patch) | |
tree | 5a74d57cdc97f82bc78a686dee345a229a082a72 /vcl/source/filter | |
parent | 91a7580e03d5b47c6e2513afce85ddee45e730b6 (diff) |
vcl: take into account the font width is the average font width
I'm changing the Font class function names:
- SetSize -> SetFontSize
- GetSize -> GetFontSize
- SetHeight -> SetFontHeight
- GetHeight -> GetFontHeight
- SetWidth -> SetAverageFontWidth
- GetWidth -> GetAverageFontWidth
That's because it really makes no sense to say that there is a
single constant font width because obviously proportional fonts
don't have one - the best we can do is an average font width,
which is what folks like Microsoft sort of do already. On a fixed
font, the average is still accurate, for obvious reasons :-)
I'm also not a fan of GetSize/SetSize as I find it a might too
generic.
Change-Id: Ib80a604ba62d6883fd6cbc7994da763976be5c70
Reviewed-on: https://gerrit.libreoffice.org/22069
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Diffstat (limited to 'vcl/source/filter')
-rw-r--r-- | vcl/source/filter/sgvtext.cxx | 4 | ||||
-rw-r--r-- | vcl/source/filter/wmf/emfwr.cxx | 4 | ||||
-rw-r--r-- | vcl/source/filter/wmf/winmtf.cxx | 18 | ||||
-rw-r--r-- | vcl/source/filter/wmf/wmfwr.cxx | 2 |
4 files changed, 14 insertions, 14 deletions
diff --git a/vcl/source/filter/sgvtext.cxx b/vcl/source/filter/sgvtext.cxx index 837e44482739..25e8decb6ea6 100644 --- a/vcl/source/filter/sgvtext.cxx +++ b/vcl/source/filter/sgvtext.cxx @@ -524,9 +524,9 @@ sal_uInt16 SetTextContext(OutputDevice& rOut, ObjTextType& Atr, bool Kapt, sal_u } Brei=Brei*sal_uLong(Atr.Breite)/100; Brei=Brei*sal_uLong(StdBrei)/100; - aFont.SetSize(Size(hPoint2Sgf(sal_uInt16(Brei)),hPoint2Sgf(sal_uInt16(Grad)))); + aFont.SetFontSize(Size(hPoint2Sgf(sal_uInt16(Brei)),hPoint2Sgf(sal_uInt16(Grad)))); } else { - aFont.SetSize(Size(0,hPoint2Sgf(sal_uInt16(Grad)))); + aFont.SetFontSize(Size(0,hPoint2Sgf(sal_uInt16(Grad)))); } aColor=Sgv2SvFarbe(Atr.L.LFarbe,Atr.L.LBFarbe,Atr.L.LIntens); aFont.SetColor(aColor); diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx index ab2d7a8a6c8b..b400a344b821 100644 --- a/vcl/source/filter/wmf/emfwr.cxx +++ b/vcl/source/filter/wmf/emfwr.cxx @@ -511,8 +511,8 @@ void EMFWriter::ImplCheckTextAttr() ImplBeginRecord( WIN_EMR_EXTCREATEFONTINDIRECTW ); m_rStm.WriteUInt32( mnTextHandle ); - ImplWriteExtent( -rFont.GetSize().Height() ); - ImplWriteExtent( rFont.GetSize().Width() ); + ImplWriteExtent( -rFont.GetFontSize().Height() ); + ImplWriteExtent( rFont.GetFontSize().Width() ); m_rStm.WriteInt32( rFont.GetOrientation() ).WriteInt32( rFont.GetOrientation() ); switch( rFont.GetWeight() ) diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx index 3ff2d3b5c2e4..55601721ca5a 100644 --- a/vcl/source/filter/wmf/winmtf.cxx +++ b/vcl/source/filter/wmf/winmtf.cxx @@ -238,7 +238,7 @@ WinMtfFontStyle::WinMtfFontStyle( LOGFONTW& rFont ) SolarMutexGuard aGuard; ScopedVclPtrInstance< VirtualDevice > pVDev; // converting the cell height into a font height - aFont.SetSize( aFontSize ); + aFont.SetFontSize( aFontSize ); pVDev->SetFont( aFont ); FontMetric aMetric( pVDev->GetFontMetric() ); long nHeight = aMetric.GetAscent() + aMetric.GetDescent(); @@ -252,7 +252,7 @@ WinMtfFontStyle::WinMtfFontStyle( LOGFONTW& rFont ) // Convert height to positive aFontSize.Height() = std::abs(aFontSize.Height()); - aFont.SetSize(aFontSize); + aFont.SetFontSize(aFontSize); }; WinMtf::WinMtf( WinMtfOutput* pWinMtfOutput, SvStream& rStreamWMF, FilterConfigItem* pConfigItem ) @@ -482,12 +482,12 @@ void WinMtfOutput::ImplMap( vcl::Font& rFont ) { // !!! HACK: we now always set the width to zero because the OS width is interpreted differently; // must later be made portable in SV (KA 1996-02-08) - Size aFontSize = ImplMap (rFont.GetSize(), false); + Size aFontSize = ImplMap (rFont.GetFontSize(), false); if( aFontSize.Height() < 0 ) aFontSize.Height() *= -1; - rFont.SetSize( aFontSize ); + rFont.SetFontSize( aFontSize ); if( ( mnWinExtX * mnWinExtY ) < 0 ) rFont.SetOrientation( 3600 - rFont.GetOrientation() ); @@ -687,8 +687,8 @@ void WinMtfOutput::CreateObject( GDIObjectType eType, void* pStyle ) if ( eType == GDI_FONT ) { WinMtfFontStyle* pFontStyle = static_cast<WinMtfFontStyle*>(pStyle); - if (pFontStyle->aFont.GetHeight() == 0) - pFontStyle->aFont.SetHeight(423); + if (pFontStyle->aFont.GetFontHeight() == 0) + pFontStyle->aFont.SetFontHeight(423); ImplMap(pFontStyle->aFont); // defaulting to 12pt } else if ( eType == GDI_PEN ) @@ -721,8 +721,8 @@ void WinMtfOutput::CreateObject( sal_Int32 nIndex, GDIObjectType eType, void* pS if ( eType == GDI_FONT ) { WinMtfFontStyle* pFontStyle = static_cast<WinMtfFontStyle*>(pStyle); - if (pFontStyle->aFont.GetHeight() == 0) - pFontStyle->aFont.SetHeight(423); + if (pFontStyle->aFont.GetFontHeight() == 0) + pFontStyle->aFont.SetFontHeight(423); ImplMap(pFontStyle->aFont); } else if ( eType == GDI_PEN ) @@ -858,7 +858,7 @@ WinMtfOutput::WinMtfOutput( GDIMetaFile& rGDIMetaFile ) : maFont.SetFamilyName( "Arial" ); // sj: #i57205#, we do have some scaling problems if using maFont.SetCharSet( RTL_TEXTENCODING_MS_1252 ); // the default font then most times a x11 font is used, we - maFont.SetHeight( 423 ); // will prevent this defining a font + maFont.SetFontHeight( 423 ); // will prevent this defining a font maLatestLineStyle.aLineColor = Color( 0x12, 0x34, 0x56 ); maLatestFillStyle.aFillColor = Color( 0x12, 0x34, 0x56 ); diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx index 72830fbbbeda..79f56f0fa09d 100644 --- a/vcl/source/filter/wmf/wmfwr.cxx +++ b/vcl/source/filter/wmf/wmfwr.cxx @@ -312,7 +312,7 @@ void WMFWriter::WMFRecord_CreateFontIndirect(const vcl::Font & rFont) sal_uInt8 nPitchFamily; WriteRecordHeader(0x00000000,W_META_CREATEFONTINDIRECT); - WriteHeightWidth(Size(rFont.GetSize().Width(),-rFont.GetSize().Height())); + WriteHeightWidth(Size(rFont.GetFontSize().Width(),-rFont.GetFontSize().Height())); pWMF->WriteInt16( rFont.GetOrientation() ).WriteInt16( rFont.GetOrientation() ); switch (rFont.GetWeight()) { |