QCAD Application Framework
CAD Application Development and Automation.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RFont.h
Go to the documentation of this file.
1 #ifndef RFONT_H
2 #define RFONT_H
3 
4 #include <QMetaType>
5 #include <QChar>
6 #include <QMap>
7 #include <QPainterPath>
8 #include <QString>
9 #include <QStringList>
10 
11 
18 class RFont {
19 public:
20  RFont();
21  RFont(const QString& fileName);
22  ~RFont();
23 
24  bool isValid() const {
25  return !fileName.isEmpty();
26  }
27 
29  QString getFileName() const {
30  return fileName;
31  }
32 
34  QString getEncoding() const {
35  return encoding;
36  }
37 
39  const QStringList getNames() const {
40  return names;
41  }
42 
44  const QStringList getAuthors() const {
45  return authors;
46  }
47 
49  double getLetterSpacing() const {
50  return letterSpacing;
51  }
52 
54  double getWordSpacing() const {
55  return wordSpacing;
56  }
57 
59  double getLineSpacingFactor() const {
60  return lineSpacingFactor;
61  }
62 
63  bool load();
64 
68  bool isLoaded() const {
69  return loaded;
70  }
71 
75  QMap<QChar, QPainterPath> getGlyphMap() const {
76  return glyphMap;
77  }
78 
82  QPainterPath getGlyph(const QChar& ch, bool draft = false) const;
83 
84  //int countGlyphs() {
85  // return glyphMap.count();
86  //}
87 
88  //QPainterPath glyphAt(int i) {
89  // return glyphMap.values()
90  //}
91 
92 private:
94  QMap<QChar, QPainterPath> glyphMap;
95  QMap<QChar, QPainterPath> glyphDraftMap;
96 
98  QString fileName;
99 
101  QString encoding;
102 
104  QStringList names;
105 
107  QStringList authors;
108 
110  bool loaded;
111 
114 
116  double wordSpacing;
117 
120 };
121 
124 
125 #endif