Ticket #12057: italic-pad.patch

File italic-pad.patch, 1.2 KB (added by faginbagin <mythtv@…>, 10 years ago)
  • mythtv/libs/libmythtv/subtitlescreen.cpp

    diff --git a/mythtv/libs/libmythtv/subtitlescreen.cpp b/mythtv/libs/libmythtv/subtitlescreen.cpp
    index 62fdf1c..6f185d0 100644
    a b bool FormattedTextChunk::PreRender(bool isFirst, bool isLast, 
    711711    textRect = QRect(x + x_adjust, y,
    712712                     chunk_sz.width() - x_adjust + rightPadding, height);
    713713
     714    // If this chunk is in italics, add a few pixels to the width.
     715    // This is to compensate for some font/char combos that would otherwise
     716    // have the top right corner of the last char clipped.
     717    // The effect can be seen with Droid Sans Mono and certain upper case chars
     718    // like E or W.
     719    // But don't add this padding to the next chunk's x coordinate.
     720    // That would add too much spacing between chunks.
     721    if (m_format.italics)
     722    {
     723        int oldWidth = textRect.width();
     724        textRect.setWidth(oldWidth + font.averageCharWidth() / 2);
     725        LOG(VB_VBI, LOG_DEBUG,
     726            QString("Pad for italics width %1 -> %2")
     727            .arg(oldWidth).arg(textRect.width()));
     728    }
     729
    714730    // Make sure width is non-zero
    715731    if (textRect.width() == 0)
    716732    {