summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2016-01-22 15:29:27 +1100
committerChris Sherlock <chris.sherlock79@gmail.com>2016-01-22 15:41:55 +0000
commit231d5c7db8188d53c6aab441b7080d3fa1a01446 (patch)
tree01c46774d4650a283eb2cdc3a04ad4ca2f2931bd
parent3c1a343f6936f1dcefdf79a677f8c26ce29676e6 (diff)
vcl: add orientation flag property to Font class
Add getter and setter for orientation flag 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: I62d5a47f870702eeac4625830dd279dd53fbcc3d Reviewed-on: https://gerrit.libreoffice.org/21696 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
-rw-r--r--include/vcl/font.hxx2
-rw-r--r--vcl/inc/impfont.hxx7
-rw-r--r--vcl/qa/cppunit/font.cxx14
-rw-r--r--vcl/source/font/font.cxx5
4 files changed, 25 insertions, 3 deletions
diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx
index b728f87ec26c..87a9d8744f68 100644
--- a/include/vcl/font.hxx
+++ b/include/vcl/font.hxx
@@ -89,6 +89,7 @@ public:
bool IsBuiltInFont() const;
bool CanEmbed() const;
bool CanSubset() const;
+ bool CanRotate() const;
void SetQuality(int);
void IncreaseQualityBy(int);
@@ -98,6 +99,7 @@ public:
void SetBuiltInFontFlag(bool);
void SetEmbeddableFlag(bool);
void SetSubsettableFlag(bool);
+ void SetOrientationFlag(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 52b9a1b5c798..c6667efed107 100644
--- a/vcl/inc/impfont.hxx
+++ b/vcl/inc/impfont.hxx
@@ -77,12 +77,12 @@ public:
bool IsBuiltInFont() const { return mbDevice; }
bool CanEmbed() const { return mbEmbeddable; }
bool CanSubset() const { return mbSubsettable; }
- /* Missing function: bool CanRotate() const; */
+ bool CanRotate() const { return mbRotatable; }
void SetBuiltInFontFlag( bool bIsBuiltInFont ) { mbDevice = bIsBuiltInFont; }
void SetEmbeddableFlag( bool bEmbeddable ) { mbEmbeddable = bEmbeddable; }
void SetSubsettableFlag( bool bSubsettable ) { mbSubsettable = bSubsettable; }
- /* missing function: void SetOrientationFlag( bool ); */
+ void SetOrientationFlag( bool bCanRotate ) { mbRotatable = bCanRotate; }
bool operator==( const ImplFont& ) const;
@@ -121,7 +121,8 @@ private:
mbTransparent:1, // compatibility, now on output device
mbDevice:1,
mbEmbeddable:1,
- mbSubsettable:1;
+ mbSubsettable:1,
+ mbRotatable:1; // is "rotatable" even a word?!? I'll keep it for consistency for now
int mnQuality;
OUString maMapNames;
diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx
index 656d08917fb8..5a8ad8384523 100644
--- a/vcl/qa/cppunit/font.cxx
+++ b/vcl/qa/cppunit/font.cxx
@@ -30,6 +30,7 @@ public:
void testBuiltInFontFlag();
void testEmbeddableFontFlag();
void testSubsettableFontFlag();
+ void testOrientationFlag();
void testSymbolFlagAndCharSet();
CPPUNIT_TEST_SUITE(VclFontTest);
@@ -42,6 +43,7 @@ public:
CPPUNIT_TEST(testBuiltInFontFlag);
CPPUNIT_TEST(testEmbeddableFontFlag);
CPPUNIT_TEST(testSubsettableFontFlag);
+ CPPUNIT_TEST(testOrientationFlag);
CPPUNIT_TEST(testSymbolFlagAndCharSet);
CPPUNIT_TEST_SUITE_END();
};
@@ -146,6 +148,18 @@ void VclFontTest::testSubsettableFontFlag()
CPPUNIT_ASSERT_EQUAL( true, aFont.CanSubset() );
}
+
+void VclFontTest::testOrientationFlag()
+{
+ vcl::Font aFont;
+
+ CPPUNIT_ASSERT_EQUAL( false, aFont.CanRotate() );
+
+ aFont.SetOrientationFlag( true );
+ CPPUNIT_ASSERT_EQUAL( true, aFont.CanRotate() );
+}
+
+
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 554cdb4cf79c..6890ca606e08 100644
--- a/vcl/source/font/font.cxx
+++ b/vcl/source/font/font.cxx
@@ -824,6 +824,9 @@ 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::CanRotate() const { return mpImplFont->CanRotate(); }
+void Font::SetOrientationFlag( bool bCanRotate ) { mpImplFont->SetOrientationFlag( bCanRotate ); }
+
bool Font::IsOutline() const { return mpImplFont->mbOutline; }
bool Font::IsShadow() const { return mpImplFont->mbShadow; }
FontRelief Font::GetRelief() const { return mpImplFont->meRelief; }
@@ -866,6 +869,7 @@ ImplFont::ImplFont() :
mbDevice( false ),
mbEmbeddable( false ),
mbSubsettable( false ),
+ mbRotatable( false ),
mnQuality( 0 )
{}
@@ -902,6 +906,7 @@ ImplFont::ImplFont( const ImplFont& rImplFont ) :
mbDevice( rImplFont.mbDevice ),
mbEmbeddable( false ),
mbSubsettable( false ),
+ mbRotatable( rImplFont.mbRotatable ),
mnQuality( rImplFont.mnQuality )
{}