summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2016-01-21 15:00:08 +1100
committerChris Sherlock <chris.sherlock79@gmail.com>2016-01-21 06:20:39 +0000
commitabf04f6b0ad0dd83b4d479723144593e2f83ede0 (patch)
tree5f2e2eb0cde929743e7f199c6756b2f351e1bc9e
parent6b65a0e83c4798f117be61af91dbaebdc85e94b7 (diff)
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 <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
-rw-r--r--include/vcl/font.hxx2
-rw-r--r--vcl/inc/impfont.hxx9
-rw-r--r--vcl/qa/cppunit/font.cxx12
-rw-r--r--vcl/source/font/font.cxx4
4 files changed, 23 insertions, 4 deletions
diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx
index 51ce742e742d..dc7ab9e2de50 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 e7475e1ff1ff..4cd79dc9ae4c 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 224c8cdaaac6..a57395c05d76 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 7c9e9a27ab9a..6022ebb35978 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 )
{}