Main Page   Class Hierarchy   Compound List   File List   Compound Members  

ZFont.h

Go to the documentation of this file.
00001 
00002 #ifndef ZFONT_H
00003    #define ZFONT_H
00004 
00005    #include <qimage.h>
00006    #include <qpixmap.h>
00007    #include <qstring.h>
00008    #include <qdirectpainter_qws.h>
00009    #include <qgfx_qws.h>
00010    #include <qstring.h>
00011    #include "ZSurface.h"
00012    
00013 
00014                                      
00016 
00042 class ZFont: public ZSurface
00043 {
00044 
00045 
00046 public:
00050    ZFont();
00055    ZFont(const QImage &,QColor backColor);
00060    ZFont(const QPixmap &,QColor backColor);
00066    ZFont(const QFont &,QColor foreCol,  QColor backCol);
00067 
00072    ZFont(const ZFont &);
00076    ZFont & operator=(const ZFont &f);
00077 
00081    ~ZFont();
00082 
00088    bool create(const QImage &, QColor backColor);
00094    bool create(const QPixmap &,QColor backColor);
00100    bool create(const QFont &, QColor foreColor, QColor backCol);
00101 
00105    inline int  charWidth(char c) const
00106    {
00107       return iWidth[(int)c-32];
00108    }
00112    inline int x(char c) const
00113    {
00114       return iOffset[(int)c-32];
00115    }
00116 /*
00117    inline void setHeight(int h)
00118    {
00119       iHeight=h;
00120    }
00121 */   
00126    inline int height() const
00127    {
00128       return iHeight;
00129    }
00133    inline int y() const
00134    {
00135       return skipTop;
00136    }
00141    inline void setSpacing(int s)
00142    {
00143       iSpacing=s;
00144    }
00149    inline int spacing() const
00150    {
00151       return iSpacing;
00152    }
00153 
00157    int   stringWidth(const QString &s) const;
00158 
00159 
00163    QColor backgroundColor() const
00164    {
00165       return iBackColor;
00166    }
00167 
00168 private:
00169 
00170    void initGeneric();
00171    void initFromCustomImage(QColor c);
00172    bool initFromCustomFont(const QFont &f, QColor fc, QColor bc);
00173 
00174    void copyFont(const ZFont &);
00175 
00176    int   iOffset[256-32];        // offset of each letter
00177    int   iWidth[256-32];         // width of each letter
00178    int   iHeight;             // total height of the font
00179 
00180    int   skipTop;             // how  many pixels to skip from top
00181    int   iSpacing;
00182    QColor iBackColor;
00183 
00184 };                    
00185 
00186 #endif // INPUT_DIALOG_H
00187 

Generated on Mon Feb 24 21:00:44 2003 for ZSurface by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002