include/vcl/metric.hxx | 1 + vcl/inc/impfont.hxx | 1 + vcl/qa/cppunit/fontmetric.cxx | 19 +++++++++++++++++++ vcl/source/gdi/metric.cxx | 5 +++++ vcl/source/outdev/font.cxx | 2 +- 5 files changed, 27 insertions(+), 1 deletion(-)
New commits: commit 71d5ffba4434538e7897b288ddfa2e0a6df03dd2 Author: Chris Sherlock <chris.sherloc...@gmail.com> Date: Thu Jan 14 08:51:33 2016 +1100 vcl: Create mutator for slant attribute in FontMetric Mutator created for slant 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 slant attribute - check equality operator on FontMetric after setting slant attribute Change-Id: I5490a40dba4c86386d59a42f2d04303b3fc4d536 diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx index e4e6661..f2b84b2 100644 --- a/include/vcl/metric.hxx +++ b/include/vcl/metric.hxx @@ -59,6 +59,7 @@ public: void SetExternalLeading(long); void SetInternalLeading(long); void SetLineHeight(long); + void SetSlant(long); bool IsScalable() const; bool IsFullstopCentered() const; diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index e0a1ca1..ee66fad 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -128,6 +128,7 @@ public: void SetInternalLeading( long nIntLeading ) { mnIntLeading = nIntLeading; } void SetExternalLeading( long nExtLeading ) { mnExtLeading = nExtLeading; } void SetLineHeight( long nHeight ) { mnLineHeight = nHeight; } + void SetSlant( long nSlant ) { mnSlant = nSlant; } 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 3093783..2865743 100644 --- a/vcl/qa/cppunit/fontmetric.cxx +++ b/vcl/qa/cppunit/fontmetric.cxx @@ -27,6 +27,7 @@ public: void testFullstopCenteredFlag(); void testBuiltInFontFlag(); void testSpacings(); + void testSlant(); void testEqualityOperator(); CPPUNIT_TEST_SUITE(VclFontMetricTest); @@ -34,6 +35,7 @@ public: CPPUNIT_TEST(testFullstopCenteredFlag); CPPUNIT_TEST(testBuiltInFontFlag); CPPUNIT_TEST(testSpacings); + CPPUNIT_TEST(testSlant); CPPUNIT_TEST(testEqualityOperator); CPPUNIT_TEST_SUITE_END(); }; @@ -103,6 +105,18 @@ void VclFontMetricTest::testSpacings() } +void VclFontMetricTest::testSlant() +{ + // default constructor should set scalable flag to false + FontMetric aFontMetric; + + CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetSlant(), 0L ); + + aFontMetric.SetSlant( 45 ); + CPPUNIT_ASSERT_EQUAL( (long) aFontMetric.GetSlant(), 45L ); +} + + void VclFontMetricTest::testEqualityOperator() { // default constructor should set scalable flag to false @@ -142,6 +156,11 @@ void VclFontMetricTest::testEqualityOperator() aRhs.SetDescent( 100 ); CPPUNIT_ASSERT_MESSAGE( "Descent set same, aLHS == aRhs failed", aLhs == aRhs ); CPPUNIT_ASSERT_MESSAGE( "Descent set same, aLHS != aRhs succeeded", !(aLhs != aRhs) ); + + aLhs.SetSlant( 100 ); + aRhs.SetSlant( 100 ); + CPPUNIT_ASSERT_MESSAGE( "Slant set same, aLHS == aRhs failed", aLhs == aRhs ); + CPPUNIT_ASSERT_MESSAGE( "Slant set same, aLHS != aRhs succeeded", !(aLhs != aRhs) ); } diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx index 1b7206f..a91bd9f 100644 --- a/vcl/source/gdi/metric.cxx +++ b/vcl/source/gdi/metric.cxx @@ -173,6 +173,11 @@ long FontMetric::GetSlant() const return mpImplMetric->GetSlant(); } +void FontMetric::SetSlant( long nSlant ) +{ + mpImplMetric->SetSlant( nSlant ); +} + long FontMetric::GetBulletOffset() const { return mpImplMetric->GetBulletOffset(); diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 2165677..9267a4c 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -222,7 +222,7 @@ FontMetric OutputDevice::GetFontMetric() const // OutputDevice has its own external leading function due to #i60945# aMetric.SetExternalLeading( ImplDevicePixelToLogicHeight( GetFontExtLeading() ) ); aMetric.SetLineHeight( ImplDevicePixelToLogicHeight( pFontAttributes->GetAscent() + pFontAttributes->GetDescent() + mnEmphasisAscent + mnEmphasisDescent ) ); - aMetric.mpImplMetric->mnSlant = ImplDevicePixelToLogicHeight( pFontAttributes->GetSlant() ); + aMetric.SetSlant( ImplDevicePixelToLogicHeight( pFontAttributes->GetSlant() ) ); SAL_INFO("vcl.gdi.fontmetric", "OutputDevice::GetFontMetric:" << aMetric); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits