Normalize font BBox to make sure it's correct when rendering a PDF on the mac.
authorvandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 28 Aug 2012 19:47:43 +0000 (19:47 +0000)
committervandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 28 Aug 2012 19:47:43 +0000 (19:47 +0000)
Original CL by abodenha@chromium.org: https://codereview.appspot.com/6501049/
BUG=crbug.com/124572

Review URL: https://codereview.appspot.com/6492048

git-svn-id: http://skia.googlecode.com/svn/trunk@5325 2bbb7eff-a529-9590-31e7-b0007b416f81

src/ports/SkFontHost_mac_coretext.cpp

index d6a2543..21fb2ed 100644 (file)
@@ -1609,8 +1609,11 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
     info->fDescent = (int16_t) CTFontGetDescent(ctFont);
     info->fCapHeight = (int16_t) CTFontGetCapHeight(ctFont);
     CGRect bbox = CTFontGetBoundingBox(ctFont);
-    info->fBBox = SkIRect::MakeXYWH((int16_t) bbox.origin.x, (int16_t) bbox.origin.y,
-        (int16_t) bbox.size.width, (int16_t) bbox.size.height);
+    info->fBBox = SkIRect::MakeLTRB(
+            CGToScalar(CGRectGetMinX_inline(bbox)),   // Left
+            CGToScalar(CGRectGetMaxY_inline(bbox)),   // Top
+            CGToScalar(CGRectGetMaxX_inline(bbox)),   // Right
+            CGToScalar(CGRectGetMinY_inline(bbox)));  // Bottom
 
     // Figure out a good guess for StemV - Min width of i, I, !, 1.
     // This probably isn't very good with an italic font.