include/vcl/font.hxx | 2 ++ vcl/inc/impfont.hxx | 9 +++++---- vcl/qa/cppunit/font.cxx | 12 ++++++++++++ vcl/source/font/font.cxx | 4 ++++ 4 files changed, 23 insertions(+), 4 deletions(-)
New commits: commit abf04f6b0ad0dd83b4d479723144593e2f83ede0 Author: Chris Sherlock <chris.sherloc...@gmail.com> Date: Thu Jan 21 15:00:08 2016 +1100 vcl: add embeddable font property functions to Font class Added setter and getter for embeddable font property to the 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: I7f4ddf09d4a122c7c335b017efcb95f1774ae0d8 Reviewed-on: https://gerrit.libreoffice.org/21650 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherloc...@gmail.com> diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx index 51ce742..dc7ab9e 100644 --- a/include/vcl/font.hxx +++ b/include/vcl/font.hxx @@ -86,12 +86,14 @@ public: int GetQuality() const; bool IsBuiltInFont() const; + bool CanEmbed() const; void SetQuality(int); void IncreaseQualityBy(int); void DecreaseQualityBy(int); void SetBuiltInFontFlag(bool); + void SetEmbeddableFlag(bool); // 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/impfont.hxx b/vcl/inc/impfont.hxx index e7475e1..4cd79dc 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -63,6 +63,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 eCharSet ) { meCharSet = eCharSet; } void SetSymbolFlag( const bool bSymbolFlag ) { mbSymbol = bSymbolFlag; } @@ -75,7 +76,7 @@ public: /* Missing function: OUString GetMapNames() const; */ bool IsBuiltInFont() const { return mbDevice; } - /* Missing function: bool CanEmbed() const; */ + bool CanEmbed() const { return mbEmbeddable; } /* Missing function: bool CanSubSet() const; */ /* Missing function: bool CanRotate() const; */ /* Missing function: bool HasMapNames() const; */ @@ -84,10 +85,9 @@ public: /* Missing function: void AddMapName( OUString const& ); */ void SetBuiltInFontFlag( bool bIsBuiltInFont ) { mbDevice = bIsBuiltInFont; } - /* Missing function: void SetEmbeddableFlag( bool ); */ + void SetEmbeddableFlag( bool bEmbeddable ) { mbEmbeddable = bEmbeddable; } /* Missing function: void SetSettableFlag( bool ); */ /* missing function: void SetOrientationFlag( bool ); */ - void SetCharSet( const rtl_TextEncoding eCharSet ) { meCharSet = eCharSet; } bool operator==( const ImplFont& ) const; @@ -124,7 +124,8 @@ private: mbShadow:1, mbVertical:1, mbTransparent:1, // compatibility, now on output device - mbDevice:1; + mbDevice:1, + mbEmbeddable:1; int mnQuality; friend SvStream& ReadImplFont( SvStream& rIStm, ImplFont& ); diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx index 224c8cd..a57395c0 100644 --- a/vcl/qa/cppunit/font.cxx +++ b/vcl/qa/cppunit/font.cxx @@ -28,6 +28,7 @@ public: void testItalic(); void testQuality(); void testBuiltInFontFlag(); + void testEmbeddableFontFlag(); void testSymbolFlagAndCharSet(); CPPUNIT_TEST_SUITE(VclFontTest); @@ -38,6 +39,7 @@ public: CPPUNIT_TEST(testItalic); CPPUNIT_TEST(testQuality); CPPUNIT_TEST(testBuiltInFontFlag); + CPPUNIT_TEST(testEmbeddableFontFlag); CPPUNIT_TEST(testSymbolFlagAndCharSet); CPPUNIT_TEST_SUITE_END(); }; @@ -121,6 +123,16 @@ void VclFontTest::testBuiltInFontFlag() CPPUNIT_ASSERT_EQUAL( true, aFont.IsBuiltInFont() ); } +void VclFontTest::testEmbeddableFontFlag() +{ + vcl::Font aFont; + + CPPUNIT_ASSERT_EQUAL( false, aFont.CanEmbed() ); + + aFont.SetEmbeddableFlag( true ); + CPPUNIT_ASSERT_EQUAL( true, aFont.CanEmbed() ); +} + 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 7c9e9a2..6022ebb 100644 --- a/vcl/source/font/font.cxx +++ b/vcl/source/font/font.cxx @@ -815,6 +815,8 @@ void Font::DecreaseQualityBy( int nQualityAmount ) { mpImplFont->DecreaseQuality bool Font::IsBuiltInFont() const { return mpImplFont->IsBuiltInFont(); } void Font::SetBuiltInFontFlag( bool bIsBuiltInFontFlag ) { mpImplFont->SetBuiltInFontFlag( bIsBuiltInFontFlag ); } +bool Font::CanEmbed() const { return mpImplFont->CanEmbed(); } +void Font::SetEmbeddableFlag( bool bEmbeddable ) { mpImplFont->SetEmbeddableFlag( bEmbeddable ); } bool Font::IsOutline() const { return mpImplFont->mbOutline; } bool Font::IsShadow() const { return mpImplFont->mbShadow; } FontRelief Font::GetRelief() const { return mpImplFont->meRelief; } @@ -855,6 +857,7 @@ ImplFont::ImplFont() : mbVertical( false ), mbTransparent( true ), mbDevice( false ), + mbEmbeddable( false ), mnQuality( 0 ) {} @@ -889,6 +892,7 @@ ImplFont::ImplFont( const ImplFont& rImplFont ) : mbVertical( rImplFont.mbVertical ), mbTransparent( rImplFont.mbTransparent ), mbDevice( rImplFont.mbDevice ), + mbEmbeddable( false ), mnQuality( rImplFont.mnQuality ) {} _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits