summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorHerbert Dürr <hdu@apache.org>2014-05-15 13:15:37 +0300
committerTor Lillqvist <tml@collabora.com>2014-05-15 13:51:14 +0300
commitf4ea8c2f73034cd43aca4262994e8a9aaa118b0a (patch)
tree50e5b4a56fc86dd718841add2a7967a88b2771a2 /vcl
parenta4f32eec653596483088c6e5aa37de031278d74c (diff)
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
Diffstat (limited to 'vcl')
-rw-r--r--vcl/quartz/ctfonts.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 4382caef0c44..bede546c836b 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