summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/FontControl.h
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/FontControl.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/FontControl.h178
1 files changed, 89 insertions, 89 deletions
diff --git a/noncore/apps/opie-reader/FontControl.h b/noncore/apps/opie-reader/FontControl.h
index 5681496..e56b619 100644
--- a/noncore/apps/opie-reader/FontControl.h
+++ b/noncore/apps/opie-reader/FontControl.h
@@ -17,137 +17,137 @@ class FontControl
17 unsigned char m_basesize; 17 unsigned char m_basesize;
18 public: 18 public:
19 void setBaseSize(unsigned char _s) { m_basesize = _s; } 19 void setBaseSize(unsigned char _s) { m_basesize = _s; }
20 unsigned char getBaseSize() { return m_basesize; } 20 unsigned char getBaseSize() { return m_basesize; }
21 int gzoom(); 21 int gzoom();
22 FontControl(QString n = "helvetica", int size = 10) 22 FontControl(QString n = "helvetica", int size = 10)
23 : 23 :
24 m_fontsizes(NULL), m_hasCourier(false), m_leading(0), m_extraspace(0) 24 m_fontsizes(NULL), m_hasCourier(false), m_leading(0), m_extraspace(0)
25 { 25 {
26 ChangeFont(n, size); 26 ChangeFont(n, size);
27 } 27 }
28 ~FontControl() 28 ~FontControl()
29 { 29 {
30 if (m_fontsizes != NULL) delete [] m_fontsizes; 30 if (m_fontsizes != NULL) delete [] m_fontsizes;
31 } 31 }
32 void hasCourier(bool _b, const QString& _nm) 32 void hasCourier(bool _b, const QString& _nm)
33 { 33 {
34 m_hasCourier = _b; 34 m_hasCourier = _b;
35 m_fixedfontname = _nm; 35 m_fixedfontname = _nm;
36 } 36 }
37 QString& fixedfontname() { return m_fixedfontname; } 37 QString& fixedfontname() { return m_fixedfontname; }
38 bool hasCourier() { return m_hasCourier; } 38 bool hasCourier() { return m_hasCourier; }
39 QString name() { return m_fontname; } 39 QString name() { return m_fontname; }
40 int currentsize() { return m_fontsizes[m_size]; } 40 int currentsize() { return m_fontsizes[m_size]; }
41 int getsize(const CStyle& size) 41 int getsize(const CStyle& size)
42 { 42 {
43 int tgt = m_size+size.getFontSize(); 43 int tgt = m_size+size.getFontSize();
44 if (tgt < 0) 44 if (tgt < 0)
45 { 45 {
46 tgt = 0; 46 tgt = 0;
47 } 47 }
48 if (tgt >= m_maxsize) 48 if (tgt >= m_maxsize)
49 { 49 {
50 tgt = m_maxsize - 1; 50 tgt = m_maxsize - 1;
51 } 51 }
52 return m_fontsizes[tgt]; 52 return m_fontsizes[tgt];
53 } 53 }
54 int ascent() 54 int ascent()
55 { 55 {
56 QFont f(name(), currentsize()); 56 QFont f(name(), currentsize());
57 QFontMetrics fm(f); 57 QFontMetrics fm(f);
58 return fm.ascent(); 58 return fm.ascent();
59 } 59 }
60 int ascent(const CStyle& ch) 60 int ascent(const CStyle& ch)
61 { 61 {
62 QFont f(name(), getsize(ch)); 62 QFont f(name(), getsize(ch));
63 QFontMetrics fm(f); 63 QFontMetrics fm(f);
64 return fm.ascent(); 64 return fm.ascent();
65 } 65 }
66 int descent() 66 int descent()
67 { 67 {
68 QFont f(name(), currentsize()); 68 QFont f(name(), currentsize());
69 QFontMetrics fm(f); 69 QFontMetrics fm(f);
70 return fm.descent(); 70 return fm.descent();
71 } 71 }
72 int descent(const CStyle& ch) 72 int descent(const CStyle& ch)
73 { 73 {
74 QFont f(name(), getsize(ch)); 74 QFont f(name(), getsize(ch));
75 QFontMetrics fm(f); 75 QFontMetrics fm(f);
76 return fm.descent(); 76 return fm.descent();
77 } 77 }
78 int lineSpacing() 78 int lineSpacing()
79 { 79 {
80 QFont f(name(), currentsize()); 80 QFont f(name(), currentsize());
81 QFontMetrics fm(f); 81 QFontMetrics fm(f);
82 return fm.lineSpacing(); 82 return fm.lineSpacing();
83 } 83 }
84 int lineSpacing(const CStyle& ch) 84 int lineSpacing(const CStyle& ch)
85 { 85 {
86 QFont f(name(), getsize(ch)); 86 QFont f(name(), getsize(ch));
87 QFontMetrics fm(f); 87 QFontMetrics fm(f);
88 return fm.lineSpacing(); 88 return fm.lineSpacing();
89 } 89 }
90 bool decreasesize() 90 bool decreasesize()
91 { 91 {
92/* 92/*
93 if (--m_size < 0) 93 if (--m_size < 0)
94 { 94 {
95 m_size = 0; 95 m_size = 0;
96 return false; 96 return false;
97 } 97 }
98 else return true; 98 else return true;
99*/ 99*/
100 if (g_size-- == m_size) 100 if (g_size-- == m_size)
101 { 101 {
102 if (--m_size < 0) 102 if (--m_size < 0)
103 { 103 {
104 m_size = 0; 104 m_size = 0;
105 } 105 }
106 } 106 }
107 // qDebug("Font:%d Graphics:%d", m_size, g_size); 107// odebug << "Font:" << m_size << " Graphics:" << g_size << oendl;
108 return true; 108 return true;
109 } 109 }
110 bool increasesize() 110 bool increasesize()
111 { 111 {
112/* 112/*
113 if (++m_size >= m_maxsize) 113 if (++m_size >= m_maxsize)
114 { 114 {
115 m_size = m_maxsize - 1; 115 m_size = m_maxsize - 1;
116 return false; 116 return false;
117 } 117 }
118 else return true; 118 else return true;
119*/ 119*/
120 if (g_size++ == m_size) 120 if (g_size++ == m_size)
121 { 121 {
122 if (++m_size >= m_maxsize) 122 if (++m_size >= m_maxsize)
123 { 123 {
124 m_size = m_maxsize - 1; 124 m_size = m_maxsize - 1;
125 } 125 }
126 } 126 }
127 // qDebug("Font:%d Graphics:%d", m_size, g_size); 127// odebug << "Font:" << m_size << " Graphics:" << g_size << oendl;
128 return true; 128 return true;
129 } 129 }
130 bool ChangeFont(QString& n) 130 bool ChangeFont(QString& n)
131 { 131 {
132 return ChangeFont(n, currentsize()); 132 return ChangeFont(n, currentsize());
133 } 133 }
134 bool ChangeFont(QString& n, int tgt); 134 bool ChangeFont(QString& n, int tgt);
135 void setlead(int _lead) 135 void setlead(int _lead)
136 { 136 {
137 m_leading = _lead; 137 m_leading = _lead;
138 } 138 }
139 int getlead() 139 int getlead()
140 { 140 {
141 return m_leading; 141 return m_leading;
142 } 142 }
143 void setextraspace(int _lead) 143 void setextraspace(int _lead)
144 { 144 {
145 m_extraspace = _lead; 145 m_extraspace = _lead;
146 } 146 }
147 int getextraspace() 147 int getextraspace()
148 { 148 {
149 return m_extraspace; 149 return m_extraspace;
150 } 150 }
151}; 151};
152 152
153#endif 153#endif