Diffstat (limited to 'noncore/apps/opie-reader/FontControl.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/FontControl.h | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/noncore/apps/opie-reader/FontControl.h b/noncore/apps/opie-reader/FontControl.h index e56b619..90d39b2 100644 --- a/noncore/apps/opie-reader/FontControl.h +++ b/noncore/apps/opie-reader/FontControl.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef __FONTCONTROL_H | 1 | #ifndef __FONTCONTROL_H |
2 | #define __FONTCONTROL_H | 2 | #define __FONTCONTROL_H |
3 | 3 | ||
4 | #include <qfontdatabase.h> | ||
5 | #include <qfontmetrics.h> | 4 | #include <qfontmetrics.h> |
6 | #include "StyleConsts.h" | 5 | #include "StyleConsts.h" |
7 | 6 | ||
@@ -15,13 +14,22 @@ class FontControl | |||
15 | bool m_hasCourier; | 14 | bool m_hasCourier; |
16 | int m_leading, m_extraspace; | 15 | int m_leading, m_extraspace; |
17 | unsigned char m_basesize; | 16 | unsigned char m_basesize; |
17 | bool m_fixgraphics; | ||
18 | public: | 18 | public: |
19 | void FixGraphics(bool _b) | ||
20 | { | ||
21 | m_fixgraphics = _b; | ||
22 | } | ||
23 | bool FixGraphics() | ||
24 | { | ||
25 | return m_fixgraphics; | ||
26 | } | ||
19 | void setBaseSize(unsigned char _s) { m_basesize = _s; } | 27 | void setBaseSize(unsigned char _s) { m_basesize = _s; } |
20 | unsigned char getBaseSize() { return m_basesize; } | 28 | unsigned char getBaseSize() { return m_basesize; } |
21 | int gzoom(); | 29 | int gzoom(); |
22 | FontControl(QString n = "helvetica", int size = 10) | 30 | FontControl(QString n = "helvetica", int size = 10) |
23 | : | 31 | : |
24 | m_fontsizes(NULL), m_hasCourier(false), m_leading(0), m_extraspace(0) | 32 | m_fontsizes(NULL), m_hasCourier(false), m_leading(0), m_extraspace(0), m_fixgraphics(true) |
25 | { | 33 | { |
26 | ChangeFont(n, size); | 34 | ChangeFont(n, size); |
27 | } | 35 | } |
@@ -37,10 +45,14 @@ class FontControl | |||
37 | QString& fixedfontname() { return m_fixedfontname; } | 45 | QString& fixedfontname() { return m_fixedfontname; } |
38 | bool hasCourier() { return m_hasCourier; } | 46 | bool hasCourier() { return m_hasCourier; } |
39 | QString name() { return m_fontname; } | 47 | QString name() { return m_fontname; } |
40 | int currentsize() { return m_fontsizes[m_size]; } | 48 | int currentsize() { return (m_fontsizes == NULL) ? 0 : m_fontsizes[m_size]; } |
41 | int getsize(const CStyle& size) | 49 | int getsize(const CStyle& size) |
42 | { | 50 | { |
43 | int tgt = m_size+size.getFontSize(); | 51 | return getsize(size.getFontSize()); |
52 | } | ||
53 | int getsize(int _offset) | ||
54 | { | ||
55 | int tgt = m_size+_offset; | ||
44 | if (tgt < 0) | 56 | if (tgt < 0) |
45 | { | 57 | { |
46 | tgt = 0; | 58 | tgt = 0; |
@@ -89,14 +101,17 @@ class FontControl | |||
89 | } | 101 | } |
90 | bool decreasesize() | 102 | bool decreasesize() |
91 | { | 103 | { |
92 | /* | 104 | if (m_fixgraphics) |
105 | { | ||
93 | if (--m_size < 0) | 106 | if (--m_size < 0) |
94 | { | 107 | { |
95 | m_size = 0; | 108 | m_size = 0; |
96 | return false; | 109 | return false; |
97 | } | 110 | } |
98 | else return true; | 111 | g_size = m_size; |
99 | */ | 112 | } |
113 | else | ||
114 | { | ||
100 | if (g_size-- == m_size) | 115 | if (g_size-- == m_size) |
101 | { | 116 | { |
102 | if (--m_size < 0) | 117 | if (--m_size < 0) |
@@ -104,19 +119,23 @@ class FontControl | |||
104 | m_size = 0; | 119 | m_size = 0; |
105 | } | 120 | } |
106 | } | 121 | } |
107 | // odebug << "Font:" << m_size << " Graphics:" << g_size << oendl; | 122 | } |
123 | // qDebug("Font:%d Graphics:%d", m_size, g_size); | ||
108 | return true; | 124 | return true; |
109 | } | 125 | } |
110 | bool increasesize() | 126 | bool increasesize() |
111 | { | 127 | { |
112 | /* | 128 | if (m_fixgraphics) |
129 | { | ||
113 | if (++m_size >= m_maxsize) | 130 | if (++m_size >= m_maxsize) |
114 | { | 131 | { |
115 | m_size = m_maxsize - 1; | 132 | m_size = m_maxsize - 1; |
116 | return false; | 133 | return false; |
117 | } | 134 | } |
118 | else return true; | 135 | g_size = m_size; |
119 | */ | 136 | } |
137 | else | ||
138 | { | ||
120 | if (g_size++ == m_size) | 139 | if (g_size++ == m_size) |
121 | { | 140 | { |
122 | if (++m_size >= m_maxsize) | 141 | if (++m_size >= m_maxsize) |
@@ -124,7 +143,7 @@ class FontControl | |||
124 | m_size = m_maxsize - 1; | 143 | m_size = m_maxsize - 1; |
125 | } | 144 | } |
126 | } | 145 | } |
127 | // odebug << "Font:" << m_size << " Graphics:" << g_size << oendl; | 146 | } |
128 | return true; | 147 | return true; |
129 | } | 148 | } |
130 | bool ChangeFont(QString& n) | 149 | bool ChangeFont(QString& n) |