From 894b79f5ffd816962fe38207d40bf05274490498 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 6 Jun 2013 19:34:38 +0200 Subject: Use webkit general font to render rekonq pages BUG: 320318 --- src/data/CMakeLists.txt | 7 ------- src/data/Nunito-Regular.ttf | Bin 49792 -> 0 bytes src/data/home.html | 13 ++++--------- src/data/rekonqinfo.html | 11 +++-------- src/rekonqpage/newtabpage.cpp | 6 ++++-- src/webtab/protocolhandler.cpp | 3 ++- src/webtab/webpage.cpp | 6 ++++-- 7 files changed, 17 insertions(+), 29 deletions(-) delete mode 100644 src/data/Nunito-Regular.ttf diff --git a/src/data/CMakeLists.txt b/src/data/CMakeLists.txt index f3609634..ea7d05c7 100644 --- a/src/data/CMakeLists.txt +++ b/src/data/CMakeLists.txt @@ -13,13 +13,6 @@ INSTALL( DESTINATION ${DATA_INSTALL_DIR}/rekonq/pics ) -# fonts files -INSTALL( - FILES - Nunito-Regular.ttf - DESTINATION ${DATA_INSTALL_DIR}/rekonq/fonts -) - # default bookmarks INSTALL( FILES diff --git a/src/data/Nunito-Regular.ttf b/src/data/Nunito-Regular.ttf deleted file mode 100644 index 3b0f067c..00000000 Binary files a/src/data/Nunito-Regular.ttf and /dev/null differ diff --git a/src/data/home.html b/src/data/home.html index 4f4eb7ba..428030c6 100644 --- a/src/data/home.html +++ b/src/data/home.html @@ -8,6 +8,7 @@ To let it work you need to set also some variables about (prepend a $ to actually use them): DEFAULT_PATH = rekonq default installation files path +GENERAL_FONT = general font family ... --> @@ -23,20 +24,14 @@ DEFAULT_PATH = rekonq default installation files path /* -------------------------------------------------------- */ /* generic styles */ -@font-face { - font-family: 'Nunito'; - src: url($DEFAULT_PATH/fonts/Nunito-Regular.ttf); - font-weight: normal; - font-style: normal; -} - html { height:100%; } body { background: url($DEFAULT_PATH/pics/background.png) repeat-y center #fff; - font-family: 'Nunito', sans-serif; + font-family: $GENERAL_FONT; + font-weight: 500; font-size: 0.9em; } @@ -65,7 +60,7 @@ a:hover { input { min-width: 180px; - font-family: 'Nunito', sans-serif; + font-family: $GENERAL_FONT; font-size: 0.8em; } diff --git a/src/data/rekonqinfo.html b/src/data/rekonqinfo.html index 1bf77ac1..861b6f35 100644 --- a/src/data/rekonqinfo.html +++ b/src/data/rekonqinfo.html @@ -10,6 +10,7 @@ about (prepend a $ to actually use them): DEFAULT_PATH = rekonq default installation files path PAGE_TITLE = page title MAIN_CONTENT = page main content +GENERAL_FONT = general font family ... --> @@ -27,18 +28,12 @@ html{ padding:0; } -@font-face { - font-family: 'Nunito'; - src: url($DEFAULT_PATH/fonts/Nunito-Regular.ttf); - font-weight: normal; - font-style: normal; -} - body{ background: url($DEFAULT_PATH/pics/background.png) repeat-y center #bbb; margin:0; padding:0; - font-family: 'Nunito', sans-serif; + font-family: $GENERAL_FONT; + font-weight: 500; font-size: 0.9em; } diff --git a/src/rekonqpage/newtabpage.cpp b/src/rekonqpage/newtabpage.cpp index 48b567de..7857b7d9 100644 --- a/src/rekonqpage/newtabpage.cpp +++ b/src/rekonqpage/newtabpage.cpp @@ -2,7 +2,7 @@ * * This file is a part of the rekonq project * -* Copyright (C) 2009-2012 by Andrea Diamantini +* Copyright (C) 2009-2013 by Andrea Diamantini * Copyright (C) 2010 by Matthieu Gicquel * * @@ -86,6 +86,7 @@ NewTabPage::NewTabPage(QWebFrame *frame) { m_html = file.readAll(); m_html.replace(QL1S("$DEFAULT_PATH"), dataPath); + m_html.replace(QL1S("$GENERAL_FONT"), QWebSettings::globalSettings()->fontFamily(QWebSettings::StandardFont)); } } @@ -1024,7 +1025,8 @@ void NewTabPage::initJS() dataPath.remove(QL1S("/htmls/home.html")); includes.replace(QL1S("$DEFAULT_PATH"), dataPath); - + includes.replace(QL1S("$GENERAL_FONT"), QWebSettings::globalSettings()->fontFamily(QWebSettings::StandardFont)); + oldHTML.replace(QL1S(""), includes); QString javascript; diff --git a/src/webtab/protocolhandler.cpp b/src/webtab/protocolhandler.cpp index 4cf61be5..886bec1e 100644 --- a/src/webtab/protocolhandler.cpp +++ b/src/webtab/protocolhandler.cpp @@ -398,7 +398,8 @@ QString ProtocolHandler::dirHandling(const KFileItemList &list) html.replace(QL1S("$DEFAULT_PATH"), dataPath); html.replace(QL1S("$PAGE_TITLE"), title); html.replace(QL1S("$MAIN_CONTENT"), msg); - + html.replace(QL1S("$GENERAL_FONT"), QWebSettings::globalSettings()->fontFamily(QWebSettings::StandardFont)); + return html; } diff --git a/src/webtab/webpage.cpp b/src/webtab/webpage.cpp index 522d13a3..82c5cf60 100644 --- a/src/webtab/webpage.cpp +++ b/src/webtab/webpage.cpp @@ -721,7 +721,8 @@ QString WebPage::errorPage(QNetworkReply *reply) html.replace(QL1S("$DEFAULT_PATH"), dataPath); html.replace(QL1S("$PAGE_TITLE"), title); html.replace(QL1S("$MAIN_CONTENT"), msg); - + html.replace(QL1S("$GENERAL_FONT"), QWebSettings::globalSettings()->fontFamily(QWebSettings::StandardFont)); + return html; } @@ -767,7 +768,8 @@ QString WebPage::errorPage(QNetworkReply *reply) html.replace(QL1S("$DEFAULT_PATH"), dataPath); html.replace(QL1S("$PAGE_TITLE"), title); html.replace(QL1S("$MAIN_CONTENT"), msg); - + html.replace(QL1S("$GENERAL_FONT"), QWebSettings::globalSettings()->fontFamily(QWebSettings::StandardFont)); + return html; } -- cgit v1.2.1