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.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/opie-reader/FontControl.h b/noncore/apps/opie-reader/FontControl.h
index 90d39b2..563e1a8 100644
--- a/noncore/apps/opie-reader/FontControl.h
+++ b/noncore/apps/opie-reader/FontControl.h
@@ -40,49 +40,49 @@ class FontControl
40 void hasCourier(bool _b, const QString& _nm) 40 void hasCourier(bool _b, const QString& _nm)
41 { 41 {
42 m_hasCourier = _b; 42 m_hasCourier = _b;
43 m_fixedfontname = _nm; 43 m_fixedfontname = _nm;
44 } 44 }
45 QString& fixedfontname() { return m_fixedfontname; } 45 QString& fixedfontname() { return m_fixedfontname; }
46 bool hasCourier() { return m_hasCourier; } 46 bool hasCourier() { return m_hasCourier; }
47 QString name() { return m_fontname; } 47 QString name() { return m_fontname; }
48 int currentsize() { return (m_fontsizes == NULL) ? 0 : m_fontsizes[m_size]; } 48 int currentsize() { return (m_fontsizes == NULL) ? 0 : m_fontsizes[m_size]; }
49 int getsize(const CStyle& size) 49 int getsize(const CStyle& size)
50 { 50 {
51 return getsize(size.getFontSize()); 51 return getsize(size.getFontSize());
52 } 52 }
53 int getsize(int _offset) 53 int getsize(int _offset)
54 { 54 {
55 int tgt = m_size+_offset; 55 int tgt = m_size+_offset;
56 if (tgt < 0) 56 if (tgt < 0)
57 { 57 {
58 tgt = 0; 58 tgt = 0;
59 } 59 }
60 if (tgt >= m_maxsize) 60 if (tgt >= m_maxsize)
61 { 61 {
62 tgt = m_maxsize - 1; 62 tgt = m_maxsize - 1;
63 } 63 }
64 return m_fontsizes[tgt]; 64 return tgt >= 0 ? m_fontsizes[tgt] : 12;
65 } 65 }
66 int ascent() 66 int ascent()
67 { 67 {
68 QFont f(name(), currentsize()); 68 QFont f(name(), currentsize());
69 QFontMetrics fm(f); 69 QFontMetrics fm(f);
70 return fm.ascent(); 70 return fm.ascent();
71 } 71 }
72 int ascent(const CStyle& ch) 72 int ascent(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.ascent(); 76 return fm.ascent();
77 } 77 }
78 int descent() 78 int descent()
79 { 79 {
80 QFont f(name(), currentsize()); 80 QFont f(name(), currentsize());
81 QFontMetrics fm(f); 81 QFontMetrics fm(f);
82 return fm.descent(); 82 return fm.descent();
83 } 83 }
84 int descent(const CStyle& ch) 84 int descent(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.descent(); 88 return fm.descent();