summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/FontControl.h
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/FontControl.h') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-reader/FontControl.h43
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
@@ -2,5 +2,4 @@
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"
@@ -16,5 +15,14 @@ class FontControl
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; }
@@ -22,5 +30,5 @@ class FontControl
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);
@@ -38,8 +46,12 @@ class FontControl
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 {
@@ -90,5 +102,6 @@ class FontControl
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 {
@@ -96,6 +109,8 @@ class FontControl
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 {
@@ -105,10 +120,12 @@ class FontControl
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 {
@@ -116,6 +133,8 @@ class FontControl
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 {
@@ -125,5 +144,5 @@ class FontControl
125 } 144 }
126 } 145 }
127// odebug << "Font:" << m_size << " Graphics:" << g_size << oendl; 146 }
128 return true; 147 return true;
129 } 148 }