[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
Chris Sherlock
chris.sherlock79 at gmail.com
Wed Jan 20 03:40:33 PST 2016
include/vcl/font.hxx | 2 ++
vcl/inc/fontattributes.hxx | 2 +-
vcl/inc/impfont.hxx | 8 +++++---
vcl/qa/cppunit/font.cxx | 8 +++++++-
vcl/source/font/font.cxx | 30 ++++++++++++++++--------------
5 files changed, 31 insertions(+), 19 deletions(-)
New commits:
commit ab6f80909877f1e14de252c456dd2acd84c43974
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date: Wed Jan 20 20:47:19 2016 +1100
vcl: add more property functions to Font
Added increase and decrease quality functions to Font class, and
also charset mutator and accessor function.
See commit description in 8bfccd3a71d911b6d ("vcl: Create accessor
and mutator for font scaling in FontMetric") for reasoning behind
patch.
Unit test change in vcl/qa/cppunit/font.cxx:
- enhanced to check increase and decrease quality functions
Change-Id: I2f5970438f6ef1ad185163d5fdcec5bbc88912a4
Reviewed-on: https://gerrit.libreoffice.org/21622
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79 at gmail.com>
diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx
index 920f069..19acdc6 100644
--- a/include/vcl/font.hxx
+++ b/include/vcl/font.hxx
@@ -86,6 +86,8 @@ public:
int GetQuality() const;
void SetQuality(int);
+ void IncreaseQualityBy(int);
+ void DecreaseQualityBy(int);
// setting the color on the font is obsolete, the only remaining
// valid use is for keeping backward compatibility with old MetaFiles
diff --git a/vcl/inc/fontattributes.hxx b/vcl/inc/fontattributes.hxx
index cd53400..0168a32 100644
--- a/vcl/inc/fontattributes.hxx
+++ b/vcl/inc/fontattributes.hxx
@@ -50,6 +50,7 @@ public:
void SetItalic(const FontItalic eItalic ) { meItalic = eItalic; }
void SetWeight(const FontWeight eWeight ) { meWeight = eWeight; }
void SetWidthType(const FontWidth eWidthType) { meWidthType = eWidthType; }
+ void SetCharSet( const rtl_TextEncoding );
void SetSymbolFlag(const bool );
@@ -89,7 +90,6 @@ public:
void SetEmbeddableFlag ( bool bEmbeddable ) { mbEmbeddable = bEmbeddable; }
void SetSubsettableFlag( bool bSubsettable ) { mbSubsettable = bSubsettable; }
void SetOrientationFlag( bool bCanRotate ) { mbOrientation = bCanRotate; }
- void SetCharSet( const rtl_TextEncoding );
private:
// device independent variables
diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx
index c425ea7..26616930 100644
--- a/vcl/inc/impfont.hxx
+++ b/vcl/inc/impfont.hxx
@@ -51,6 +51,7 @@ public:
FontPitch GetPitchNoAsk() const { return mePitch; }
FontWidth GetWidthType() { if(meWidthType==WIDTH_DONTKNOW) AskConfig(); return meWidthType; }
FontWidth GetWidthTypeNoAsk() const { return meWidthType; }
+ rtl_TextEncoding GetCharSet() const { return meCharSet; }
bool IsSymbolFont() const { return mbSymbol; }
@@ -68,9 +69,9 @@ public:
// device dependent functions
int GetQuality() const { return mnQuality; }
- void SetQuality( int nQuality ) { mnQuality = nQuality; }
- void IncreaseQualityBy( int nQualityAmount ) { mnQuality += nQualityAmount; }
- void DecreaseQualityBy( int nQualityAmount ) { mnQuality -= nQualityAmount; }
+ void SetQuality( int nQuality ) { mnQuality = nQuality; }
+ void IncreaseQualityBy( int nQualityAmount ) { mnQuality += nQualityAmount; }
+ void DecreaseQualityBy( int nQualityAmount ) { mnQuality -= nQualityAmount; }
/* Missing function: OUString GetMapNames() const; */
/* Missing function: bool IsBuiltInFont() const; */
@@ -86,6 +87,7 @@ public:
/* Missing function: void SetEmbeddableFlag( bool ); */
/* Missing function: void SetSettableFlag( bool ); */
/* missing function: void SetOrientationFlag( bool ); */
+ void SetCharSet( const rtl_TextEncoding eCharSet ) { meCharSet = eCharSet; }
bool operator==( const ImplFont& ) const;
diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx
index f4fcf18..5649b32 100644
--- a/vcl/qa/cppunit/font.cxx
+++ b/vcl/qa/cppunit/font.cxx
@@ -100,7 +100,13 @@ void VclFontTest::testQuality()
CPPUNIT_ASSERT_EQUAL( (int)0, aFont.GetQuality() );
aFont.SetQuality( 100 );
- CPPUNIT_ASSERT_EQUAL( (int)100, aFont.GetQuality());
+ CPPUNIT_ASSERT_EQUAL( (int)100, aFont.GetQuality() );
+
+ aFont.IncreaseQualityBy( 50 );
+ CPPUNIT_ASSERT_EQUAL( (int)150, aFont.GetQuality() );
+
+ aFont.DecreaseQualityBy( 100 );
+ CPPUNIT_ASSERT_EQUAL( (int)50, aFont.GetQuality() );
}
diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx
index 7fe618a..c2e676b 100644
--- a/vcl/source/font/font.cxx
+++ b/vcl/source/font/font.cxx
@@ -169,35 +169,35 @@ void Font::SetFamily( FontFamily eFamily )
void Font::SetCharSet( rtl_TextEncoding eCharSet )
{
- if( mpImplFont->meCharSet != eCharSet )
+ if( mpImplFont->GetCharSet() != eCharSet )
{
MakeUnique();
- mpImplFont->meCharSet = eCharSet;
+ mpImplFont->SetCharSet( eCharSet );
if ( eCharSet == RTL_TEXTENCODING_SYMBOL )
- mpImplFont->mbSymbol = true;
+ mpImplFont->SetSymbolFlag( true );
else
- mpImplFont->mbSymbol = false;
+ mpImplFont->SetSymbolFlag( false );
}
}
bool Font::IsSymbolFont() const
{
- return mpImplFont->mbSymbol;
+ return mpImplFont->IsSymbolFont();
}
void Font::SetSymbolFlag( bool bSymbol )
{
- mpImplFont->mbSymbol = bSymbol;
+ mpImplFont->SetSymbolFlag( bSymbol );
- if ( bSymbol )
+ if ( IsSymbolFont() )
{
- mpImplFont->meCharSet = RTL_TEXTENCODING_SYMBOL;
+ mpImplFont->SetCharSet( RTL_TEXTENCODING_SYMBOL );
}
else
{
- if ( mpImplFont->meCharSet == RTL_TEXTENCODING_SYMBOL )
- mpImplFont->meCharSet = RTL_TEXTENCODING_DONTKNOW;
+ if ( mpImplFont->GetCharSet() == RTL_TEXTENCODING_SYMBOL )
+ mpImplFont->SetCharSet( RTL_TEXTENCODING_DONTKNOW );
}
}
@@ -466,7 +466,7 @@ void Font::GetFontAttributes( FontAttributes& rAttrs ) const
rAttrs.SetItalic( mpImplFont->GetItalicNoAsk() );
rAttrs.SetWeight( mpImplFont->GetWeightNoAsk() );
rAttrs.SetWidthType( WIDTH_DONTKNOW );
- rAttrs.SetSymbolFlag( mpImplFont->meCharSet == RTL_TEXTENCODING_SYMBOL );
+ rAttrs.SetSymbolFlag( mpImplFont->GetCharSet() == RTL_TEXTENCODING_SYMBOL );
}
SvStream& ReadImplFont( SvStream& rIStm, ImplFont& rImplFont )
@@ -480,7 +480,7 @@ SvStream& ReadImplFont( SvStream& rIStm, ImplFont& rImplFont )
rImplFont.maStyleName = rIStm.ReadUniOrByteString(rIStm.GetStreamCharSet());
ReadPair( rIStm, rImplFont.maSize );
- rIStm.ReadUInt16( nTmp16 ); rImplFont.meCharSet = (rtl_TextEncoding) nTmp16;
+ rIStm.ReadUInt16( nTmp16 ); rImplFont.SetCharSet( (rtl_TextEncoding) nTmp16 );
rIStm.ReadUInt16( nTmp16 ); rImplFont.meFamily = (FontFamily) nTmp16;
rIStm.ReadUInt16( nTmp16 ); rImplFont.SetPitch( (FontPitch) nTmp16 );
rIStm.ReadUInt16( nTmp16 ); rImplFont.SetWeight( (FontWeight) nTmp16 );
@@ -521,7 +521,7 @@ SvStream& WriteImplFont( SvStream& rOStm, const ImplFont& rImplFont )
rOStm.WriteUniOrByteString( rImplFont.maStyleName, rOStm.GetStreamCharSet() );
WritePair( rOStm, rImplFont.maSize );
- rOStm.WriteUInt16( GetStoreCharSet( rImplFont.meCharSet ) );
+ rOStm.WriteUInt16( GetStoreCharSet( rImplFont.GetCharSet() ) );
rOStm.WriteUInt16( rImplFont.GetFamilyNoAsk() );
rOStm.WriteUInt16( rImplFont.GetPitchNoAsk() );
rOStm.WriteUInt16( rImplFont.GetWeightNoAsk() );
@@ -785,7 +785,7 @@ 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(); }
-rtl_TextEncoding Font::GetCharSet() const { return mpImplFont->meCharSet; }
+rtl_TextEncoding Font::GetCharSet() const { return mpImplFont->GetCharSet(); }
const LanguageTag& Font::GetLanguageTag() const { return mpImplFont->maLanguageTag; }
const LanguageTag& Font::GetCJKContextLanguageTag() const { return mpImplFont->maCJKLanguageTag; }
@@ -810,6 +810,8 @@ FontFamily Font::GetFamily() const { return mpImplFont->GetFamilyNoAsk(); }
int Font::GetQuality() const { return mpImplFont->GetQuality(); }
void Font::SetQuality( int nQuality ) { mpImplFont->SetQuality( nQuality ); }
+void Font::IncreaseQualityBy( int nQualityAmount ) { mpImplFont->IncreaseQualityBy( nQualityAmount ); }
+void Font::DecreaseQualityBy( int nQualityAmount ) { mpImplFont->DecreaseQualityBy( nQualityAmount ); }
bool Font::IsOutline() const { return mpImplFont->mbOutline; }
bool Font::IsShadow() const { return mpImplFont->mbShadow; }
More information about the Libreoffice-commits
mailing list