diff options
author | Herbert Duerr <hdu@openoffice.org> | 2007-01-25 11:15:23 +0000 |
---|---|---|
committer | Herbert Duerr <hdu@openoffice.org> | 2007-01-25 11:15:23 +0000 |
commit | 2f37759943f9eea3875c2036d2e17666c12c60d1 (patch) | |
tree | 16a0b7414fa3f3b0f4f29458f4f862426884649b /drawinglayer/source | |
parent | 539dce29d3c45e446929b4aa64fc0124290a8240 (diff) |
#i73860# get text outlines directly as B2D polygons
Diffstat (limited to 'drawinglayer/source')
-rw-r--r-- | drawinglayer/source/primitive2d/textlayoutdevice.cxx | 17 | ||||
-rw-r--r-- | drawinglayer/source/primitive2d/textprimitive2d.cxx | 26 |
2 files changed, 22 insertions, 21 deletions
diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 0156d114ffa2..11c350eeebe4 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -4,9 +4,9 @@ * * $RCSfile: textlayoutdevice.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: aw $ $Date: 2006-10-19 10:35:04 $ + * last change: $Author: hdu $ $Date: 2007-01-25 12:15:23 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -108,8 +108,7 @@ namespace if(!mpVirDev) { mpVirDev = new VirtualDevice(); - mpVirDev->SetMapMode(MAP_100TH_MM); - mpVirDev->SetReferenceDevice(VirtualDevice::REFDEV_MODE06); + mpVirDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 ); } if(!mnUseCount) @@ -142,7 +141,7 @@ namespace drawinglayer namespace primitive2d { // static pointer here - ImpTimedRefDev* pImpGlobalRefDev = 0L; + static ImpTimedRefDev* pImpGlobalRefDev = 0L; // static methods here VirtualDevice& acquireGlobalVirtualDevice() @@ -173,12 +172,12 @@ namespace drawinglayer void TextLayouterDevice::setFont(const Font& rFont) { - mrDevice.SetFont(rFont); + mrDevice.SetFont( rFont ); } void TextLayouterDevice::setFontAttributes(const FontAttributes& rFontAttributes, const basegfx::B2DHomMatrix& rTransform) { - mrDevice.SetFont(getVclFontFromFontAttributes(rFontAttributes, rTransform)); + setFont( getVclFontFromFontAttributes(rFontAttributes, rTransform) ); } double TextLayouterDevice::getTextHeight() @@ -191,9 +190,9 @@ namespace drawinglayer return mrDevice.GetTextWidth(rText, nIndex, nLength); } - bool TextLayouterDevice::getTextOutlines(PolyPolyVector& rPolyPolyVector, const String& rText, xub_StrLen nIndex, xub_StrLen nLength, const ::std::vector< sal_Int32 >& rDXArray) + bool TextLayouterDevice::getTextOutlines( basegfx::B2DPolyPolygonVector& rB2DPolyPolyVector, const String& rText, xub_StrLen nIndex, xub_StrLen nLength, const ::std::vector< sal_Int32 >& rDXArray) { - return mrDevice.GetTextOutlines(rPolyPolyVector, rText, nIndex, nIndex, nLength, true, 0, &(rDXArray[0])); + return mrDevice.GetTextOutlines( rB2DPolyPolyVector, rText, nIndex, nIndex, nLength, true, 0, &(rDXArray[0])); } basegfx::B2DRange TextLayouterDevice::getTextBoundRect(const String& rText, xub_StrLen nIndex, xub_StrLen nLength) diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index 9b09e324d413..387a98b41981 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: textprimitive2d.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2006-12-13 16:57:08 $ + * last change: $Author: hdu $ $Date: 2007-01-25 12:15:23 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -154,13 +154,14 @@ namespace drawinglayer // get outlines TextLayouterDevice aTextLayouter; aTextLayouter.setFontAttributes(getFontAttributes(), getTextTransform()); - PolyPolyVector aPolyPolyVector; - aTextLayouter.getTextOutlines(aPolyPolyVector, getText(), 0L, getText().Len(), aNewIntegerDXArray); - // get result count - const sal_uInt32 nCount(aPolyPolyVector.size()); + basegfx::B2DPolyPolygonVector aB2DPolyPolyVector; + aTextLayouter.getTextOutlines( aB2DPolyPolyVector, + getText(), 0L, getText().Len(), aNewIntegerDXArray); - if(nCount) + // get result count + const sal_uInt32 nCount = aB2DPolyPolyVector.size(); + if( nCount ) { // outlines already have scale and rotate included, so build new transformation basegfx::B2DVector aScale, aTranslate; @@ -172,7 +173,8 @@ namespace drawinglayer if(bShearUsed) { - // The order would be wrong when just adding shear, so rotate back, apply shear, rotate again + // The order would be wrong when just adding shear, + // so rotate back, apply shear, rotate again if(bRotateUsed) { aNewTransform.rotate(-fRotate); @@ -183,7 +185,7 @@ namespace drawinglayer if(bRotateUsed) { - aNewTransform.rotate(fRotate); + aNewTransform.rotate(+fRotate); } } @@ -196,11 +198,11 @@ namespace drawinglayer for(sal_uInt32 a(0L); a < nCount; a++) { // prepare polygon - basegfx::B2DPolyPolygon aPolyPolygon(aPolyPolyVector[a].getB2DPolyPolygon()); - aPolyPolygon.transform(aNewTransform); + basegfx::B2DPolyPolygon& rPolyPolygon = aB2DPolyPolyVector[a]; + rPolyPolygon.transform(aNewTransform); // create primitive - const Primitive2DReference xRef(new PolyPolygonColorPrimitive2D(aPolyPolygon, getFontColor())); + const Primitive2DReference xRef(new PolyPolygonColorPrimitive2D(rPolyPolygon, getFontColor())); aRetval[a] = xRef; } |