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 @@ -2,5 +2,4 @@ #define __FONTCONTROL_H -#include <qfontdatabase.h> #include <qfontmetrics.h> #include "StyleConsts.h" @@ -16,5 +15,14 @@ class FontControl int m_leading, m_extraspace; unsigned char m_basesize; + bool m_fixgraphics; public: + void FixGraphics(bool _b) + { + m_fixgraphics = _b; + } + bool FixGraphics() + { + return m_fixgraphics; + } void setBaseSize(unsigned char _s) { m_basesize = _s; } unsigned char getBaseSize() { return m_basesize; } @@ -22,5 +30,5 @@ class FontControl FontControl(QString n = "helvetica", int size = 10) : - m_fontsizes(NULL), m_hasCourier(false), m_leading(0), m_extraspace(0) + m_fontsizes(NULL), m_hasCourier(false), m_leading(0), m_extraspace(0), m_fixgraphics(true) { ChangeFont(n, size); @@ -38,8 +46,12 @@ class FontControl bool hasCourier() { return m_hasCourier; } QString name() { return m_fontname; } - int currentsize() { return m_fontsizes[m_size]; } + int currentsize() { return (m_fontsizes == NULL) ? 0 : m_fontsizes[m_size]; } int getsize(const CStyle& size) { - int tgt = m_size+size.getFontSize(); + return getsize(size.getFontSize()); + } + int getsize(int _offset) + { + int tgt = m_size+_offset; if (tgt < 0) { @@ -90,5 +102,6 @@ class FontControl bool decreasesize() { -/* + if (m_fixgraphics) + { if (--m_size < 0) { @@ -96,6 +109,8 @@ class FontControl return false; } - else return true; -*/ + g_size = m_size; + } + else + { if (g_size-- == m_size) { @@ -105,10 +120,12 @@ class FontControl } } -// odebug << "Font:" << m_size << " Graphics:" << g_size << oendl; + } +// qDebug("Font:%d Graphics:%d", m_size, g_size); return true; } bool increasesize() { -/* + if (m_fixgraphics) + { if (++m_size >= m_maxsize) { @@ -116,6 +133,8 @@ class FontControl return false; } - else return true; -*/ + g_size = m_size; + } + else + { if (g_size++ == m_size) { @@ -125,5 +144,5 @@ class FontControl } } -// odebug << "Font:" << m_size << " Graphics:" << g_size << oendl; + } return true; } |