[Libreoffice-commits] core.git: vcl/inc vcl/source
Chris Sherlock
chris.sherlock79 at gmail.com
Fri Jan 22 16:14:09 PST 2016
vcl/inc/impfont.hxx | 5 +++++
vcl/source/font/font.cxx | 34 +++++++++++++++++-----------------
2 files changed, 22 insertions(+), 17 deletions(-)
New commits:
commit e418d1a9c87ce01b75141f92dc249c7fb1a1bdcb
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date: Sat Jan 23 03:57:34 2016 +1100
vcl: add size property to the ImplFont class
I'm adding size getters and setters to the ImplFont class. But
size is a font *metric*, so surely this should be in
ImplFontMetric? Something I'm going to have to look into soon so
that I can harmonize these classesi with ImplFontMetricData and
FontAttributes, then eventually merge them.
See commit description in 8bfccd3a71d911b6d ("vcl: Create accessor
and mutator for font scaling in FontMetric") for reasoning behind
patch.
Unit test added to vcl/qa/cppunit/font.cxx to test this flag.
Change-Id: I4a7ef39ffb60257b428757f54aa6487bfdd8c86c
Reviewed-on: https://gerrit.libreoffice.org/21721
Reviewed-by: Chris Sherlock <chris.sherlock79 at gmail.com>
Tested-by: Chris Sherlock <chris.sherlock79 at gmail.com>
diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx
index d3bc42c..ccd061a 100644
--- a/vcl/inc/impfont.hxx
+++ b/vcl/inc/impfont.hxx
@@ -84,6 +84,11 @@ public:
void SetSubsettableFlag( bool bSubsettable ) { mbSubsettable = bSubsettable; }
void SetOrientationFlag( bool bCanRotate ) { mbRotatable = bCanRotate; }
+ // Metric data
+ const Size& GetFontSize() const { return maSize; }
+
+ void SetFontSize( const Size& rSize ) { maSize = rSize; }
+
bool operator==( const ImplFont& ) const;
private:
diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx
index 8efdd1e..dafc812 100644
--- a/vcl/source/font/font.cxx
+++ b/vcl/source/font/font.cxx
@@ -58,24 +58,24 @@ Font::Font( const vcl::Font& rFont )
Font::Font( const OUString& rFamilyName, const Size& rSize )
{
- mpImplFont = new ImplFont;
+ mpImplFont = new ImplFont;
mpImplFont->SetFamilyName( rFamilyName );
- mpImplFont->maSize = rSize;
+ mpImplFont->SetFontSize( rSize );
}
Font::Font( const OUString& rFamilyName, const OUString& rStyleName, const Size& rSize )
{
- mpImplFont = new ImplFont;
+ mpImplFont = new ImplFont;
mpImplFont->SetFamilyName( rFamilyName );
- mpImplFont->maStyleName = rStyleName;
- mpImplFont->maSize = rSize;
+ mpImplFont->SetStyleName( rStyleName );
+ mpImplFont->SetFontSize( rSize );
}
Font::Font( FontFamily eFamily, const Size& rSize )
{
- mpImplFont = new ImplFont;
- mpImplFont->meFamily = eFamily;
- mpImplFont->maSize = rSize;
+ mpImplFont = new ImplFont;
+ mpImplFont->SetFamilyType( eFamily );
+ mpImplFont->SetFontSize( rSize );
}
Font::~Font()
@@ -151,19 +151,19 @@ void Font::SetStyleName( const OUString& rStyleName )
void Font::SetSize( const Size& rSize )
{
- if( mpImplFont->maSize != rSize )
+ if( mpImplFont->GetFontSize() != rSize )
{
MakeUnique();
- mpImplFont->maSize = rSize;
+ mpImplFont->SetFontSize( rSize );
}
}
void Font::SetFamily( FontFamily eFamily )
{
- if( mpImplFont->meFamily != eFamily )
+ if( mpImplFont->GetFamilyType() != eFamily )
{
MakeUnique();
- mpImplFont->meFamily = eFamily;
+ mpImplFont->SetFamilyType( eFamily );
}
}
@@ -520,7 +520,7 @@ SvStream& WriteImplFont( SvStream& rOStm, const ImplFont& rImplFont )
{
VersionCompat aCompat( rOStm, StreamMode::WRITE, 3 );
rOStm.WriteUniOrByteString( rImplFont.GetFamilyName(), rOStm.GetStreamCharSet() );
- rOStm.WriteUniOrByteString( rImplFont.maStyleName, rOStm.GetStreamCharSet() );
+ rOStm.WriteUniOrByteString( rImplFont.GetStyleName(), rOStm.GetStreamCharSet() );
WritePair( rOStm, rImplFont.maSize );
rOStm.WriteUInt16( GetStoreCharSet( rImplFont.GetCharSet() ) );
@@ -782,10 +782,10 @@ const OUString& Font::GetFamilyName() const { return mpImplFont->GetFamilyName()
const OUString& Font::GetStyleName() const { return mpImplFont->maStyleName; }
const Size& Font::GetSize() const { return mpImplFont->maSize; }
-void Font::SetHeight( long nHeight ) { SetSize( Size( mpImplFont->maSize.Width(), nHeight ) ); }
-long Font::GetHeight() const { return mpImplFont->maSize.Height(); }
-void Font::SetWidth( long nWidth ) { SetSize( Size( nWidth, mpImplFont->maSize.Height() ) ); }
-long Font::GetWidth() const { return mpImplFont->maSize.Width(); }
+void Font::SetHeight( long nHeight ) { SetSize( Size( mpImplFont->GetFontSize().Width(), nHeight ) ); }
+long Font::GetHeight() const { return mpImplFont->GetFontSize().Height(); }
+void Font::SetWidth( long nWidth ) { SetSize( Size( nWidth, mpImplFont->GetFontSize().Height() ) ); }
+long Font::GetWidth() const { return mpImplFont->GetFontSize().Width(); }
rtl_TextEncoding Font::GetCharSet() const { return mpImplFont->GetCharSet(); }
More information about the Libreoffice-commits
mailing list