Android: Make font size compatible with Qt for iOS

We recommend using pixel sizes for predictable results. For those who
use point sizes in their UIs, we will now give them results that look
similar to what we do on iOS. The default font is changed to give
the same size as before this change.

Task-number: QTBUG-32096
Change-Id: Ia25506ba721a39d31340f3df8bc14129e507af14
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Reviewed-by: BogDan Vatra <bogdan@kde.org>
bb10
Paul Olav Tvete 2013-09-04 14:52:28 +02:00 committed by The Qt Project
parent cfbc575b61
commit ffa4de4bec
3 changed files with 7 additions and 2 deletions

View File

@ -90,7 +90,7 @@ QSizeF QEglFSAndroidHooks::physicalScreenSize() const
QDpi QEglFSAndroidHooks::logicalDpi() const
{
qreal lDpi = QtAndroid::scaledDensity() * 100;
qreal lDpi = QtAndroid::scaledDensity() * 72;
return QDpi(lDpi, lDpi);
}

View File

@ -122,6 +122,11 @@ const QFont *QAndroidPlatformTheme::font(Font type) const
QHash<int, QFont>::const_iterator it = m_androidPlatformNativeInterface->m_fonts.find(fontType(type));
if (it != m_androidPlatformNativeInterface->m_fonts.end())
return &(it.value());
// default in case the style has not set a font
static QFont systemFont("Roboto", 12.0 * 100 / 72); // keep default size the same after changing from 100 dpi to 72 dpi
if (type == QPlatformTheme::SystemFont)
return &systemFont;
return 0;
}

View File

@ -72,6 +72,6 @@ QRegion QAndroidPlatformScreen::doRedraw()
QDpi QAndroidPlatformScreen::logicalDpi() const
{
qreal lDpi = QtAndroid::scaledDensity() * 100;
qreal lDpi = QtAndroid::scaledDensity() * 72;
return QDpi(lDpi, lDpi);
}