Author: hdu
Date: Fri Jun 13 10:04:54 2014
New Revision: 1602358

URL: http://svn.apache.org/r1602358
Log:
#i124823# fix the calculation of leading metrics for CoreText

Merged from AOO's trunk revision 1592692

Modified:
    openoffice/branches/AOO410/   (props changed)
    openoffice/branches/AOO410/main/   (props changed)
    openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctfonts.cxx

Propchange: openoffice/branches/AOO410/
------------------------------------------------------------------------------
  Merged /openoffice/trunk:r1592692

Propchange: openoffice/branches/AOO410/main/
------------------------------------------------------------------------------
  Merged /openoffice/trunk/main:r1592692

Modified: openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctfonts.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctfonts.cxx?rev=1602358&r1=1602357&r2=1602358&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctfonts.cxx (original)
+++ openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctfonts.cxx Fri Jun 13 
10:04:54 2014
@@ -176,10 +176,13 @@ void CTTextStyle::GetFontMetric( float f
        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


Reply via email to