[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source

Chris Sherlock chris.sherlock79 at gmail.com
Tue Jan 19 11:46:18 PST 2016


 include/vcl/font.hxx       |    5 +++++
 vcl/inc/impfont.hxx        |    7 ++++++-
 vcl/qa/cppunit/font.cxx    |   13 +++++++++++++
 vcl/source/font/font.cxx   |   29 +++++++----------------------
 vcl/source/outdev/font.cxx |    1 +
 5 files changed, 32 insertions(+), 23 deletions(-)

New commits:
commit 94b7876e43a88618364c8256f0645e70d0daae6f
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Tue Jan 19 14:10:02 2016 +1100

    vcl: add quality accessor & mutator to Font
    
    Change-Id: I261c717cabf966b8b20b8e6c921b38f4cd73e268
    Reviewed-on: https://gerrit.libreoffice.org/21597
    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 bf50ab7..920f069 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 f9c006f..aaad50a2 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 a8532a9..f4fcf18 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 8cca361..7fe618a 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 0f7c783..208aaa0 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;


More information about the Libreoffice-commits mailing list