Subversion Repositories Scribus

Rev

Rev 5980 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4430 cbradney 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
3 paul 7
#ifndef SCFONTS_H
8
#define SCFONTS_H
9
 
10
#include <qstring.h>
11
#include <qstrlist.h>
2508 fschmid 12
#include <qstringlist.h>
3 paul 13
#include <qdict.h>
6079 fschmid 14
//#include <qvector.h>
3 paul 15
#include <qfont.h>
70 Franz 16
#include <qmap.h>
3559 fschmid 17
#include <qdatetime.h>
494 fschmid 18
#include <ft2build.h>
19
#include FT_FREETYPE_H
20
#include FT_OUTLINE_H
21
#include FT_GLYPH_H
5318 avox 22
 
5980 avox 23
 
5318 avox 24
FT_Error ftIOFunc( FT_Stream fts, unsigned long offset, unsigned char* buffer, unsigned long count);
25
 
70 Franz 26
// #include <qpixmap.h>
2969 craig 27
 
28
#include "scribusapi.h"
70 Franz 29
#include "fpointarray.h"
2688 craig 30
#include "scconfig.h"
3 paul 31
 
5980 avox 32
#include "fonts/scface.h"
5691 avox 33
 
5385 subik 34
/*! \brief Main class SCFonts.
5980 avox 35
Subclass of QDict<ScFace>.
5385 subik 36
This class replaces the previous SCFonts typedef, and is nearly as convenient.
37
The chief difference from the application point of view is that while data can
38
still be retrieved with SCFonts[fontname], this cannot be used to add members.
39
Since the only piece of code that will generally add members is scfonts.h, this
40
is not a major problem.
3 paul 41
*/
5980 avox 42
class SCRIBUS_API SCFonts : public QMap<QString,ScFace>
3 paul 43
{
44
        public:
3559 fschmid 45
                SCFonts();
3 paul 46
                ~SCFonts();
2508 fschmid 47
                void updateFontMap();
2295 cbradney 48
                void GetFonts(QString pf, bool showFontInfo=false);
494 fschmid 49
                void AddScalableFonts(const QString &path, QString DocName = "");
50
                void removeFont(QString name);
2508 fschmid 51
                QMap<QString, QStringList> fontMap;
3 paul 52
        private:
3559 fschmid 53
                void ReadCacheList(QString pf);
54
                void WriteCacheList(QString pf);
3 paul 55
                void AddPath(QString p);
494 fschmid 56
                bool AddScalableFont(QString filename, FT_Library &library, QString DocName);
3 paul 57
                void AddUserPath(QString pf);
776 fschmid 58
#ifdef HAVE_FONTCONFIG
59
                void AddFontconfigFonts();
60
#else
2295 cbradney 61
#ifndef QT_MAC
3 paul 62
                void AddXFontServerPath();
63
                void AddXFontPath();
776 fschmid 64
#endif
2295 cbradney 65
#endif
3 paul 66
                QStrList FontPath;
67
                QString ExtraPath;
3559 fschmid 68
                struct testCache
69
                {
70
                        bool isOK;
71
                        bool isChecked;
72
                        QDateTime lastMod;
73
                };
74
                QMap<QString, testCache> checkedFonts;
2295 cbradney 75
        protected:
76
                bool showFontInformation;
3 paul 77
};
78
 
5980 avox 79
struct SCFontsIterator
80
{
81
        SCFontsIterator(SCFonts& fonts): it(fonts.begin()), end_it(fonts.end())
82
        {}
83
        ScFace& current()          { return *it; }
84
        QString currentKey() const { return it.key(); }
85
        bool hasNext()       const { return it != end_it; }
86
        ScFace& next()             { ++it; return current(); }
3 paul 87
 
5980 avox 88
private:
89
        QMap<QString,ScFace>::Iterator it, end_it;
90
};
91
 
3 paul 92
#endif