summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qa/cppunit/complextext.cxx2
-rw-r--r--vcl/source/font/fontmetric.cxx25
2 files changed, 16 insertions, 11 deletions
diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index 5828a16c77a4..a0fba312aa9f 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -85,7 +85,7 @@ void VclComplexTextTest::testArabic()
// text advance width and line height
CPPUNIT_ASSERT_EQUAL(72L, pOutDev->GetTextWidth(aOneTwoThree));
- CPPUNIT_ASSERT_EQUAL(13L, pOutDev->GetTextHeight());
+ CPPUNIT_ASSERT_EQUAL(14L, pOutDev->GetTextHeight());
// exact bounding rectangle, not essentially the same as text width/height
#if defined(MACOSX) || defined(_WIN32)
diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index b8e7f1e748ff..23954b3c67d9 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -412,6 +412,7 @@ void ImplFontMetricData::ImplCalcLineSpacing(const std::vector<uint8_t>& rHheaDa
mnAscent = mnDescent = mnExtLeading = mnIntLeading = 0;
double fScale = static_cast<double>(mnHeight) / nUPEM;
+ double fAscent = 0, fDescent = 0, fExtLeading = 0;
vcl::TTGlobalFontInfo rInfo;
memset(&rInfo, 0, sizeof(vcl::TTGlobalFontInfo));
@@ -420,30 +421,34 @@ void ImplFontMetricData::ImplCalcLineSpacing(const std::vector<uint8_t>& rHheaDa
// Try hhea table first.
if (rInfo.ascender || rInfo.descender)
{
- mnAscent = rInfo.ascender * fScale;
- mnDescent = -rInfo.descender * fScale;
- mnExtLeading = rInfo.linegap * fScale;
+ fAscent = rInfo.ascender * fScale;
+ fDescent = -rInfo.descender * fScale;
+ fExtLeading = rInfo.linegap * fScale;
}
// But if OS/2 is present, prefer it.
if (rInfo.winAscent || rInfo.winDescent || rInfo.typoAscender || rInfo.typoDescender)
{
- if (mnAscent == 0 && mnDescent == 0)
+ if (fAscent == 0 && fDescent == 0)
{
- mnAscent = rInfo.winAscent * fScale;
- mnDescent = rInfo.winDescent * fScale;
- mnExtLeading = 0;
+ fAscent = rInfo.winAscent * fScale;
+ fDescent = rInfo.winDescent * fScale;
+ fExtLeading = 0;
}
const uint16_t kUseTypoMetricsMask = 1 << 7;
if (rInfo.fsSelection & kUseTypoMetricsMask)
{
- mnAscent = rInfo.typoAscender * fScale;
- mnDescent = -rInfo.typoDescender * fScale;
- mnExtLeading = rInfo.typoLineGap * fScale;
+ fAscent = rInfo.typoAscender * fScale;
+ fDescent = -rInfo.typoDescender * fScale;
+ fExtLeading = rInfo.typoLineGap * fScale;
}
}
+ mnAscent = round(fAscent);
+ mnDescent = round(fDescent);
+ mnExtLeading = round(fExtLeading);
+
if (mnAscent || mnDescent)
mnIntLeading = mnAscent + mnDescent - mnHeight;