]> git.sur5r.net Git - minitube/blob - src/fontutils.cpp
Imported Upstream version 2.1.3
[minitube] / src / fontutils.cpp
1 /* $BEGIN_LICENSE
2
3 This file is part of Minitube.
4 Copyright 2009, Flavio Tordini <flavio.tordini@gmail.com>
5
6 Minitube is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 Minitube is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Minitube.  If not, see <http://www.gnu.org/licenses/>.
18
19 $END_LICENSE */
20
21 #include "fontutils.h"
22
23 static const int MIN_PIXEL_SIZE = 11;
24
25 const QFont FontUtils::small() {
26     static QFont font;
27     static bool initialized = false;
28     if (!initialized) {
29       initialized = true;
30       font.setPointSize(font.pointSize()*.85);
31       if (font.pixelSize() < MIN_PIXEL_SIZE) font.setPixelSize(MIN_PIXEL_SIZE);
32     }
33     return font;
34 }
35
36 const QFont FontUtils::smallBold() {
37     static QFont font;
38     static bool initialized = false;
39     if (!initialized) {
40       initialized = true;
41       font.setPointSize(font.pointSize()*.85);
42       font.setBold(true);
43       if (font.pixelSize() < MIN_PIXEL_SIZE) font.setPixelSize(MIN_PIXEL_SIZE);
44     }
45     return font;
46 }
47
48 const QFont FontUtils::medium() {
49     static QFont font;
50     static bool initialized = false;
51     if (!initialized) {
52       initialized = true;
53       font.setPointSize(font.pointSize()*1.1);
54     }
55     return font;
56 }
57
58 const QFont FontUtils::mediumBold() {
59     static QFont font;
60     static bool initialized = false;
61     if (!initialized) {
62       initialized = true;
63       font.setPointSize(font.pointSize()*0.9);
64       font.setBold(true);
65     }
66     return font;
67 }
68
69 const QFont FontUtils::big() {
70     static QFont font;
71     static bool initialized = false;
72     if (!initialized) {
73       initialized = true;
74       font.setPointSize(font.pointSize()*1.5);
75     }
76     return font;
77 }
78
79 const QFont FontUtils::bigBold() {
80     static QFont font;
81     static bool initialized = false;
82     if (!initialized) {
83       initialized = true;
84       font.setPointSize(font.pointSize()*1.5);
85       font.setBold(true);
86     }
87     return font;
88 }