[Libreoffice-commits] core.git: Branch 'aoo/trunk' - vcl/aqua

Herbert Dürr hdu at apache.org
Tue May 6 03:07:37 PDT 2014


 vcl/aqua/source/gdi/ctfonts.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 0ee124496ac74172f41ed2e116fd554130036824
Author: Herbert Dürr <hdu at apache.org>
Date:   Tue May 6 09:07:50 2014 +0000

    #i124823# fix the calculation of leading metrics for CoreText

diff --git a/vcl/aqua/source/gdi/ctfonts.cxx b/vcl/aqua/source/gdi/ctfonts.cxx
index d7f3a2d..6d4ae40 100644
--- a/vcl/aqua/source/gdi/ctfonts.cxx
+++ b/vcl/aqua/source/gdi/ctfonts.cxx
@@ -176,10 +176,13 @@ void CTTextStyle::GetFontMetric( float fDPIY, ImplFontMetricData& rMetric ) cons
     CTFontRef aCTFontRef = (CTFontRef)CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName );
 
     const double fPixelSize = (mfFontScale * fDPIY);
-    rMetric.mnAscent       = lrint( CTFontGetAscent( aCTFontRef ) * fPixelSize);
+    const CGFloat fAscent = CTFontGetAscent( aCTFontRef );
+    const CGFloat fCapHeight = CTFontGetCapHeight( aCTFontRef );
+    rMetric.mnAscent       = lrint( fAscent * fPixelSize);
     rMetric.mnDescent      = lrint( CTFontGetDescent( aCTFontRef ) * fPixelSize);
-    rMetric.mnIntLeading   = lrint( CTFontGetLeading( aCTFontRef ) * fPixelSize);
-    rMetric.mnExtLeading   = 0;
+    rMetric.mnExtLeading   = lrint( CTFontGetLeading( aCTFontRef ) * fPixelSize);
+    rMetric.mnIntLeading   = lrint( (fAscent - fCapHeight) * fPixelSize);
+
     // since ImplFontMetricData::mnWidth is only used for stretching/squeezing fonts
     // setting this width to the pixel height of the fontsize is good enough
     // it also makes the calculation of the stretch factor simple


More information about the Libreoffice-commits mailing list