#i73860# add methods for getting textline related metrics, improve const-correctness
This commit is contained in:
parent
597e5c5515
commit
8bfe0eb3e2
2 changed files with 40 additions and 10 deletions
|
@ -4,9 +4,9 @@
|
|||
*
|
||||
* $RCSfile: textlayoutdevice.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: hdu $ $Date: 2007-02-02 15:13:57 $
|
||||
* last change: $Author: hdu $ $Date: 2007-02-14 14:53:01 $
|
||||
*
|
||||
* The Contents of this file are made available subject to
|
||||
* the terms of GNU Lesser General Public License Version 2.1.
|
||||
|
@ -87,12 +87,17 @@ namespace drawinglayer
|
|||
|
||||
void setFont(const Font& rFont);
|
||||
void setFontAttributes(const FontAttributes& rFontAttributes, const basegfx::B2DHomMatrix& rTransform);
|
||||
double getTextHeight();
|
||||
double getTextWidth(const String& rText, xub_StrLen nIndex, xub_StrLen nLength);
|
||||
|
||||
double getTextHeight() const;
|
||||
double getUnderlineHeight() const;
|
||||
double getUnderlineOffset() const;
|
||||
double getStrikeoutOffset() const;
|
||||
|
||||
double getTextWidth(const String& rText, xub_StrLen nIndex, xub_StrLen nLength) const;
|
||||
bool getTextOutlines( basegfx::B2DPolyPolygonVector&,
|
||||
const String&, xub_StrLen nIndex, xub_StrLen nLength,
|
||||
const ::std::vector< sal_Int32 >& rDXArray );
|
||||
basegfx::B2DRange getTextBoundRect(const String& rText, xub_StrLen nIndex, xub_StrLen nLength);
|
||||
basegfx::B2DRange getTextBoundRect(const String& rText, xub_StrLen nIndex, xub_StrLen nLength) const;
|
||||
};
|
||||
} // end of namespace primitive2d
|
||||
} // end of namespace drawinglayer
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
*
|
||||
* $RCSfile: textlayoutdevice.cxx,v $
|
||||
*
|
||||
* $Revision: 1.3 $
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* last change: $Author: hdu $ $Date: 2007-02-13 08:07:43 $
|
||||
* last change: $Author: hdu $ $Date: 2007-02-14 14:53:01 $
|
||||
*
|
||||
* The Contents of this file are made available subject to
|
||||
* the terms of GNU Lesser General Public License Version 2.1.
|
||||
|
@ -49,6 +49,10 @@
|
|||
#include <vcl/font.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _SV_METRIC_HXX
|
||||
#include <vcl/metric.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTPRIMITIVE2D_HXX
|
||||
#include <drawinglayer/primitive2d/textprimitive2d.hxx>
|
||||
#endif
|
||||
|
@ -180,12 +184,33 @@ namespace drawinglayer
|
|||
setFont( getVclFontFromFontAttributes(rFontAttributes, rTransform) );
|
||||
}
|
||||
|
||||
double TextLayouterDevice::getTextHeight()
|
||||
double TextLayouterDevice::getUnderlineOffset() const
|
||||
{
|
||||
const ::FontMetric& rMetric = mrDevice.GetFontMetric();
|
||||
double fRet = rMetric.GetDescent() / 2.0;
|
||||
return fRet;
|
||||
}
|
||||
|
||||
double TextLayouterDevice::getStrikeoutOffset() const
|
||||
{
|
||||
const ::FontMetric& rMetric = mrDevice.GetFontMetric();
|
||||
double fRet = (rMetric.GetAscent() - rMetric.GetIntLeading()) / 3.0;
|
||||
return fRet;
|
||||
}
|
||||
|
||||
double TextLayouterDevice::getUnderlineHeight() const
|
||||
{
|
||||
const ::FontMetric& rMetric = mrDevice.GetFontMetric();
|
||||
double fRet = rMetric.GetDescent() / 4.0;
|
||||
return fRet;
|
||||
}
|
||||
|
||||
double TextLayouterDevice::getTextHeight() const
|
||||
{
|
||||
return mrDevice.GetTextHeight();
|
||||
}
|
||||
|
||||
double TextLayouterDevice::getTextWidth(const String& rText, xub_StrLen nIndex, xub_StrLen nLength)
|
||||
double TextLayouterDevice::getTextWidth(const String& rText, xub_StrLen nIndex, xub_StrLen nLength) const
|
||||
{
|
||||
return mrDevice.GetTextWidth(rText, nIndex, nLength);
|
||||
}
|
||||
|
@ -196,7 +221,7 @@ namespace drawinglayer
|
|||
return mrDevice.GetTextOutlines( rB2DPolyPolyVector, rText, nIndex, nIndex, nLength, true, 0, pDXArray);
|
||||
}
|
||||
|
||||
basegfx::B2DRange TextLayouterDevice::getTextBoundRect(const String& rText, xub_StrLen nIndex, xub_StrLen nLength)
|
||||
basegfx::B2DRange TextLayouterDevice::getTextBoundRect(const String& rText, xub_StrLen nIndex, xub_StrLen nLength) const
|
||||
{
|
||||
if(rText.Len() && nLength)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue