Material3: Convert font sizes properly

We need to convert the pt size to px before calculating our
resolution dependent pixel size.
This commit is contained in:
Peter Hartmann 2024-09-30 15:02:39 +02:00 committed by uwerat
parent af34d7b8f2
commit 763ee4b5fb
1 changed files with 5 additions and 2 deletions

View File

@ -1456,12 +1456,15 @@ QskMaterial3Skin::~QskMaterial3Skin()
{ {
} }
static inline QFont createFont( int size, int lineHeight, static inline QFont createFont( int pointSize, int lineHeight,
qreal spacing, QFont::Weight weight ) qreal spacing, QFont::Weight weight )
{ {
Q_UNUSED( lineHeight ); Q_UNUSED( lineHeight );
const int pixelSize = qRound( qskDpToPixels( size ) ); // convert to px according to https://www.w3.org/TR/css3-values/#absolute-lengths :
const double pxSize = pointSize / 72.0 * 96.0;
const int pixelSize = qRound( qskDpToPixels( pxSize ) );
QFont font( QStringLiteral( "Roboto" ), -1, weight ); QFont font( QStringLiteral( "Roboto" ), -1, weight );