summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2016-01-21 15:13:22 +1100
committerChris Sherlock <chris.sherlock79@gmail.com>2016-01-21 06:22:48 +0000
commita5372932f787534d15d4e36ee8c297f3c6ac0888 (patch)
tree026ee6e3ad21000e402bc2ecf09b8b949bff5f6a /vcl
parent078194f6d0ede81042f38fb687f5cc3180a48ad0 (diff)
vcl: add subsettable flag property functions to Font class
Added getter and setter for subsettable flag 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: I2a66f1c4876698e1ffeaf260b2b43d5308b71191 Reviewed-on: https://gerrit.libreoffice.org/21651 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/impfont.hxx11
-rw-r--r--vcl/qa/cppunit/font.cxx13
-rw-r--r--vcl/source/font/font.cxx4
3 files changed, 23 insertions, 5 deletions
diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx
index cc87b2e0c14a..e522c287666d 100644
--- a/vcl/inc/impfont.hxx
+++ b/vcl/inc/impfont.hxx
@@ -37,8 +37,8 @@ public:
// device independent font functions
const OUString& GetFamilyName() const { return maFamilyName; }
- FontFamily GetFamilyType() { if(meFamily==FAMILY_DONTKNOW) AskConfig(); return meFamily; }
- FontFamily GetFamilyTypeNoAsk() const { return meFamily; }
+ FontFamily GetFamilyType() { if(meFamily==FAMILY_DONTKNOW) AskConfig(); return meFamily; }
+ FontFamily GetFamilyTypeNoAsk() const { return meFamily; }
const OUString& GetStyleName() const { return maStyleName; }
FontWeight GetWeight() { if(meWeight==WEIGHT_DONTKNOW) AskConfig(); return meWeight; }
@@ -75,7 +75,7 @@ public:
bool IsBuiltInFont() const { return mbDevice; }
bool CanEmbed() const { return mbEmbeddable; }
- /* Missing function: bool CanSubSet() const; */
+ bool CanSubset() const { return mbSubsettable; }
/* Missing function: bool CanRotate() const; */
/* Missing function: bool HasMapNames() const; */
@@ -84,7 +84,7 @@ public:
void SetBuiltInFontFlag( bool bIsBuiltInFont ) { mbDevice = bIsBuiltInFont; }
void SetEmbeddableFlag( bool bEmbeddable ) { mbEmbeddable = bEmbeddable; }
- /* Missing function: void SetSettableFlag( bool ); */
+ void SetSubsettableFlag( bool bSubsettable ) { mbSubsettable = bSubsettable; }
/* missing function: void SetOrientationFlag( bool ); */
bool operator==( const ImplFont& ) const;
@@ -123,7 +123,8 @@ private:
mbVertical:1,
mbTransparent:1, // compatibility, now on output device
mbDevice:1,
- mbEmbeddable:1;
+ mbEmbeddable:1,
+ mbSubsettable:1;
int mnQuality;
friend SvStream& ReadImplFont( SvStream& rIStm, ImplFont& );
diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx
index a57395c05d76..656d08917fb8 100644
--- a/vcl/qa/cppunit/font.cxx
+++ b/vcl/qa/cppunit/font.cxx
@@ -29,6 +29,7 @@ public:
void testQuality();
void testBuiltInFontFlag();
void testEmbeddableFontFlag();
+ void testSubsettableFontFlag();
void testSymbolFlagAndCharSet();
CPPUNIT_TEST_SUITE(VclFontTest);
@@ -40,6 +41,7 @@ public:
CPPUNIT_TEST(testQuality);
CPPUNIT_TEST(testBuiltInFontFlag);
CPPUNIT_TEST(testEmbeddableFontFlag);
+ CPPUNIT_TEST(testSubsettableFontFlag);
CPPUNIT_TEST(testSymbolFlagAndCharSet);
CPPUNIT_TEST_SUITE_END();
};
@@ -133,6 +135,17 @@ void VclFontTest::testEmbeddableFontFlag()
CPPUNIT_ASSERT_EQUAL( true, aFont.CanEmbed() );
}
+
+void VclFontTest::testSubsettableFontFlag()
+{
+ vcl::Font aFont;
+
+ CPPUNIT_ASSERT_EQUAL( false, aFont.CanSubset() );
+
+ aFont.SetSubsettableFlag( true );
+ CPPUNIT_ASSERT_EQUAL( true, aFont.CanSubset() );
+}
+
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 aa85d052cb25..62f35bdbf7fc 100644
--- a/vcl/source/font/font.cxx
+++ b/vcl/source/font/font.cxx
@@ -817,6 +817,8 @@ 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::CanSubset() const { return mpImplFont->CanSubset(); }
+void Font::SetSubsettableFlag( bool bSubsettable ) { mpImplFont->SetSubsettableFlag( bSubsettable ); }
bool Font::IsOutline() const { return mpImplFont->mbOutline; }
bool Font::IsShadow() const { return mpImplFont->mbShadow; }
FontRelief Font::GetRelief() const { return mpImplFont->meRelief; }
@@ -858,6 +860,7 @@ ImplFont::ImplFont() :
mbTransparent( true ),
mbDevice( false ),
mbEmbeddable( false ),
+ mbSubsettable( false ),
mnQuality( 0 )
{}
@@ -893,6 +896,7 @@ ImplFont::ImplFont( const ImplFont& rImplFont ) :
mbTransparent( rImplFont.mbTransparent ),
mbDevice( rImplFont.mbDevice ),
mbEmbeddable( false ),
+ mbSubsettable( false ),
mnQuality( rImplFont.mnQuality )
{}