diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2016-01-19 14:10:02 +1100 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2016-01-19 19:45:48 +0000 |
commit | 94b7876e43a88618364c8256f0645e70d0daae6f (patch) | |
tree | 760041ea56da0f49b16a5d208de407e5ff411a79 | |
parent | 9c09d4d0d36076d39926eeaf7774171df3b55e52 (diff) |
vcl: add quality accessor & mutator to Font
Change-Id: I261c717cabf966b8b20b8e6c921b38f4cd73e268
Reviewed-on: https://gerrit.libreoffice.org/21597
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
-rw-r--r-- | include/vcl/font.hxx | 5 | ||||
-rw-r--r-- | vcl/inc/impfont.hxx | 7 | ||||
-rw-r--r-- | vcl/qa/cppunit/font.cxx | 13 | ||||
-rw-r--r-- | vcl/source/font/font.cxx | 29 | ||||
-rw-r--r-- | vcl/source/outdev/font.cxx | 1 |
5 files changed, 32 insertions, 23 deletions
diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx index bf50ab7da401..920f0698518e 100644 --- a/include/vcl/font.hxx +++ b/include/vcl/font.hxx @@ -82,6 +82,11 @@ public: void SetSymbolFlag( bool ); + // Device dependent functions + int GetQuality() const; + + void SetQuality(int); + // setting the color on the font is obsolete, the only remaining // valid use is for keeping backward compatibility with old MetaFiles const Color& GetColor() const; diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index f9c006f516ad..aaad50a2f421 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -66,7 +66,11 @@ public: void SetSymbolFlag( const bool bSymbolFlag ) { mbSymbol = bSymbolFlag; } // device dependent functions - /* Missing function: int GetQuality() const; */ + int GetQuality() const { return mnQuality; } + + 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; */ @@ -121,6 +125,7 @@ private: mbShadow:1, mbVertical:1, mbTransparent:1; // compatibility, now on output device + int mnQuality; friend SvStream& ReadImplFont( SvStream& rIStm, ImplFont& ); friend SvStream& WriteImplFont( SvStream& rOStm, const ImplFont& ); diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx index a8532a978c37..f4fcf1892996 100644 --- a/vcl/qa/cppunit/font.cxx +++ b/vcl/qa/cppunit/font.cxx @@ -26,6 +26,7 @@ public: void testWidthType(); void testPitch(); void testItalic(); + void testQuality(); void testSymbolFlagAndCharSet(); CPPUNIT_TEST_SUITE(VclFontTest); @@ -34,6 +35,7 @@ public: CPPUNIT_TEST(testWidthType); CPPUNIT_TEST(testPitch); CPPUNIT_TEST(testItalic); + CPPUNIT_TEST(testQuality); CPPUNIT_TEST(testSymbolFlagAndCharSet); CPPUNIT_TEST_SUITE_END(); }; @@ -91,6 +93,17 @@ void VclFontTest::testPitch() CPPUNIT_ASSERT_EQUAL_MESSAGE( "Pitch should be PITCH_FIXED", FontPitch::PITCH_FIXED, aFont.GetPitch()); } +void VclFontTest::testQuality() +{ + vcl::Font aFont; + + CPPUNIT_ASSERT_EQUAL( (int)0, aFont.GetQuality() ); + + aFont.SetQuality( 100 ); + CPPUNIT_ASSERT_EQUAL( (int)100, aFont.GetQuality()); +} + + void VclFontTest::testSymbolFlagAndCharSet() { // default constructor should set scalable flag to false diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx index 8cca361e5faf..7fe618aa3f31 100644 --- a/vcl/source/font/font.cxx +++ b/vcl/source/font/font.cxx @@ -771,41 +771,29 @@ Font Font::identifyFont( const void* i_pBuffer, sal_uInt32 i_nSize ) // The inlines from the font.hxx header are now instantiated for pImpl-ification const Color& Font::GetColor() const { return mpImplFont->maColor; } - const Color& Font::GetFillColor() const { return mpImplFont->maFillColor; } - bool Font::IsTransparent() const { return mpImplFont->mbTransparent; } FontAlign Font::GetAlign() const { return mpImplFont->meAlign; } 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(); } rtl_TextEncoding Font::GetCharSet() const { return mpImplFont->meCharSet; } const LanguageTag& Font::GetLanguageTag() const { return mpImplFont->maLanguageTag; } - const LanguageTag& Font::GetCJKContextLanguageTag() const { return mpImplFont->maCJKLanguageTag; } - LanguageType Font::GetLanguage() const { return mpImplFont->maLanguageTag.getLanguageType( false); } - LanguageType Font::GetCJKContextLanguage() const { return mpImplFont->maCJKLanguageTag.getLanguageType( false); } short Font::GetOrientation() const { return mpImplFont->mnOrientation; } - bool Font::IsVertical() const { return mpImplFont->mbVertical; } - FontKerning Font::GetKerning() const { return mpImplFont->mnKerning; } FontPitch Font::GetPitch() { return mpImplFont->GetPitch(); } @@ -820,22 +808,17 @@ FontWidth Font::GetWidthType() const { return mpImplFont->GetWidthTypeNoAsk(); } FontItalic Font::GetItalic() const { return mpImplFont->GetItalicNoAsk(); } FontFamily Font::GetFamily() const { return mpImplFont->GetFamilyNoAsk(); } -bool Font::IsOutline() const { return mpImplFont->mbOutline; } +int Font::GetQuality() const { return mpImplFont->GetQuality(); } +void Font::SetQuality( int nQuality ) { mpImplFont->SetQuality( nQuality ); } +bool Font::IsOutline() const { return mpImplFont->mbOutline; } bool Font::IsShadow() const { return mpImplFont->mbShadow; } - FontRelief Font::GetRelief() const { return mpImplFont->meRelief; } - FontUnderline Font::GetUnderline() const { return mpImplFont->meUnderline; } - FontUnderline Font::GetOverline() const { return mpImplFont->meOverline; } - FontStrikeout Font::GetStrikeout() const { return mpImplFont->meStrikeout; } - FontEmphasisMark Font::GetEmphasisMark() const { return mpImplFont->meEmphasisMark; } - bool Font::IsWordLineMode() const { return mpImplFont->mbWordLine; } - bool Font::IsSameInstance( const vcl::Font& rFont ) const { return (mpImplFont == rFont.mpImplFont); } @@ -866,7 +849,8 @@ ImplFont::ImplFont() : mbConfigLookup( false ), mbShadow( false ), mbVertical( false ), - mbTransparent( true ) + mbTransparent( true ), + mnQuality( 0 ) {} ImplFont::ImplFont( const ImplFont& rImplFont ) : @@ -898,7 +882,8 @@ ImplFont::ImplFont( const ImplFont& rImplFont ) : mbConfigLookup( rImplFont.mbConfigLookup ), mbShadow( rImplFont.mbShadow ), mbVertical( rImplFont.mbVertical ), - mbTransparent( rImplFont.mbTransparent ) + mbTransparent( rImplFont.mbTransparent ), + mnQuality( rImplFont.mnQuality ) {} bool ImplFont::operator==( const ImplFont& rOther ) const diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 0f7c783dfe4b..208aaa00a1d8 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -84,6 +84,7 @@ FontMetric OutputDevice::GetDevFont( int nDevFontIndex ) const aFontMetric.SetWidthType( rData.GetWidthType() ); aFontMetric.SetScalableFlag( rData.IsScalable() ); aFontMetric.SetBuiltInFontFlag( rData.IsBuiltInFont() ); + aFontMetric.SetQuality( rData.GetQuality() ); } return aFontMetric; |