summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2016-01-20 23:41:06 +1100
committerChris Sherlock <chris.sherlock79@gmail.com>2016-01-20 16:34:56 +0000
commit137c440ccddbc9b41b8a8997820b7c0253b4de64 (patch)
treed5374d2420c24f9259cc50cd7b184104ffa54585
parentad236a3e1b456531ea758c2a3c5075860d823109 (diff)
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.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
-rw-r--r--include/vcl/font.hxx4
-rw-r--r--vcl/inc/impfont.hxx7
-rw-r--r--vcl/qa/cppunit/font.cxx11
-rw-r--r--vcl/source/font/font.cxx4
4 files changed, 23 insertions, 3 deletions
diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx
index 19acdc6bc515..51ce742e742d 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 26616930e0d9..e7475e1ff1ff 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 5649b329ba59..224c8cdaaac6 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 e24eb8a68161..7c9e9a27ab9a 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 )
{}