1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

relative to system wide default font sizes in css

This commit is contained in:
apprb 2014-10-06 23:39:07 +09:00
parent a85372a5c0
commit 6e02240b56
3 changed files with 19 additions and 15 deletions

View File

@ -23,6 +23,7 @@
#include <QRegularExpression> #include <QRegularExpression>
#include <QWidget> #include <QWidget>
#include <QStyle> #include <QStyle>
#include <QFontInfo>
// helper functions // helper functions
QFont appFont(int pixelSize, int weight) QFont appFont(int pixelSize, int weight)
@ -78,14 +79,17 @@ QFont Style::getFont(Style::Font font)
{ {
// fonts as defined in // fonts as defined in
// https://github.com/ItsDuke/Tox-UI/blob/master/UI%20GUIDELINES.md // https://github.com/ItsDuke/Tox-UI/blob/master/UI%20GUIDELINES.md
static int defSize = QFontInfo(QFont()).pixelSize();
static QFont fonts[] = { static QFont fonts[] = {
appFont(16, QFont::Bold), appFont(defSize + 2, QFont::Bold),
appFont(14, QFont::Normal), appFont(defSize , QFont::Normal),
appFont(14, QFont::Bold), appFont(defSize , QFont::Bold),
appFont(13, QFont::Normal), appFont(defSize - 1, QFont::Normal),
appFont(13, QFont::Bold), appFont(defSize - 1, QFont::Bold),
appFont(12, QFont::Normal), appFont(defSize - 2, QFont::Normal),
appFont(12, QFont::Light), appFont(defSize - 2, QFont::Light),
}; };
return fonts[font]; return fonts[font];

View File

@ -41,13 +41,13 @@ public:
enum Font enum Font
{ {
ExtraBig, // 14px, bold ExtraBig, // [SystemDefault + 2]px, bold
Big, // 12px Big, // [SystemDefault ]px
BigBold, // 12px, bold BigBold, // [SystemDefault ]px, bold
Medium, // 11px Medium, // [SystemDefault - 1]px
MediumBold, // 11px, bold MediumBold, // [SystemDefault - 1]px, bold
Small, // 10px Small, // [SystemDefault - 2]px
SmallLight // 10px, light SmallLight // [SystemDefault - 2]px, light
}; };
static QString getStylesheet(const QString& filename); static QString getStylesheet(const QString& filename);

View File

@ -9,7 +9,7 @@
} }
#statusPanel > #statusHead > #statusLabel { #statusPanel > #statusHead > #statusLabel {
font: @smallLight; font: @medium;
color: @lightGrey; color: @lightGrey;
} }