diff options
Diffstat (limited to 'cppcanvas/source')
-rw-r--r-- | cppcanvas/source/inc/outdevstate.hxx | 2 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/mtftools.cxx | 26 |
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, |