summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/FontControl.h
Side-by-side diff
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
@@ -1,8 +1,7 @@
#ifndef __FONTCONTROL_H
#define __FONTCONTROL_H
-#include <qfontdatabase.h>
#include <qfontmetrics.h>
#include "StyleConsts.h"
class FontControl
@@ -14,15 +13,24 @@ class FontControl
int m_maxsize;
bool m_hasCourier;
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; }
int gzoom();
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);
}
~FontControl()
@@ -36,12 +44,16 @@ class FontControl
}
QString& fixedfontname() { return m_fixedfontname; }
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)
{
tgt = 0;
}
@@ -88,44 +100,51 @@ class FontControl
return fm.lineSpacing();
}
bool decreasesize()
{
-/*
+ if (m_fixgraphics)
+ {
if (--m_size < 0)
{
m_size = 0;
return false;
}
- else return true;
-*/
+ g_size = m_size;
+ }
+ else
+ {
if (g_size-- == m_size)
{
if (--m_size < 0)
{
m_size = 0;
}
}
-// 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)
{
m_size = m_maxsize - 1;
return false;
}
- else return true;
-*/
+ g_size = m_size;
+ }
+ else
+ {
if (g_size++ == m_size)
{
if (++m_size >= m_maxsize)
{
m_size = m_maxsize - 1;
}
}
-// odebug << "Font:" << m_size << " Graphics:" << g_size << oendl;
+ }
return true;
}
bool ChangeFont(QString& n)
{