[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source
Chris Sherlock
chris.sherlock79 at gmail.com
Wed Jan 13 14:13:45 PST 2016
include/vcl/metric.hxx | 1 +
vcl/inc/impfont.hxx | 1 +
vcl/qa/cppunit/fontmetric.cxx | 13 ++++++++++++-
vcl/source/gdi/metric.cxx | 5 +++++
vcl/source/outdev/font.cxx | 2 +-
5 files changed, 20 insertions(+), 2 deletions(-)
New commits:
commit 1ccece2f322eae35601bf09c57ea583f8b270574
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date: Thu Jan 14 09:11:20 2016 +1100
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
diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx
index f2b84b2..9c2015b 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 ee66fad..8ff0aab 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 2865743..4f82adc 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 a91bd9f..a24cc3f 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 9267a4c..a38af4a 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 ) );
More information about the Libreoffice-commits
mailing list