summaryrefslogtreecommitdiffstats
path: root/filter
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2016-02-03 10:13:00 +1100
committerChris Sherlock <chris.sherlock79@gmail.com>2016-02-04 03:17:26 +0000
commit697d445ed0c7b60e463243db89af32e2145b475b (patch)
tree5a74d57cdc97f82bc78a686dee345a229a082a72 /filter
parentapparently breaks Win-x86@42 tinderbox... disable on Windows. (diff)
downloadcore-697d445ed0c7b60e463243db89af32e2145b475b.tar.gz
core-697d445ed0c7b60e463243db89af32e2145b475b.zip
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 'filter')
-rw-r--r--filter/source/flash/swfwriter1.cxx10
-rw-r--r--filter/source/flash/swfwriter2.cxx4
-rw-r--r--filter/source/graphicfilter/eps/eps.cxx4
-rw-r--r--filter/source/graphicfilter/idxf/dxf2mtf.cxx2
-rw-r--r--filter/source/graphicfilter/ios2met/ios2met.cxx2
-rw-r--r--filter/source/graphicfilter/ipict/ipict.cxx4
-rw-r--r--filter/source/msfilter/svdfppt.cxx2
-rw-r--r--filter/source/pdf/pdfexport.cxx6
-rw-r--r--filter/source/svg/svgfontexport.cxx2
-rw-r--r--filter/source/svg/svgwriter.cxx16
10 files changed, 26 insertions, 26 deletions
diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx
index 4c724285203b..2c98e937dc18 100644
--- a/filter/source/flash/swfwriter1.cxx
+++ b/filter/source/flash/swfwriter1.cxx
@@ -600,17 +600,17 @@ void Writer::Impl_writeText( const Point& rPos, const OUString& rText, const lon
double scale = 1.0;
// scale width if we have a stretched text
- if( 0 != aFont.GetSize().Width() )
+ if( 0 != aFont.GetFontSize().Width() )
{
vcl::Font aTmpFont( aFont );
- aTmpFont.SetWidth(0);
+ aTmpFont.SetAverageFontWidth(0);
mpVDev->SetFont( aTmpFont );
const FontMetric aMetric2( mpVDev->GetFontMetric() );
mpVDev->SetFont( aFont );
- const long n1 = aFont.GetSize().Width();
- const long n2 = aMetric2.GetSize().Width();
+ const long n1 = aFont.GetFontSize().Width();
+ const long n2 = aMetric2.GetFontSize().Width();
scale = (double)n1 / (double)n2;
}
@@ -618,7 +618,7 @@ void Writer::Impl_writeText( const Point& rPos, const OUString& rText, const lon
m.translate( double(aPt.X() / scale), double(aPt.Y()) );
m.scale( scale, scale );
- sal_Int16 nHeight = _Int16( map( Size( 0, aFont.GetHeight() ) ).Height() );
+ sal_Int16 nHeight = _Int16( map( Size( 0, aFont.GetFontHeight() ) ).Height() );
startTag( TAG_DEFINETEXT );
diff --git a/filter/source/flash/swfwriter2.cxx b/filter/source/flash/swfwriter2.cxx
index 6f668025db51..5c0c098b9072 100644
--- a/filter/source/flash/swfwriter2.cxx
+++ b/filter/source/flash/swfwriter2.cxx
@@ -480,8 +480,8 @@ sal_uInt16 FlashFont::getGlyph( sal_uInt16 nChar, VirtualDevice* pVDev )
for( n = 0; n < nSize; n++ )
{
Point aPoint( rPoly[n] );
- aPoint.X() = static_cast<long>((double(aPoint.X()) * 1024.0 ) / double(aOldFont.GetHeight()));
- aPoint.Y() = static_cast<long>((double(aPoint.Y()) * 1024.0 ) / double(aOldFont.GetHeight()));
+ aPoint.X() = static_cast<long>((double(aPoint.X()) * 1024.0 ) / double(aOldFont.GetFontHeight()));
+ aPoint.Y() = static_cast<long>((double(aPoint.Y()) * 1024.0 ) / double(aOldFont.GetFontHeight()));
rPoly[n] = aPoint;
}
Writer::Impl_addPolygon( maGlyphData, rPoly, true );
diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index aa0f76b9bf56..16edc2e77148 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -2184,7 +2184,7 @@ void PSWriter::ImplSetAttrForText( const Point& rPoint )
long nRotation = maFont.GetOrientation();
ImplWriteTextColor();
- Size aSize = maFont.GetSize();
+ Size aSize = maFont.GetFontSize();
if ( maLastFont != maFont )
{
@@ -2198,7 +2198,7 @@ void PSWriter::ImplSetAttrForText( const Point& rPoint )
ImplDefineFont( "Times", "Italic" );
maLastFont = maFont;
- aSize = maFont.GetSize();
+ aSize = maFont.GetFontSize();
ImplWriteDouble( aSize.Height() );
mpPS->WriteCharPtr( "sf " );
}
diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.cxx b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
index 521c85a619fa..70f89e8c92b8 100644
--- a/filter/source/graphicfilter/idxf/dxf2mtf.cxx
+++ b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
@@ -202,7 +202,7 @@ bool DXF2GDIMetaFile::SetFontAttribute(const DXFBasicEntity & rE, short nAngle,
aFont.SetColor(aColor);
aFont.SetTransparent(true);
aFont.SetFamily(FAMILY_SWISS);
- aFont.SetSize(Size(0,nHeight));
+ aFont.SetFontSize(Size(0,nHeight));
aFont.SetAlignment(ALIGN_BASELINE);
aFont.SetOrientation(nAngle);
if (aActFont!=aFont) {
diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx
index dd17524bb1b5..05ec943ec754 100644
--- a/filter/source/graphicfilter/ios2met/ios2met.cxx
+++ b/filter/source/graphicfilter/ios2met/ios2met.cxx
@@ -978,7 +978,7 @@ void OS2METReader::ReadChrStr(bool bGivenPos, bool bMove, bool bExtra, sal_uInt1
if (pF!=nullptr)
aFont = pF->aFont;
aFont.SetColor(aAttr.aChrCol);
- aFont.SetSize(Size(0,aAttr.aChrCellSize.Height()));
+ aFont.SetFontSize(Size(0,aAttr.aChrCellSize.Height()));
if ( aAttr.nChrAng != 0 )
aFont.SetOrientation(aAttr.nChrAng);
diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx
index 63ddfdbc2623..576aff5d2e28 100644
--- a/filter/source/graphicfilter/ipict/ipict.cxx
+++ b/filter/source/graphicfilter/ipict/ipict.cxx
@@ -1403,7 +1403,7 @@ sal_uLong PictReader::ReadData(sal_uInt16 nOpcode)
case 0x000d: // TxSize
{
pPict->ReadUInt16( nUSHORT );
- aActFont.SetSize( Size( 0, (long)nUSHORT ) );
+ aActFont.SetFontSize( Size( 0, (long)nUSHORT ) );
eActMethod=PDM_UNDEFINED;
nDataSize=2;
}
@@ -1873,7 +1873,7 @@ void PictReader::ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile )
aActFont.SetCharSet( GetTextEncoding());
aActFont.SetFamily(FAMILY_SWISS);
- aActFont.SetSize(Size(0,12));
+ aActFont.SetFontSize(Size(0,12));
aActFont.SetAlignment(ALIGN_BASELINE);
aHRes = aVRes = Fraction( 1, 1 );
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index a7a6b45b8b53..f36c3c2e0874 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -2153,7 +2153,7 @@ bool SdrPowerPointImport::ReadFontCollection()
aFont.SetFamilyName( pFont->aName );
aFont.SetFamily( pFont->eFamily );
aFont.SetPitch( pFont->ePitch );
- aFont.SetHeight( 100 );
+ aFont.SetFontHeight( 100 );
// following block is necessary, because our old PowerPoint export did not set the
// correct charset
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 889d09dee65d..eaa699b0edac 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -1074,14 +1074,14 @@ void PDFExport::ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSi
{
if (w == 0)
break;
- long nNewHeight = aFont.GetHeight() * nTextWidth / w;
- if( nNewHeight == aFont.GetHeight() )
+ long nNewHeight = aFont.GetFontHeight() * nTextWidth / w;
+ if( nNewHeight == aFont.GetFontHeight() )
{
nNewHeight--;
if( nNewHeight <= 0 )
break;
}
- aFont.SetHeight( nNewHeight );
+ aFont.SetFontHeight( nNewHeight );
pDev->SetFont( aFont );
}
long nTextHeight = pDev->GetTextHeight();
diff --git a/filter/source/svg/svgfontexport.cxx b/filter/source/svg/svgfontexport.cxx
index 6251db00a54a..ebc5513cd7b3 100644
--- a/filter/source/svg/svgfontexport.cxx
+++ b/filter/source/svg/svgfontexport.cxx
@@ -195,7 +195,7 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont )
ScopedVclPtrInstance< VirtualDevice > pVDev;
vcl::Font aFont( rFont );
- aFont.SetSize( Size( 0, nFontEM ) );
+ aFont.SetFontSize( Size( 0, nFontEM ) );
aFont.SetAlignment( ALIGN_BASELINE );
pVDev->SetMapMode( MAP_100TH_MM );
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 441197a56cb7..46b69d9e15fd 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -298,7 +298,7 @@ void SVGAttributeWriter::SetFontAttr( const vcl::Font& rFont )
// Font Size
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFontSize,
- OUString::number( rFont.GetHeight() ) + "px" );
+ OUString::number( rFont.GetFontHeight() ) + "px" );
// Font Style
if( rFont.GetItalic() != ITALIC_NONE )
@@ -475,9 +475,9 @@ void SVGTextWriter::implSetCurrentFont()
maCurrentFont = mpVDev->GetFont();
Size aSz;
- implMap( Size( 0, maCurrentFont.GetHeight() ), aSz );
+ implMap( Size( 0, maCurrentFont.GetFontHeight() ), aSz );
- maCurrentFont.SetHeight( aSz.Height() );
+ maCurrentFont.SetFontHeight( aSz.Height() );
}
else
{
@@ -730,12 +730,12 @@ void SVGTextWriter::addFontAttributes( bool bIsTextContainer )
if( maCurrentFont != maParentFont )
{
const OUString& rsCurFontName = maCurrentFont.GetFamilyName();
- long int nCurFontSize = maCurrentFont.GetHeight();
+ long int nCurFontSize = maCurrentFont.GetFontHeight();
FontItalic eCurFontItalic = maCurrentFont.GetItalic();
FontWeight eCurFontWeight = maCurrentFont.GetWeight();
const OUString& rsParFontName = maParentFont.GetFamilyName();
- long int nParFontSize = maParentFont.GetHeight();
+ long int nParFontSize = maParentFont.GetFontHeight();
FontItalic eParFontItalic = maParentFont.GetItalic();
FontWeight eParFontWeight = maParentFont.GetWeight();
@@ -1606,7 +1606,7 @@ void SVGTextWriter::implWriteTextPortion( const Point& rPos,
{
sId += ".bp";
BulletListItemInfo& aBulletListItemInfo = maBulletListItemMap[ sId ];
- aBulletListItemInfo.nFontSize = rFont.GetHeight();
+ aBulletListItemInfo.nFontSize = rFont.GetFontHeight();
aBulletListItemInfo.aColor = aTextColor;
aBulletListItemInfo.aPos = maTextPos;
aBulletListItemInfo.cBulletChar = mcBulletChar;
@@ -3592,9 +3592,9 @@ vcl::Font SVGActionWriter::ImplSetCorrectFontHeight() const
vcl::Font aFont( mpVDev->GetFont() );
Size aSz;
- ImplMap( Size( 0, aFont.GetHeight() ), aSz );
+ ImplMap( Size( 0, aFont.GetFontHeight() ), aSz );
- aFont.SetHeight( aSz.Height() );
+ aFont.SetFontHeight( aSz.Height() );
return aFont;
}