include/vcl/font.hxx | 4 ++++ vcl/inc/impfont.hxx | 7 ++++--- vcl/qa/cppunit/font.cxx | 11 +++++++++++ vcl/source/font/font.cxx | 4 ++++ 4 files changed, 23 insertions(+), 3 deletions(-)
New commits: commit 137c440ccddbc9b41b8a8997820b7c0253b4de64 Author: Chris Sherlock <chris.sherloc...@gmail.com> Date: Wed Jan 20 23:41:06 2016 +1100 vcl: add built in font property functions to Font class Added setter for built-in font property and IsBuiltInFontFlag to Font class. 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: I61ce33fe6ffb31be22c68ce8a94d0886ebdc8fcf Reviewed-on: https://gerrit.libreoffice.org/21627 Reviewed-by: Chris Sherlock <chris.sherloc...@gmail.com> Tested-by: Chris Sherlock <chris.sherloc...@gmail.com> diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx index 19acdc6..51ce742 100644 --- a/include/vcl/font.hxx +++ b/include/vcl/font.hxx @@ -85,10 +85,14 @@ public: // Device dependent functions int GetQuality() const; + bool IsBuiltInFont() const; + void SetQuality(int); void IncreaseQualityBy(int); void DecreaseQualityBy(int); + void SetBuiltInFontFlag(bool); + // 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 26616930..e7475e1 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -74,7 +74,7 @@ public: void DecreaseQualityBy( int nQualityAmount ) { mnQuality -= nQualityAmount; } /* Missing function: OUString GetMapNames() const; */ - /* Missing function: bool IsBuiltInFont() const; */ + bool IsBuiltInFont() const { return mbDevice; } /* Missing function: bool CanEmbed() const; */ /* Missing function: bool CanSubSet() const; */ /* Missing function: bool CanRotate() const; */ @@ -83,7 +83,7 @@ public: /* Missing function: void SetNames( OUString const& ); */ /* Missing function: void AddMapName( OUString const& ); */ - /* Missing function: void SetBuiltInFontFlag( bool ); */ + void SetBuiltInFontFlag( bool bIsBuiltInFont ) { mbDevice = bIsBuiltInFont; } /* Missing function: void SetEmbeddableFlag( bool ); */ /* Missing function: void SetSettableFlag( bool ); */ /* missing function: void SetOrientationFlag( bool ); */ @@ -123,7 +123,8 @@ private: mbConfigLookup:1, // there was a config lookup mbShadow:1, mbVertical:1, - mbTransparent:1; // compatibility, now on output device + mbTransparent:1, // compatibility, now on output device + mbDevice:1; int mnQuality; friend SvStream& ReadImplFont( SvStream& rIStm, ImplFont& ); diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx index 5649b32..224c8cd 100644 --- a/vcl/qa/cppunit/font.cxx +++ b/vcl/qa/cppunit/font.cxx @@ -27,6 +27,7 @@ public: void testPitch(); void testItalic(); void testQuality(); + void testBuiltInFontFlag(); void testSymbolFlagAndCharSet(); CPPUNIT_TEST_SUITE(VclFontTest); @@ -36,6 +37,7 @@ public: CPPUNIT_TEST(testPitch); CPPUNIT_TEST(testItalic); CPPUNIT_TEST(testQuality); + CPPUNIT_TEST(testBuiltInFontFlag); CPPUNIT_TEST(testSymbolFlagAndCharSet); CPPUNIT_TEST_SUITE_END(); }; @@ -109,6 +111,15 @@ void VclFontTest::testQuality() CPPUNIT_ASSERT_EQUAL( (int)50, aFont.GetQuality() ); } +void VclFontTest::testBuiltInFontFlag() +{ + vcl::Font aFont; + + CPPUNIT_ASSERT_EQUAL( false, aFont.IsBuiltInFont() ); + + aFont.SetBuiltInFontFlag( true ); + CPPUNIT_ASSERT_EQUAL( true, aFont.IsBuiltInFont() ); +} void VclFontTest::testSymbolFlagAndCharSet() { diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx index e24eb8a..7c9e9a2 100644 --- a/vcl/source/font/font.cxx +++ b/vcl/source/font/font.cxx @@ -813,6 +813,8 @@ 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::IsBuiltInFont() const { return mpImplFont->IsBuiltInFont(); } +void Font::SetBuiltInFontFlag( bool bIsBuiltInFontFlag ) { mpImplFont->SetBuiltInFontFlag( bIsBuiltInFontFlag ); } bool Font::IsOutline() const { return mpImplFont->mbOutline; } bool Font::IsShadow() const { return mpImplFont->mbShadow; } FontRelief Font::GetRelief() const { return mpImplFont->meRelief; } @@ -852,6 +854,7 @@ ImplFont::ImplFont() : mbShadow( false ), mbVertical( false ), mbTransparent( true ), + mbDevice( false ), mnQuality( 0 ) {} @@ -885,6 +888,7 @@ ImplFont::ImplFont( const ImplFont& rImplFont ) : mbShadow( rImplFont.mbShadow ), mbVertical( rImplFont.mbVertical ), mbTransparent( rImplFont.mbTransparent ), + mbDevice( rImplFont.mbDevice ), mnQuality( rImplFont.mnQuality ) {} _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits