]> Shamusworld >> Repos - architektonas/blob - src/base/rs_font.h
3b6d21cac927ffd0f5afef0274d523179207da66
[architektonas] / src / base / rs_font.h
1 #ifndef RS_FONT_H
2 #define RS_FONT_H
3
4 #include <iostream>
5 #include <QtCore>
6 #include "rs_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                 //RS_Font(const char* name);
22
23                 QString getFileName() const;
24                 QString getEncoding() const;
25                 const QStringList & getNames() const;
26                 const QStringList & getAuthors() const;
27                 double getLetterSpacing();
28                 double getWordSpacing();
29                 double getLineSpacingFactor();
30                 bool loadFont();
31
32                 // Wrappers for block list (letters) functions
33                 RS_BlockList * getLetterList();
34                 RS_Block * findLetter(const QString & name);
35                 uint countLetters();
36                 RS_Block * letterAt(uint i);
37
38                 friend std::ostream & operator<<(std::ostream & os, const RS_Font & l);
39
40         private:
41                 //! block list (letters)
42                 RS_BlockList letterList;
43                 //! Font file name
44                 QString fileName;
45                 //! Font encoding (see docu for QTextCodec)
46                 QString encoding;
47                 //! Font names
48                 QStringList names;
49                 //! Authors
50                 QStringList authors;
51                 //! Is this font currently loaded into memory?
52                 bool loaded;
53                 //! Default letter spacing for this font
54                 double letterSpacing;
55                 //! Default word spacing for this font
56                 double wordSpacing;
57                 //! Default line spacing factor for this font
58                 double lineSpacingFactor;
59 };
60
61 #endif