diff options
author | Armin Le Grand <alg@apache.org> | 2012-12-10 16:08:58 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-06-08 19:27:03 +0100 |
commit | 1281c1f52b77c4c4fb08e129542c2c4912b38555 (patch) | |
tree | 9d359640355484084a985b738d27a3df93eee74d /vcl | |
parent | ec2512209d8fbf640749ab9f18b2232ac9cbf060 (diff) |
Resolves: #i121382# Corrected size handling including font size handling...
for EMF/WMF imports
(cherry picked from commit 0ce59463f93b1c1fe78d18476249259bfc7e440e)
Conflicts:
svtools/source/filter/wmf/enhwmf.cxx
svtools/source/filter/wmf/winmtf.cxx
svtools/source/filter/wmf/winmtf.hxx
Change-Id: Ib1ea92a1d52ea83ee7ad48a8bda2496cda9dcc53
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/filter/wmf/enhwmf.cxx | 11 | ||||
-rw-r--r-- | vcl/source/filter/wmf/winmtf.cxx | 10 | ||||
-rw-r--r-- | vcl/source/filter/wmf/winmtf.hxx | 1 |
3 files changed, 19 insertions, 3 deletions
diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx index d024ee3437d6..c97cfdc53296 100644 --- a/vcl/source/filter/wmf/enhwmf.cxx +++ b/vcl/source/filter/wmf/enhwmf.cxx @@ -20,6 +20,7 @@ #include "winmtf.hxx" #include <osl/endian.h> +#include <basegfx/matrix/b2dhommatrix.hxx> #include <boost/bind.hpp> using namespace std; @@ -1170,6 +1171,16 @@ sal_Bool EnhWMFReader::ReadEnhWMF() lfFaceName[ i ] = nChar; } aLogFont.alfFaceName = OUString( lfFaceName ); + + // #i121382# Need to apply WorldTransform to FontHeight/Width; this should be completely + // changed to basegfx::B2DHomMatrix instead of 'struct XForm', but not now due to time + // constraints and dangers + const XForm& rXF = pOut->GetWorldTransform(); + const basegfx::B2DHomMatrix aWT(rXF.eM11, rXF.eM21, rXF.eDx, rXF.eM12, rXF.eM22, rXF.eDy); + const basegfx::B2DVector aTransVec(aWT * basegfx::B2DVector(aLogFont.lfWidth, aLogFont.lfHeight)); + aLogFont.lfWidth = aTransVec.getX(); + aLogFont.lfHeight = aTransVec.getY(); + pOut->CreateObject( nIndex, GDI_FONT, new WinMtfFontStyle( aLogFont ) ); } } diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx index 43aaf5e13e26..42d605c2e02c 100644 --- a/vcl/source/filter/wmf/winmtf.cxx +++ b/vcl/source/filter/wmf/winmtf.cxx @@ -464,8 +464,9 @@ Size WinMtfOutput::ImplMap( const Size& rSz ) { if ( mnWinExtX && mnWinExtY ) { - double fWidth = rSz.Width() * maXForm.eM11; - double fHeight = rSz.Height() * maXForm.eM22; + // #i121382# apply the whole WorldTransform, else a rotation will be misinterpreted + double fWidth = rSz.Width() * maXForm.eM11 + rSz.Height() * maXForm.eM21; + double fHeight = rSz.Width() * maXForm.eM12 + rSz.Height() * maXForm.eM22; if ( mnGfxMode == GM_COMPATIBLE ) { @@ -1458,7 +1459,10 @@ void WinMtfOutput::DrawText( Point& rPosition, String& rText, sal_Int32* pDXArry for( i = 0, nSum = 0; i < nLen; i++ ) { if ( i ) { - pDXArry[ i - 1 ] = ImplMap( Size( nSum, 0 ) ).Width(); + // #i121382# Map DXArray using WorldTransform + const Size aSize(ImplMap(Size( nSum, 0))); + const basegfx::B2DVector aVector(aSize.Width(), aSize.Height()); + pDXArry[ i - 1 ] = basegfx::fround(aVector.getLength()); } nSum += pDXArry[ i ]; } diff --git a/vcl/source/filter/wmf/winmtf.hxx b/vcl/source/filter/wmf/winmtf.hxx index bec5d8ae3c7b..15c36a75dd06 100644 --- a/vcl/source/filter/wmf/winmtf.hxx +++ b/vcl/source/filter/wmf/winmtf.hxx @@ -681,6 +681,7 @@ public: void SetMapMode( sal_uInt32 mnMapMode ); void SetUnitsPerInch( sal_uInt16 nUnitsPerInch ); void SetWorldTransform( const XForm& rXForm ); + const XForm& GetWorldTransform() const { return maXForm; } void ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode ); void Push(); |