Kaydet (Commit) f4ea8c2f authored tarafından Herbert Dürr's avatar Herbert Dürr Kaydeden (comit) Tor Lillqvist

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
üst a4f32eec
...@@ -121,10 +121,13 @@ void CoreTextStyle::GetFontMetric( ImplFontMetricData& rMetric ) const ...@@ -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? // TODO: is it worth it to cache the CTFontRef in SetFont() and reuse it here?
CTFontRef aCTFontRef = (CTFontRef)CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName ); 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.mnDescent = CTFontGetDescent( aCTFontRef );
rMetric.mnExtLeading = CTFontGetLeading( aCTFontRef ); rMetric.mnExtLeading = CTFontGetLeading( aCTFontRef );
rMetric.mnIntLeading = 0; rMetric.mnIntLeading = fAscent - fCapHeight;
// since ImplFontMetricData::mnWidth is only used for stretching/squeezing fonts // since ImplFontMetricData::mnWidth is only used for stretching/squeezing fonts
// setting this width to the pixel height of the fontsize is good enough // setting this width to the pixel height of the fontsize is good enough
// it also makes the calculation of the stretch factor simple // it also makes the calculation of the stretch factor simple
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment