diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2016-01-28 16:31:30 +1100 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2016-01-29 01:59:55 +0000 |
commit | d1a49df6833ff16f5cbaf98534eaae62693e520b (patch) | |
tree | 2bbf60556966b4939f3700cab9d1a6278e6b67f0 /vcl/source/font | |
parent | 6402164182865d7644d2e93158a23e12a6da3926 (diff) |
vcl: add text alignment functions to ImplFont and FontAttributes
ImplFont and FontAttributes now have GetAlignment and SetAlignment,
and I have renamed Font::GetAlign to Font::GetAlignment, and
Font::SetAlign to Font::SetAlignment.
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 text alignment.
Change-Id: I6272c84fc9416c90616d957d1897eba9469fe7ba
Reviewed-on: https://gerrit.libreoffice.org/21876
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Diffstat (limited to 'vcl/source/font')
-rw-r--r-- | vcl/source/font/font.cxx | 6 | ||||
-rw-r--r-- | vcl/source/font/fontattributes.cxx | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx index dafc81225dd9..9270d0ba3ee2 100644 --- a/vcl/source/font/font.cxx +++ b/vcl/source/font/font.cxx @@ -128,12 +128,12 @@ void Font::SetTransparent( bool bTransparent ) } } -void Font::SetAlign( FontAlign eAlign ) +void Font::SetAlignment( FontAlign eAlign ) { if( mpImplFont->meAlign != eAlign ) { MakeUnique(); - mpImplFont->meAlign = eAlign; + mpImplFont->SetAlignment(eAlign); } } @@ -776,7 +776,7 @@ const Color& Font::GetColor() const { return mpImplFont->maColor; } const Color& Font::GetFillColor() const { return mpImplFont->maFillColor; } bool Font::IsTransparent() const { return mpImplFont->mbTransparent; } -FontAlign Font::GetAlign() const { return mpImplFont->meAlign; } +FontAlign Font::GetAlignment() const { return mpImplFont->GetAlignment(); } const OUString& Font::GetFamilyName() const { return mpImplFont->GetFamilyName(); } const OUString& Font::GetStyleName() const { return mpImplFont->maStyleName; } diff --git a/vcl/source/font/fontattributes.cxx b/vcl/source/font/fontattributes.cxx index 4f5c9e4bfcce..0702932007c2 100644 --- a/vcl/source/font/fontattributes.cxx +++ b/vcl/source/font/fontattributes.cxx @@ -28,6 +28,7 @@ FontAttributes::FontAttributes() mePitch( PITCH_DONTKNOW ), meWidthType ( WIDTH_DONTKNOW ), meItalic ( ITALIC_NONE ), + meAlign ( ALIGN_TOP ), meCharSet( RTL_TEXTENCODING_DONTKNOW ), mbSymbolFlag( false ), mnQuality( 0 ), @@ -45,6 +46,7 @@ FontAttributes::FontAttributes( const FontAttributes& rFontAttributes ) : mePitch( rFontAttributes.mePitch ), meWidthType( rFontAttributes.meWidthType ), meItalic( rFontAttributes.meItalic ), + meAlign( rFontAttributes.meAlign ), meCharSet( rFontAttributes.meCharSet ), mbSymbolFlag( rFontAttributes.mbSymbolFlag ), maMapNames( rFontAttributes.maMapNames ), @@ -55,7 +57,6 @@ FontAttributes::FontAttributes( const FontAttributes& rFontAttributes ) : mbEmbeddable( rFontAttributes.mbEmbeddable ) {} - bool FontAttributes::CompareDeviceIndependentFontAttributes(const FontAttributes& rOther) const { if (maFamilyName != rOther.maFamilyName) |