#i73860# get text outlines directly as B2D polygons
This commit is contained in:
parent
539dce29d3
commit
2f37759943
2 changed files with 22 additions and 21 deletions
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
||||
basegfx::B2DPolyPolygonVector aB2DPolyPolyVector;
|
||||
aTextLayouter.getTextOutlines( aB2DPolyPolyVector,
|
||||
getText(), 0L, getText().Len(), aNewIntegerDXArray);
|
||||
|
||||
// get result count
|
||||
const sal_uInt32 nCount(aPolyPolyVector.size());
|
||||
|
||||
if(nCount)
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue