summaryrefslogtreecommitdiff
path: root/drawinglayer/source/primitive2d/textlayoutdevice.cxx
diff options
context:
space:
mode:
authorHerbert Duerr <hdu@openoffice.org>2007-02-14 13:53:01 +0000
committerHerbert Duerr <hdu@openoffice.org>2007-02-14 13:53:01 +0000
commit8bfe0eb3e2d732042faf656196620e25a9ee8123 (patch)
tree79387c954fc98e7ac575ca348113d33255ebb969 /drawinglayer/source/primitive2d/textlayoutdevice.cxx
parent597e5c5515724b53f291f3fee4543d0d18b54e91 (diff)
#i73860# add methods for getting textline related metrics, improve const-correctness
Diffstat (limited to 'drawinglayer/source/primitive2d/textlayoutdevice.cxx')
-rw-r--r--drawinglayer/source/primitive2d/textlayoutdevice.cxx35
1 files changed, 30 insertions, 5 deletions
diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index 6b14cc69284e..769f7cffea1e 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -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)
{