diff options
-rw-r--r-- | include/vcl/metric.hxx | 4 | ||||
-rw-r--r-- | vcl/inc/impfont.hxx | 10 | ||||
-rw-r--r-- | vcl/qa/cppunit/fontmetric.cxx | 21 | ||||
-rw-r--r-- | vcl/source/gdi/metric.cxx | 21 | ||||
-rw-r--r-- | vcl/source/outdev/font.cxx | 3 |
5 files changed, 45 insertions, 14 deletions
diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx index e289b722cbb1..f3de0183bb3c 100644 --- a/include/vcl/metric.hxx +++ b/include/vcl/metric.hxx @@ -52,11 +52,13 @@ public: long GetExtLeading() const; long GetLineHeight() const; long GetSlant() const; + long GetBulletOffset() const; + bool IsScalable() const; bool IsFullstopCentered() const; - long GetBulletOffset() const; void SetScalableFlag(bool); + void SetFullstopCenteredFlag(bool); FontMetric& operator=( const FontMetric& rMetric ); bool operator==( const FontMetric& rMetric ) const; diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index 376c0cb16ed5..5367a77f8a21 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -105,6 +105,7 @@ private: sal_uInt32 mnRefCount; // Reference Counter bool mbScalableFont; + bool mbFullstopCentered; // TODO: As these are progressively moved from bit fields into boolean variables, comment them out. // Eventually this enum will not be needed and we can remove it. @@ -113,8 +114,8 @@ private: /* SCALABLE_FLAG=2, */ LATIN_FLAG=4, CJK_FLAG=8, - CTL_FLAG=16, - FULLSTOP_CENTERED_FLAG=32 + CTL_FLAG=16 + /* FULLSTOP_CENTERED_FLAG=32 */ }; public: @@ -131,12 +132,13 @@ public: long GetExtLeading() const { return mnExtLeading; } long GetLineHeight() const { return mnLineHeight; } long GetSlant() const { return mnSlant; } + long GetBulletOffset() const { return mnBulletOffset; } bool IsScalable() const { return mbScalableFont; } - bool IsFullstopCentered() const { return ((mnMiscFlags & FULLSTOP_CENTERED_FLAG ) != 0); } - long GetBulletOffset() const { return mnBulletOffset; } + bool IsFullstopCentered() const { return mbFullstopCentered; } void SetScalableFlag(bool bScalable) { mbScalableFont = bScalable; } + void SetFullstopCenteredFlag(bool bCentered) { mbFullstopCentered = bCentered; } }; diff --git a/vcl/qa/cppunit/fontmetric.cxx b/vcl/qa/cppunit/fontmetric.cxx index b7db7dfafe11..1428cfb3ffbb 100644 --- a/vcl/qa/cppunit/fontmetric.cxx +++ b/vcl/qa/cppunit/fontmetric.cxx @@ -22,10 +22,12 @@ public: VclFontMetricTest() : BootstrapFixture(true, false) {} void testScalableFlag(); + void testFullstopCenteredFlag(); void testEqualityOperator(); CPPUNIT_TEST_SUITE(VclFontMetricTest); CPPUNIT_TEST(testScalableFlag); + CPPUNIT_TEST(testFullstopCenteredFlag); CPPUNIT_TEST(testEqualityOperator); CPPUNIT_TEST_SUITE_END(); }; @@ -42,6 +44,20 @@ void VclFontMetricTest::testScalableFlag() CPPUNIT_ASSERT_MESSAGE( "Scalable flag should be true", aFontMetric.IsScalable() ); } + +void VclFontMetricTest::testFullstopCenteredFlag() +{ + // default constructor should set scalable flag to false + FontMetric aFontMetric; + + CPPUNIT_ASSERT_MESSAGE( "Fullstop centered flag should be false after default constructor called", !aFontMetric.IsFullstopCentered() ); + + aFontMetric.SetFullstopCenteredFlag(true); + + CPPUNIT_ASSERT_MESSAGE( "Fullstop centered flag should be true", aFontMetric.IsFullstopCentered() ); +} + + void VclFontMetricTest::testEqualityOperator() { // default constructor should set scalable flag to false @@ -51,6 +67,11 @@ void VclFontMetricTest::testEqualityOperator() aRhs.SetScalableFlag(true); CPPUNIT_ASSERT_MESSAGE( "Scalable flag set same", aLhs == aRhs ); + + aLhs.SetFullstopCenteredFlag(true); + aRhs.SetFullstopCenteredFlag(true); + + CPPUNIT_ASSERT_MESSAGE( "Fullstop centered flag set same", aLhs == aRhs ); } diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx index a3d5a679722d..089e42190dc4 100644 --- a/vcl/source/gdi/metric.cxx +++ b/vcl/source/gdi/metric.cxx @@ -35,7 +35,8 @@ ImplFontMetric::ImplFontMetric() mnBulletOffset( 0 ), mnMiscFlags( 0 ), mnRefCount( 1 ), - mbScalableFont( false ) + mbScalableFont( false ), + mbFullstopCentered( false ) {} inline void ImplFontMetric::AddReference() @@ -53,7 +54,8 @@ inline void ImplFontMetric::DeReference() bool ImplFontMetric::operator==( const ImplFontMetric& r ) const { - if( mbScalableFont != r.mbScalableFont ) + if( mbScalableFont != r.mbScalableFont + || mbFullstopCentered != r.mbFullstopCentered ) return false; if( mnMiscFlags != r.mnMiscFlags ) return false; @@ -147,11 +149,6 @@ long FontMetric::GetSlant() const return mpImplMetric->GetSlant(); } -bool FontMetric::IsFullstopCentered() const -{ - return mpImplMetric->IsFullstopCentered(); -} - long FontMetric::GetBulletOffset() const { return mpImplMetric->GetBulletOffset(); @@ -167,4 +164,14 @@ void FontMetric::SetScalableFlag(bool bScalable) mpImplMetric->SetScalableFlag( bScalable ); } +bool FontMetric::IsFullstopCentered() const +{ + return mpImplMetric->IsFullstopCentered(); +} + +void FontMetric::SetFullstopCenteredFlag(bool bScalable) +{ + mpImplMetric->SetFullstopCenteredFlag( bScalable ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 00a5f73326cd..ef3929dc4fa2 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -217,8 +217,7 @@ FontMetric OutputDevice::GetFontMetric() const if( pFontAttributes->IsBuiltInFont() ) aMetric.mpImplMetric->mnMiscFlags |= ImplFontMetric::DEVICE_FLAG; aMetric.SetScalableFlag( pFontAttributes->IsScalable() ); - if( pFontAttributes->IsFullstopCentered()) - aMetric.mpImplMetric->mnMiscFlags |= ImplFontMetric::FULLSTOP_CENTERED_FLAG; + aMetric.SetFullstopCenteredFlag( pFontAttributes->IsFullstopCentered() ); aMetric.mpImplMetric->mnBulletOffset = pFontAttributes->GetBulletOffset(); aMetric.mpImplMetric->mnAscent = ImplDevicePixelToLogicHeight( pFontAttributes->GetAscent() + mnEmphasisAscent ); aMetric.mpImplMetric->mnDescent = ImplDevicePixelToLogicHeight( pFontAttributes->GetDescent() + mnEmphasisDescent ); |