Diffstat (limited to 'noncore/apps/opie-reader/FontControl.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/FontControl.h | 63 |
1 files changed, 56 insertions, 7 deletions
diff --git a/noncore/apps/opie-reader/FontControl.h b/noncore/apps/opie-reader/FontControl.h index 02049d0..5681496 100644 --- a/noncore/apps/opie-reader/FontControl.h +++ b/noncore/apps/opie-reader/FontControl.h | |||
@@ -10,10 +10,16 @@ class FontControl | |||
10 | int * m_fontsizes; | 10 | int * m_fontsizes; |
11 | int m_size; | 11 | int m_size, g_size; |
12 | QString m_fontname; | 12 | QString m_fontname; |
13 | QString m_fixedfontname; | ||
13 | int m_maxsize; | 14 | int m_maxsize; |
14 | bool m_hasCourier; | 15 | bool m_hasCourier; |
16 | int m_leading, m_extraspace; | ||
17 | unsigned char m_basesize; | ||
15 | public: | 18 | public: |
19 | void setBaseSize(unsigned char _s) { m_basesize = _s; } | ||
20 | unsigned char getBaseSize() { return m_basesize; } | ||
21 | int gzoom(); | ||
16 | FontControl(QString n = "helvetica", int size = 10) | 22 | FontControl(QString n = "helvetica", int size = 10) |
17 | : | 23 | : |
18 | m_fontsizes(NULL), m_hasCourier(false) | 24 | m_fontsizes(NULL), m_hasCourier(false), m_leading(0), m_extraspace(0) |
19 | { | 25 | { |
@@ -25,3 +31,8 @@ class FontControl | |||
25 | } | 31 | } |
26 | void hasCourier(bool _b) { m_hasCourier = _b; } | 32 | void hasCourier(bool _b, const QString& _nm) |
33 | { | ||
34 | m_hasCourier = _b; | ||
35 | m_fixedfontname = _nm; | ||
36 | } | ||
37 | QString& fixedfontname() { return m_fixedfontname; } | ||
27 | bool hasCourier() { return m_hasCourier; } | 38 | bool hasCourier() { return m_hasCourier; } |
@@ -29,3 +40,3 @@ class FontControl | |||
29 | int currentsize() { return m_fontsizes[m_size]; } | 40 | int currentsize() { return m_fontsizes[m_size]; } |
30 | int getsize(CStyle size) | 41 | int getsize(const CStyle& size) |
31 | { | 42 | { |
@@ -48,3 +59,3 @@ class FontControl | |||
48 | } | 59 | } |
49 | int ascent(CStyle ch) | 60 | int ascent(const CStyle& ch) |
50 | { | 61 | { |
@@ -60,3 +71,3 @@ class FontControl | |||
60 | } | 71 | } |
61 | int descent(CStyle ch) | 72 | int descent(const CStyle& ch) |
62 | { | 73 | { |
@@ -72,3 +83,3 @@ class FontControl | |||
72 | } | 83 | } |
73 | int lineSpacing(CStyle ch) | 84 | int lineSpacing(const CStyle& ch) |
74 | { | 85 | { |
@@ -80,2 +91,3 @@ class FontControl | |||
80 | { | 91 | { |
92 | /* | ||
81 | if (--m_size < 0) | 93 | if (--m_size < 0) |
@@ -86,2 +98,12 @@ class FontControl | |||
86 | else return true; | 98 | else return true; |
99 | */ | ||
100 | if (g_size-- == m_size) | ||
101 | { | ||
102 | if (--m_size < 0) | ||
103 | { | ||
104 | m_size = 0; | ||
105 | } | ||
106 | } | ||
107 | // qDebug("Font:%d Graphics:%d", m_size, g_size); | ||
108 | return true; | ||
87 | } | 109 | } |
@@ -89,2 +111,3 @@ class FontControl | |||
89 | { | 111 | { |
112 | /* | ||
90 | if (++m_size >= m_maxsize) | 113 | if (++m_size >= m_maxsize) |
@@ -95,2 +118,12 @@ class FontControl | |||
95 | else return true; | 118 | else return true; |
119 | */ | ||
120 | if (g_size++ == m_size) | ||
121 | { | ||
122 | if (++m_size >= m_maxsize) | ||
123 | { | ||
124 | m_size = m_maxsize - 1; | ||
125 | } | ||
126 | } | ||
127 | // qDebug("Font:%d Graphics:%d", m_size, g_size); | ||
128 | return true; | ||
96 | } | 129 | } |
@@ -101,2 +134,18 @@ class FontControl | |||
101 | bool ChangeFont(QString& n, int tgt); | 134 | bool ChangeFont(QString& n, int tgt); |
135 | void setlead(int _lead) | ||
136 | { | ||
137 | m_leading = _lead; | ||
138 | } | ||
139 | int getlead() | ||
140 | { | ||
141 | return m_leading; | ||
142 | } | ||
143 | void setextraspace(int _lead) | ||
144 | { | ||
145 | m_extraspace = _lead; | ||
146 | } | ||
147 | int getextraspace() | ||
148 | { | ||
149 | return m_extraspace; | ||
150 | } | ||
102 | }; | 151 | }; |