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 @@ -9,12 +9,18 @@ class FontControl { int * m_fontsizes; - int m_size; + int m_size, g_size; QString m_fontname; + QString m_fixedfontname; int m_maxsize; bool m_hasCourier; + int m_leading, m_extraspace; + unsigned char m_basesize; public: + void setBaseSize(unsigned char _s) { m_basesize = _s; } + unsigned char getBaseSize() { return m_basesize; } + int gzoom(); FontControl(QString n = "helvetica", int size = 10) : - m_fontsizes(NULL), m_hasCourier(false) + m_fontsizes(NULL), m_hasCourier(false), m_leading(0), m_extraspace(0) { ChangeFont(n, size); @@ -24,9 +30,14 @@ class FontControl if (m_fontsizes != NULL) delete [] m_fontsizes; } - void hasCourier(bool _b) { m_hasCourier = _b; } + void hasCourier(bool _b, const QString& _nm) + { + m_hasCourier = _b; + m_fixedfontname = _nm; + } + QString& fixedfontname() { return m_fixedfontname; } bool hasCourier() { return m_hasCourier; } QString name() { return m_fontname; } int currentsize() { return m_fontsizes[m_size]; } - int getsize(CStyle size) + int getsize(const CStyle& size) { int tgt = m_size+size.getFontSize(); @@ -47,5 +58,5 @@ class FontControl return fm.ascent(); } - int ascent(CStyle ch) + int ascent(const CStyle& ch) { QFont f(name(), getsize(ch)); @@ -59,5 +70,5 @@ class FontControl return fm.descent(); } - int descent(CStyle ch) + int descent(const CStyle& ch) { QFont f(name(), getsize(ch)); @@ -71,5 +82,5 @@ class FontControl return fm.lineSpacing(); } - int lineSpacing(CStyle ch) + int lineSpacing(const CStyle& ch) { QFont f(name(), getsize(ch)); @@ -79,4 +90,5 @@ class FontControl bool decreasesize() { +/* if (--m_size < 0) { @@ -85,7 +97,18 @@ class FontControl } else return true; +*/ + if (g_size-- == m_size) + { + if (--m_size < 0) + { + m_size = 0; + } + } +// qDebug("Font:%d Graphics:%d", m_size, g_size); + return true; } bool increasesize() { +/* if (++m_size >= m_maxsize) { @@ -94,4 +117,14 @@ class FontControl } else return true; +*/ + if (g_size++ == m_size) + { + if (++m_size >= m_maxsize) + { + m_size = m_maxsize - 1; + } + } +// qDebug("Font:%d Graphics:%d", m_size, g_size); + return true; } bool ChangeFont(QString& n) @@ -100,4 +133,20 @@ class FontControl } bool ChangeFont(QString& n, int tgt); + void setlead(int _lead) + { + m_leading = _lead; + } + int getlead() + { + return m_leading; + } + void setextraspace(int _lead) + { + m_extraspace = _lead; + } + int getextraspace() + { + return m_extraspace; + } }; |