diff options
Diffstat (limited to 'svx/source/customshapes')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx index 5ce861bc0407..bee68428313a 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -252,6 +252,10 @@ void CalculateHorizontalScalingFactor( if (nFontSize > 1) rFWData.fVerticalTextScaling = static_cast<double>(nFontSize) / rFontHeight.GetHeight(); + // Add some padding + if (rFWData.bScaleX) + fScalingFactor *= 1.1; + rFWData.fHorizontalTextScaling = fScalingFactor; } @@ -531,11 +535,16 @@ bool GetFontWorkOutline( } else if (rFWData.bScaleX) { + const SdrTextVertAdjust nVertJustify = rSdrObjCustomShape.GetMergedItem( SDRATTR_TEXT_VERTADJUST ).GetValue(); + double fFactor = nVertJustify == SdrTextVertAdjust::SDRTEXTVERTADJUST_BOTTOM ? -0.5 : ( nVertJustify == SdrTextVertAdjust::SDRTEXTVERTADJUST_TOP ? 0.5 : 0 ); + std::vector< FWParagraphData >::iterator aParagraphIter( aTextAreaIter->vParagraphs.begin() ); std::vector< FWParagraphData >::const_iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() ); while ( aParagraphIter != aParagraphIEnd ) { sal_Int32 nHorzDiff = 0; + sal_Int32 nVertDiff = static_cast<double>( rFWData.nSingleLineHeight ) * fFactor * ( aTextAreaIter->vParagraphs.size() - 1 ); + if ( eHorzAdjust == SDRTEXTHORZADJUST_CENTER ) nHorzDiff = ( rFWData.fHorizontalTextScaling * aTextAreaIter->aBoundRect.GetWidth() - aParagraphIter->aBoundRect.GetWidth() ) / 2; else if ( eHorzAdjust == SDRTEXTHORZADJUST_RIGHT ) @@ -551,7 +560,7 @@ bool GetFontWorkOutline( std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd = aCharacterIter->vOutlines.end(); while( aOutlineIter != aOutlineIEnd ) { - aOutlineIter->Move( nHorzDiff, 0 ); + aOutlineIter->Move( nHorzDiff, nVertDiff ); ++aOutlineIter; } ++aCharacterIter; |