]> Shamusworld >> Repos - architektonas/blob - src/base/font.h
Initial removal of unnecessary rs_ prefixes from files.
[architektonas] / src / base / font.h
1 #ifndef __FONT_H__
2 #define __FONT_H__
3
4 #include <iostream>
5 #include <QtCore>
6 #include "blocklist.h"
7
8 /**
9  * Class for representing a font. This is implemented as a Drawing
10  * with a name (the font name) and several blocks, one for each letter
11  * in the font.
12  *
13  * @author Andrew Mustun
14  */
15 class RS_Font
16 {
17     friend class RS_FontList;
18
19         public:
20                 RS_Font(const QString & name, bool owner = true);
21
22                 QString getFileName() const;
23                 QString getEncoding() const;
24                 const QStringList & getNames() const;
25                 const QStringList & getAuthors() const;
26                 double getLetterSpacing();
27                 double getWordSpacing();
28                 double getLineSpacingFactor();
29                 bool loadFont();
30
31                 // Wrappers for block list (letters) functions
32                 RS_BlockList * getLetterList();
33                 RS_Block * findLetter(const QString & name);
34                 uint countLetters();
35                 RS_Block * letterAt(uint i);
36
37                 friend std::ostream & operator<<(std::ostream & os, const RS_Font & l);
38
39 #if 1
40         private:
41                 void ParseIdentifier(QTextStream &, QString);
42                 void ParseCharacter(QTextStream &, QString);
43 #endif
44
45         private:
46                 //! block list (letters)
47                 RS_BlockList letterList;
48                 //! Font file name
49                 QString fileName;
50                 //! Font encoding (see docu for QTextCodec)
51                 QString encoding;
52                 //! Font names
53                 QStringList names;
54                 //! Authors
55                 QStringList authors;
56                 //! Is this font currently loaded into memory?
57                 bool loaded;
58                 //! Default letter spacing for this font
59                 double letterSpacing;
60                 //! Default word spacing for this font
61                 double wordSpacing;
62                 //! Default line spacing factor for this font
63                 double lineSpacingFactor;
64 };
65
66 #endif