[Libreoffice-commits] core.git: vcl/quartz

Herbert Dürr hdu at apache.org
Thu May 15 03:52:41 PDT 2014


 vcl/quartz/ctfonts.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit f4ea8c2f73034cd43aca4262994e8a9aaa118b0a
Author: Herbert Dürr <hdu at apache.org>
Date:   Thu May 15 13:15:37 2014 +0300

    AOO: #i124823# fix the calculation of leading metrics for CoreText
    
    tml says: As such, for us the sample document from the above AOO issue
    already gets laid out corectly (according to how the bug reporter says
    it should be laid out), both in master and 4.2. We already set the
    external leading field based on what CTFontGetLeading() says.
    
    Also, our code around here is a little bit different as we don't have
    any fFPIY paramter or mfFontScale field, so the change did not apply
    directly.
    
    But I adapted it and applied anyway. Effectively, for us the only
    change is that the internal leading is now returned as non-zero. No
    visible change to the sample document's layout.
    
    Change-Id: I4f8967723e371fa2b695f726ff2f28c0f6d6ae27

diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 4382cae..bede546 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -121,10 +121,13 @@ void CoreTextStyle::GetFontMetric( ImplFontMetricData& rMetric ) const
     // TODO: is it worth it to cache the CTFontRef in SetFont() and reuse it here?
     CTFontRef aCTFontRef = (CTFontRef)CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName );
 
-    rMetric.mnAscent       = CTFontGetAscent( aCTFontRef );
+    const CGFloat fAscent = CTFontGetAscent( aCTFontRef );
+    const CGFloat fCapHeight = CTFontGetCapHeight( aCTFontRef );
+    rMetric.mnAscent       = fAscent;
     rMetric.mnDescent      = CTFontGetDescent( aCTFontRef );
     rMetric.mnExtLeading   = CTFontGetLeading( aCTFontRef );
-    rMetric.mnIntLeading   = 0;
+    rMetric.mnIntLeading   = fAscent - fCapHeight;
+
     // 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