<rdar://problem/9973194> Fonts that specify a positive descender value are treated...
[WebKit-https.git] / Source / WebCore / platform / graphics / mac / SimpleFontDataMac.mm
index 75ceeaefcffa2db97776447f0a44cd93c4d865ff..43f7f69474187c31f3eefa9f7793d0c913653cc9 100644 (file)
@@ -187,7 +187,9 @@ void SimpleFontData::platformInit()
     int iLineGap;
     unsigned unitsPerEm;
     iAscent = CGFontGetAscent(m_platformData.cgFont());
-    iDescent = CGFontGetDescent(m_platformData.cgFont());
+    // Some fonts erroneously specify a positive descender value. We follow Core Text in assuming that
+    // such fonts meant the same distance, but in the reverse direction.
+    iDescent = -abs(CGFontGetDescent(m_platformData.cgFont()));
     iLineGap = CGFontGetLeading(m_platformData.cgFont());
     unitsPerEm = CGFontGetUnitsPerEm(m_platformData.cgFont());