Back to index

scribus-ng  1.3.4.dfsg+svn20071115
ftface.h
Go to the documentation of this file.
00001 #ifndef FT_FACE_H
00002 #define FT_FACE_H
00003 
00004 
00005 #include <qstring.h>
00006 //#include <qvector.h>
00007 #include <qmap.h>
00008 //#include <qarray.h>
00009 
00010 #include "scribusapi.h"
00011 
00012 #include "fonts/scface.h"
00013 
00014 #include <ft2build.h>
00015 #include FT_FREETYPE_H
00016 
00017 #include "fpointarray.h"
00018 
00019 FT_Error ftIOFunc( FT_Stream stream, unsigned long pos, unsigned char* buffer, unsigned long count);
00020 
00021 
00049 struct SCRIBUS_API FtFace : public ScFace::ScFaceData
00050 {
00051 
00052        FtFace(QString fam, QString sty, QString variant, QString scname, 
00053                  QString psname, QString path, int face);
00054        
00055        FT_Face ftFace() const;
00056 
00057        virtual ~FtFace();
00058        
00059        // font metrics
00060        double ascent(double sz=1.0)    const { return m_ascent * sz; }
00061        double descent(double sz=1.0)   const { return m_descent * sz; }
00062        double xHeight(double sz=1.0)   const { return m_xHeight * sz; }
00063        double capHeight(double sz=1.0) const { return m_capHeight * sz; }
00064        double height(double sz=1.0)    const { return m_height * sz; }
00065        double strikeoutPos(double sz=1.0)    const { return m_strikeoutPos * sz; }
00066        double underlinePos(double sz=1.0)    const { return m_underlinePos * sz; }
00067        double strokeWidth(double /*sz*/)     const { return m_strokeWidth; }
00068        double maxAdvanceWidth(double sz=1.0) const { return m_maxAdvanceWidth * sz; }
00069        QString ascentAsString()    const { return Ascent; }
00070        QString descentAsString()    const { return Descender; }
00071        QString capHeightAsString()    const { return CapHeight; }
00072        QString FontBBoxAsString()    const { return FontBBox; }
00073        QString ItalicAngleAsString()    const { return ItalicAngle; }
00074        
00075        
00076 //FIXME       QMap<QString,QString> fontDictionary(double sz=1.0)      const;
00077        
00078        uint         char2CMap(QChar ch)                         const;
00079 
00080        double       glyphKerning (uint gl1, uint gl2, double sz) const;
00081 //     GlyphMetrics glyphBBox (uint gl,               double sz) const;
00082 
00083        void RawData   (QByteArray & bb)            const;
00084        bool glyphNames(QMap<uint, std::pair<QChar, QString> >& GList) const;
00085        void load      ()                           const;
00086        void unload    ()                           const;
00087        void loadGlyph (uint ch)                    const;
00088 
00089 protected:
00090        mutable FT_Face m_face;
00091        
00092        static FT_Library library;
00093 
00094        mutable QString Ascent;
00095        mutable QString CapHeight;
00096        mutable QString Descender;
00097        mutable QString ItalicAngle;
00098        mutable QString StdVW;
00099        QString FontEnc;
00100        mutable QString FontBBox;
00101 
00102        mutable int m_encoding;
00103        
00104        mutable double m_uniEM;
00105        mutable double m_ascent;
00106        mutable double m_descent;
00107        mutable double m_height;
00108        mutable double m_xHeight;
00109        mutable double m_capHeight;
00110        mutable double m_maxAdvanceWidth;
00111        mutable double m_underlinePos;
00112        mutable double m_strikeoutPos;
00113        mutable double m_strokeWidth;
00114        
00115 };
00116 
00117 #endif