[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
Chris Sherlock
chris.sherlock79 at gmail.com
Fri Jan 22 07:42:28 PST 2016
include/vcl/font.hxx | 2 ++
vcl/inc/impfont.hxx | 7 ++++---
vcl/qa/cppunit/font.cxx | 14 ++++++++++++++
vcl/source/font/font.cxx | 5 +++++
4 files changed, 25 insertions(+), 3 deletions(-)
New commits:
commit 231d5c7db8188d53c6aab441b7080d3fa1a01446
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date: Fri Jan 22 15:29:27 2016 +1100
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 at gmail.com>
Tested-by: Chris Sherlock <chris.sherlock79 at gmail.com>
diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx
index b728f87..87a9d87 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 52b9a1b..c6667ef 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 656d089..5a8ad83 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 554cdb4..6890ca6 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 )
{}
More information about the Libreoffice-commits
mailing list