Congratulations to our 2022 Qt Champions!

RGB colour values slightly different on embedded device in QT 4.8.5

  • Hi,

    I am printing text 'Enter username' on a new embedded device using Linux and QT 4.8.5. The QT Painter font is set to: "AR Fruda Sans", weight is QFont::Normal, font size is 15.

    Letter ‘E’ in ‘Enter username’ on a screen, pixel 11.11 in the top left corner of the letter 'E', shows one bit difference between RGB color values (RGB values for Red-Green-Blue of that pixel on the old device are 235 and the on new device are 234). The same one bit difference is around the edges of every letter (where grey scale rendering is done). In all cases the colour is off only by 1 bit. Sometimes it is +1 sometimes -1:
    Old Device RBG = 235,235,235 or 95,95,95 or 240,240,240 or 209,209,209
    New Device RBG = 234,234,234 or 94,94,94 or 241,241,241 or 210,210,210

    Is there a way to attach the bmp file to this posting so you can see what it's like?

    The old device is using 32 bit encoding and the new device 24 bit encoding. There were QT compile optimizations introduced on the new device. The old device is using QT 4.8.3 and the new device QT 4.8.5.

    1. Have anyone experienced this kind of problem?
    2. Which Qt file and function on embedded Linux calculates the pixel RGB values while encoding the letter 'E' into AR Fruda Sans font?

    Dusan Mudric.


    Here are all the values passed to QT Painter:

    m_pPainter->setFont(m_CurrentFont); // QFont m_CurrentFont is set to: Font.m_sFamily = "AR Fruda Sans", Weight=QFont::Normal, font.m_nSize=15
    m_pPainter->setPen(QColor(color.m_nRed=84, color.m_nGreen=84, color.m_nBlue=84)); // All three values were 84
    QFontMetricsF fontmatrix(m_CurrentFont);
    qStr = fontmatrix.elidedText(qStr, eMode=Qt::ElideRight, nWidth=252);
    m_pPainter->drawText(rect.m_nLeft=5, rect.m_nTop=0, rect.GetWidth()=252, rect.GetHeight()=34, nFlags, qStr= “Enter username”); 

Log in to reply