QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
RFont.h
Go to the documentation of this file.
1
20#ifndef RFONT_H
21#define RFONT_H
22
23#include "core_global.h"
24
25#include <QChar>
26#include <QList>
27#include <QMap>
28#include <QMetaType>
29#include <QPainterPath>
30#include <QString>
31#include <QStringList>
32
33#include "RPainterPath.h"
34
42public:
43 RFont();
44 RFont(const QString& fileName);
45 ~RFont();
46
47 bool isValid() const {
48 return !fileName.isEmpty();
49 }
50
52 QString getFileName() const {
53 return fileName;
54 }
55
57 QString getEncoding() const {
58 return encoding;
59 }
60
62 const QStringList getNames() const {
63 return names;
64 }
65
67 const QStringList getAuthors() const {
68 return authors;
69 }
70
72 double getLetterSpacing() const {
73 return letterSpacing;
74 }
75
77 double getWordSpacing() const {
78 return wordSpacing;
79 }
80
82 double getLineSpacingFactor() const {
83 return lineSpacingFactor;
84 }
85
86 QList<double> getAuxLinePositions() const {
87 return auxLinePositions;
88 }
89
90 QString getAuxLinePositionsString() const {
91 QStringList ret;
92 for (int i=0; i<auxLinePositions.length(); i++) {
93 ret.append(QString("%1").arg(auxLinePositions[i]));
94 }
95 return ret.join(",");
96 }
97
98 bool load();
99
103 bool isLoaded() const {
104 return loaded;
105 }
106
111 return glyphMap;
112 }
113
114 QList<QChar> getGlyphNames() const {
115 return glyphMap.keys();
116 }
117
118 RPainterPath getGlyph(const QChar& ch, bool draft = false) const;
119
120 QList<QString> getShapeNames() const {
121 return shapeMap.keys();
122 }
123
124 RPainterPath getShape(const QString& name) const;
125
129 QString getShapeName(const QChar& ch) const;
130
131 //int countGlyphs() {
132 // return glyphMap.count();
133 //}
134
135 //QPainterPath glyphAt(int i) {
136 // return glyphMap.values()
137 //}
138
139private:
146
148 QString fileName;
149
151 QString encoding;
152
154 QStringList names;
155
157 QStringList authors;
158
160 bool loaded;
161
164
167
170
172 QList<double> auxLinePositions;
173};
174
177
178#endif
Q_DECLARE_METATYPE(RMath *)
int i
Copyright (c) 2011-2018 by Andrew Mustun.
Definition autostart.js:32
Definition RDebug.h:38
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RFont.h:41
QMap< QChar, QPainterPath > glyphDraftMap
Definition RFont.h:145
QMap< QChar, RPainterPath > glyphMap
list of glyphs as painter paths (letters)
Definition RFont.h:141
QList< double > auxLinePositions
Aux line positions for CXF editing.
Definition RFont.h:172
bool isLoaded() const
Definition RFont.h:103
QMap< QChar, QString > numNameMap
Definition RFont.h:144
double getLetterSpacing() const
Definition RFont.h:72
QString fileName
Font file name.
Definition RFont.h:148
double letterSpacing
Default letter spacing for this font.
Definition RFont.h:163
QString getEncoding() const
Definition RFont.h:57
QList< double > getAuxLinePositions() const
Definition RFont.h:86
QStringList authors
Authors.
Definition RFont.h:157
double wordSpacing
Default word spacing for this font.
Definition RFont.h:166
QStringList names
Font names.
Definition RFont.h:154
double getWordSpacing() const
Definition RFont.h:77
double lineSpacingFactor
Default line spacing factor for this font.
Definition RFont.h:169
bool loaded
Is this font currently loaded into memory?
Definition RFont.h:160
QMap< QChar, RPainterPath > getGlyphMap() const
Definition RFont.h:110
QMap< QString, RPainterPath > shapeMap
list of shapes (used for complex line types)
Definition RFont.h:143
QString getAuxLinePositionsString() const
Definition RFont.h:90
const QStringList getAuthors() const
Definition RFont.h:67
QString encoding
Font encoding (see docu for QTextCodec)
Definition RFont.h:151
const QStringList getNames() const
Definition RFont.h:62
bool isValid() const
Definition RFont.h:47
QList< QString > getShapeNames() const
Definition RFont.h:120
double getLineSpacingFactor() const
Definition RFont.h:82
QList< QChar > getGlyphNames() const
Definition RFont.h:114
QString getFileName() const
Definition RFont.h:52
Extended painter path with a z-level and a pen.
Definition RPainterPath.h:48
#define QCADCORE_EXPORT
Definition core_global.h:10