summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2016-01-14 09:11:20 +1100
committerChris Sherlock <chris.sherlock79@gmail.com>2016-01-14 09:11:20 +1100
commit1ccece2f322eae35601bf09c57ea583f8b270574 (patch)
tree0f1eb7ac832abbc42116401863188f0a591520b5
parent71d5ffba4434538e7897b288ddfa2e0a6df03dd2 (diff)
vcl: Create mutator for bullet offset attribute in FontMetric
Mutator created for bullet offset attribute in FontMetric. See commit description in 8bfccd3a71d911b6d ("vcl: Create accessor and mutator for font scaling in FontMetric") for reasoning behind patch. Unit tests - check to ensure that can get and set bullet offset attribute - check equality operator on FontMetric after setting bullet offset attribute Change-Id: I87a76982a8b3ed697664299cb340fa35fb514c0e
-rw-r--r--include/vcl/metric.hxx1
-rw-r--r--vcl/inc/impfont.hxx1
-rw-r--r--vcl/qa/cppunit/fontmetric.cxx13
-rw-r--r--vcl/source/gdi/metric.cxx5
-rw-r--r--vcl/source/outdev/font.cxx2
5 files changed, 20 insertions, 2 deletions
diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx
index f2b84b2f3a6e..9c2015b5f2b1 100644
--- a/include/vcl/metric.hxx
+++ b/include/vcl/metric.hxx
@@ -60,6 +60,7 @@ public:
void SetInternalLeading(long);
void SetLineHeight(long);
void SetSlant(long);
+ void SetBulletOffset(long);
bool IsScalable() const;
bool IsFullstopCentered() const;
diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx
index ee66fad0b88b..8ff0aab7b894 100644
--- a/vcl/inc/impfont.hxx
+++ b/vcl/inc/impfont.hxx
@@ -129,6 +129,7 @@ public:
void SetExternalLeading( long nExtLeading ) { mnExtLeading = nExtLeading; }
void SetLineHeight( long nHeight ) { mnLineHeight = nHeight; }
void SetSlant( long nSlant ) { mnSlant = nSlant; }
+ void SetBulletOffset( long nOffset ) { mnBulletOffset = nOffset; }
bool IsScalable() const { return mbScalableFont; }
bool IsFullstopCentered() const { return mbFullstopCentered; }
diff --git a/vcl/qa/cppunit/fontmetric.cxx b/vcl/qa/cppunit/fontmetric.cxx
index 28657437abe8..4f82adc61698 100644
--- a/vcl/qa/cppunit/fontmetric.cxx
+++ b/vcl/qa/cppunit/fontmetric.cxx
@@ -28,6 +28,7 @@ public:
void testBuiltInFontFlag();
void testSpacings();
void testSlant();
+ void testBulletOffset();
void testEqualityOperator();
CPPUNIT_TEST_SUITE(VclFontMetricTest);
@@ -36,6 +37,7 @@ public:
CPPUNIT_TEST(testBuiltInFontFlag);
CPPUNIT_TEST(testSpacings);
CPPUNIT_TEST(testSlant);
+ CPPUNIT_TEST(testBulletOffset);
CPPUNIT_TEST(testEqualityOperator);
CPPUNIT_TEST_SUITE_END();
};
@@ -104,7 +106,6 @@ void VclFontMetricTest::testSpacings()
CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetLineHeight(), 100L );
}
-
void VclFontMetricTest::testSlant()
{
// default constructor should set scalable flag to false
@@ -116,6 +117,16 @@ void VclFontMetricTest::testSlant()
CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetSlant(), 45L );
}
+void VclFontMetricTest::testBulletOffset()
+{
+ // default constructor should set scalable flag to false
+ FontMetric aFontMetric;
+
+ CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetBulletOffset(), 0L );
+
+ aFontMetric.SetBulletOffset( 45 );
+ CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetBulletOffset(), 45L );
+}
void VclFontMetricTest::testEqualityOperator()
{
diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx
index a91bd9f83a11..a24cc3ff50b5 100644
--- a/vcl/source/gdi/metric.cxx
+++ b/vcl/source/gdi/metric.cxx
@@ -183,6 +183,11 @@ long FontMetric::GetBulletOffset() const
return mpImplMetric->GetBulletOffset();
}
+void FontMetric::SetBulletOffset( long nOffset )
+{
+ mpImplMetric->SetBulletOffset( nOffset );
+}
+
bool FontMetric::IsScalable() const
{
return mpImplMetric->IsScalable();
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 9267a4c2eb3c..a38af4aca158 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -215,7 +215,7 @@ FontMetric OutputDevice::GetFontMetric() const
aMetric.SetBuiltInFontFlag( pFontAttributes->IsBuiltInFont() );
aMetric.SetScalableFlag( pFontAttributes->IsScalable() );
aMetric.SetFullstopCenteredFlag( pFontAttributes->IsFullstopCentered() );
- aMetric.mpImplMetric->mnBulletOffset = pFontAttributes->GetBulletOffset();
+ aMetric.SetBulletOffset( pFontAttributes->GetBulletOffset() );
aMetric.SetAscent( ImplDevicePixelToLogicHeight( pFontAttributes->GetAscent() + mnEmphasisAscent ) );
aMetric.SetDescent( ImplDevicePixelToLogicHeight( pFontAttributes->GetDescent() + mnEmphasisDescent ) );
aMetric.SetInternalLeading( ImplDevicePixelToLogicHeight( pFontAttributes->GetInternalLeading() + mnEmphasisAscent ) );