tdf#103895: Another fix too macOS glyph bounding

Apply font rotation when calculating glyph bounding rectangle.

Change-Id: I9c533ec3b33a5858d46b60d1700a50d3b6f915a4
This commit is contained in:
Khaled Hosny
2016-11-13 18:59:44 +02:00
parent e760de7db5
commit ebfe8bb2b2

View File

@@ -167,7 +167,11 @@ bool CoreTextStyle::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect )
SAL_WNODEPRECATED_DECLARATIONS_PUSH //TODO: 10.11 kCTFontDefaultOrientation
const CTFontOrientation aFontOrientation = kCTFontDefaultOrientation; // TODO: horz/vert
SAL_WNODEPRECATED_DECLARATIONS_POP
const CGRect aCGRect = CTFontGetBoundingRectsForGlyphs( aCTFontRef, aFontOrientation, &nCGGlyph, nullptr, 1 );
CGRect aCGRect = CTFontGetBoundingRectsForGlyphs(aCTFontRef, aFontOrientation, &nCGGlyph, nullptr, 1);
// Apply font rotation to non-upright glyphs.
if (mfFontRotation && !(aGlyphId & GF_ROTMASK))
aCGRect = CGRectApplyAffineTransform(aCGRect, CGAffineTransformMakeRotation(mfFontRotation));
rRect.Left() = lrint( aCGRect.origin.x );
rRect.Top() = lrint(-aCGRect.origin.y );