summaryrefslogtreecommitdiff
path: root/cppcanvas/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-08-18 09:25:40 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-08-18 12:53:31 +0200
commit88bf1749f1eb7322106da1254e349f51f5df0df5 (patch)
tree9dede2758a1cdc913b04b0bd76aca981f838254e /cppcanvas/source
parent821ae763cc03f69e226cdba66bb9c82c03483a23 (diff)
undo changes to TextAlign
revert commit 8689bd5490b473a7ffb149bbe5f7f0683f679c72 Author: Caolán McNamara <caolanm@redhat.com> Date: Thu Jul 29 20:49:29 2021 +0100 convert TextAlign to scoped enum lets leave this as it always was Change-Id: Id4d2a5644974cdd2b0ed6d361d5c52629674d057 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120626 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cppcanvas/source')
-rw-r--r--cppcanvas/source/inc/outdevstate.hxx2
-rw-r--r--cppcanvas/source/mtfrenderer/mtftools.cxx26
2 files changed, 16 insertions, 12 deletions
diff --git a/cppcanvas/source/inc/outdevstate.hxx b/cppcanvas/source/inc/outdevstate.hxx
index 09b70b6cdcd5..16cc3c4ff25a 100644
--- a/cppcanvas/source/inc/outdevstate.hxx
+++ b/cppcanvas/source/inc/outdevstate.hxx
@@ -63,7 +63,7 @@ namespace cppcanvas::internal
textOverlineStyle(LINESTYLE_NONE),
textUnderlineStyle(LINESTYLE_NONE),
textStrikeoutStyle(STRIKEOUT_NONE),
- textReferencePoint(TextAlign::Baseline),
+ textReferencePoint(ALIGN_BASELINE),
isTextOutlineModeSet( false ),
isTextEffectShadowSet( false ),
diff --git a/cppcanvas/source/mtfrenderer/mtftools.cxx b/cppcanvas/source/mtfrenderer/mtftools.cxx
index 52e35b73dc0c..c5d36eb00652 100644
--- a/cppcanvas/source/mtfrenderer/mtftools.cxx
+++ b/cppcanvas/source/mtfrenderer/mtftools.cxx
@@ -51,24 +51,28 @@ namespace cppcanvas::tools
::Size getBaselineOffset( const ::cppcanvas::internal::OutDevState& outdevState,
const VirtualDevice& rVDev )
{
- ::Size aRet(0, 0);
const ::FontMetric& aMetric = rVDev.GetFontMetric();
// calc offset for text output, the XCanvas always renders
// baseline offset.
switch( outdevState.textReferencePoint )
{
- case TextAlign::Baseline:
- break;
- case TextAlign::Top:
- aRet = ::Size(0, aMetric.GetInternalLeading() + aMetric.GetAscent());
- break;
- case TextAlign::Bottom:
- aRet = ::Size(0, -aMetric.GetDescent());
- break;
- }
+ case ALIGN_TOP:
+ return ::Size( 0,
+ aMetric.GetInternalLeading() + aMetric.GetAscent() );
- return aRet;
+ default:
+ ENSURE_OR_THROW( false,
+ "tools::getBaselineOffset(): Unexpected TextAlign value" );
+ // FALLTHROUGH intended (to calm compiler warning - case won't happen)
+ case ALIGN_BASELINE:
+ return ::Size( 0, 0 );
+
+ case ALIGN_BOTTOM:
+ return ::Size( 0,
+ -aMetric.GetDescent() );
+
+ }
}
::basegfx::B2DHomMatrix& calcLogic2PixelLinearTransform( ::basegfx::B2DHomMatrix& o_rMatrix,