diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-05-30 12:07:59 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-05-30 12:07:59 +0200 |
commit | ea7e2abd8b650feb3f0f0057d618dd3d4a14fcd7 (patch) | |
tree | 0510f859cc26fc1e1bfedcc1134c44f7573006b3 /src/application.cpp | |
parent | Merge commit 'refs/merge-requests/125' of git://gitorious.org/rekonq/mainline... (diff) | |
download | rekonq-ea7e2abd8b650feb3f0f0057d618dd3d4a14fcd7.tar.xz |
Fixing fonts..
This commit changes *A LOT* rekonq behavior on fonts.
To fix all, I had to (re)introduce some (old)new strings. Sorry!
- Adopted default KDE fonts for default & fixed settings
- calculating LogicalDpiY from font dimension (points to pixels) (This has been copied from KWebKitPart, as suggested)
- reenabled 16px as default font size
WARNING: As we are now calculating well the font size, you'll see BIG chars on clean pages.. :)
Diffstat (limited to 'src/application.cpp')
-rw-r--r-- | src/application.cpp | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/src/application.cpp b/src/application.cpp index e849afc1..fb52dc51 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -433,30 +433,26 @@ void Application::updateConfiguration() QWebSettings *defaultSettings = QWebSettings::globalSettings(); - // =========== Fonts ============== - QFont standardFont = ReKonfig::standardFont(); - defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize()); - - QFont fixedFont = ReKonfig::fixedFont(); - defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize()); - - QFont serifFont = ReKonfig::serifFont(); - defaultSettings->setFontFamily(QWebSettings::SerifFont, serifFont.family()); - - QFont sansSerifFont = ReKonfig::sansSerifFont(); - defaultSettings->setFontFamily(QWebSettings::SansSerifFont, sansSerifFont.family()); - - QFont cursiveFont = ReKonfig::cursiveFont(); - defaultSettings->setFontFamily(QWebSettings::CursiveFont, cursiveFont.family()); + // =========== Fonts ============== + defaultSettings->setFontFamily(QWebSettings::StandardFont, ReKonfig::standardFontFamily() ); + defaultSettings->setFontFamily(QWebSettings::FixedFont, ReKonfig::fixedFontFamily() ); + defaultSettings->setFontFamily(QWebSettings::SerifFont, ReKonfig::serifFontFamily() ); + defaultSettings->setFontFamily(QWebSettings::SansSerifFont, ReKonfig::sansSerifFontFamily() ); + defaultSettings->setFontFamily(QWebSettings::CursiveFont, ReKonfig::cursiveFontFamily()); + defaultSettings->setFontFamily(QWebSettings::FantasyFont, ReKonfig::fantasyFontFamily()); + + // compute font size + // (I have to admit I know nothing about these DPI questions..: copied from kwebkitpart, as someone suggested) + // font size in pixels = font size in inches × screen dpi + int defaultFontSize = ReKonfig::defaultFontSize(); + int minimumFontSize = ReKonfig::minFontSize(); - QFont fantasyFont = ReKonfig::fantasyFont(); - defaultSettings->setFontFamily(QWebSettings::FantasyFont, fantasyFont.family()); + float toPix = mainWindow()->currentTab()->view()->logicalDpiY()/72.0; - int minimumFontSize = ReKonfig::minFontSize(); - defaultSettings->setFontSize(QWebSettings::MinimumFontSize, minimumFontSize); + defaultSettings->setFontSize(QWebSettings::DefaultFontSize, qRound(defaultFontSize * toPix) ); + defaultSettings->setFontSize(QWebSettings::MinimumFontSize, qRound(minimumFontSize * toPix) ); + // ================ WebKit ============================ defaultSettings->setAttribute(QWebSettings::AutoLoadImages, ReKonfig::autoLoadImages()); defaultSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, ReKonfig::dnsPrefetch()); |