src/gui/text/qfontengine_mac.mm
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   402 {
   402 {
   403     return QFixed::fromReal(CTFontGetAscent(ctfont)).ceil();
   403     return QFixed::fromReal(CTFontGetAscent(ctfont)).ceil();
   404 }
   404 }
   405 QFixed QCoreTextFontEngine::descent() const
   405 QFixed QCoreTextFontEngine::descent() const
   406 {
   406 {
   407     return QFixed::fromReal(CTFontGetDescent(ctfont)).ceil();
   407     // subtract a pixel to even out the historical +1 in QFontMetrics::height().
       
   408     // Fix in Qt 5.
       
   409     return QFixed::fromReal(CTFontGetDescent(ctfont)).ceil() - 1;
   408 }
   410 }
   409 QFixed QCoreTextFontEngine::leading() const
   411 QFixed QCoreTextFontEngine::leading() const
   410 {
   412 {
   411     return QFixed::fromReal(CTFontGetLeading(ctfont)).ceil();
   413     return QFixed::fromReal(CTFontGetLeading(ctfont)).ceil();
   412 }
   414 }
   544 
   546 
   545     CGAffineTransform cgMatrix = CGAffineTransformIdentity;
   547     CGAffineTransform cgMatrix = CGAffineTransformIdentity;
   546     cgMatrix = CGAffineTransformScale(cgMatrix, 1, -1);
   548     cgMatrix = CGAffineTransformScale(cgMatrix, 1, -1);
   547 
   549 
   548     if (synthesisFlags & QFontEngine::SynthesizedItalic)
   550     if (synthesisFlags & QFontEngine::SynthesizedItalic)
   549         cgMatrix = CGAffineTransformConcat(cgMatrix, CGAffineTransformMake(1, 0, tanf(14 * acosf(0) / 90), 1, 0, 0));
   551         cgMatrix = CGAffineTransformConcat(cgMatrix, CGAffineTransformMake(1, 0, -tanf(14 * acosf(0) / 90), 1, 0, 0));
   550 
   552 
   551 
   553 
   552     for (int i = 0; i < nGlyphs; ++i) {
   554     for (int i = 0; i < nGlyphs; ++i) {
   553         QCFType<CGPathRef> cgpath = CTFontCreatePathForGlyph(ctfont, glyphs[i], &cgMatrix);
   555         QCFType<CGPathRef> cgpath = CTFontCreatePathForGlyph(ctfont, glyphs[i], &cgMatrix);
   554         ConvertPathInfo info(path, positions[i].toPointF());
   556         ConvertPathInfo info(path, positions[i].toPointF());
  1404     return m_ascent;
  1406     return m_ascent;
  1405 }
  1407 }
  1406 
  1408 
  1407 QFixed QFontEngineMac::descent() const
  1409 QFixed QFontEngineMac::descent() const
  1408 {
  1410 {
  1409     return m_descent;
  1411     // subtract a pixel to even out the historical +1 in QFontMetrics::height().
       
  1412     // Fix in Qt 5.
       
  1413     return m_descent - 1;
  1410 }
  1414 }
  1411 
  1415 
  1412 QFixed QFontEngineMac::leading() const
  1416 QFixed QFontEngineMac::leading() const
  1413 {
  1417 {
  1414     return m_leading;
  1418     return m_leading;