summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/FontControl.h
authorgroucho <groucho>2003-05-07 09:01:39 (UTC)
committer groucho <groucho>2003-05-07 09:01:39 (UTC)
commit118d03d815a7615b9c53363218a7ac45b3f4c514 (patch) (side-by-side diff)
tree356953e2413cddcec0f35bd47bb6439767da7051 /noncore/apps/opie-reader/FontControl.h
parent00894537decf01c5a5cdc565b2740b5e67a2e90f (diff)
downloadopie-118d03d815a7615b9c53363218a7ac45b3f4c514.zip
opie-118d03d815a7615b9c53363218a7ac45b3f4c514.tar.gz
opie-118d03d815a7615b9c53363218a7ac45b3f4c514.tar.bz2
Incorporated TimWs current source tree and make it compile
Diffstat (limited to 'noncore/apps/opie-reader/FontControl.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/FontControl.h63
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
@@ -8,14 +8,20 @@
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);
}
@@ -23,11 +29,16 @@ 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();
if (tgt < 0)
@@ -46,7 +57,7 @@ class FontControl
QFontMetrics fm(f);
return fm.ascent();
}
- int ascent(CStyle ch)
+ int ascent(const CStyle& ch)
{
QFont f(name(), getsize(ch));
QFontMetrics fm(f);
@@ -58,7 +69,7 @@ class FontControl
QFontMetrics fm(f);
return fm.descent();
}
- int descent(CStyle ch)
+ int descent(const CStyle& ch)
{
QFont f(name(), getsize(ch));
QFontMetrics fm(f);
@@ -70,7 +81,7 @@ class FontControl
QFontMetrics fm(f);
return fm.lineSpacing();
}
- int lineSpacing(CStyle ch)
+ int lineSpacing(const CStyle& ch)
{
QFont f(name(), getsize(ch));
QFontMetrics fm(f);
@@ -78,27 +89,65 @@ class FontControl
}
bool decreasesize()
{
+/*
if (--m_size < 0)
{
m_size = 0;
return false;
}
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)
{
m_size = m_maxsize - 1;
return false;
}
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)
{
return ChangeFont(n, currentsize());
}
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;
+ }
};
#endif