Tulip  4.1.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
TulipFont.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 
22 #ifndef TULIPFONT_H
23 #define TULIPFONT_H
24 
25 #include <QtCore/QObject>
26 #include <QtCore/QString>
27 #include <QtCore/QMap>
28 #include <QtCore/QList>
29 #include <tulip/tulipconf.h>
30 
31 namespace tlp {
32 
33 class TLP_QT_SCOPE TulipFont : public QObject {
34  static QMap<QString,int> FONT_IDS;
35  static int fontId(const QString&);
36 
37  Q_OBJECT
38  Q_PROPERTY(bool bold READ isBold WRITE setBold)
39  bool _bold;
40  Q_PROPERTY(bool italic READ isItalic WRITE setItalic)
41  bool _italic;
42  Q_PROPERTY(QString fontName READ fontName WRITE setFontName)
43  QString _fontName;
44  Q_PROPERTY(QString fontFile READ fontFile)
45  QString _fontFile;
46  Q_PROPERTY(bool exists READ exists)
47  Q_PROPERTY(int fontId READ fontId)
48  Q_PROPERTY(QString fontFamily READ fontFamily)
49 
50  void refreshFontFile();
51 public:
52 
53  static QString tulipFontsDirectory();
54  static QStringList installedFontNames();
55  static TulipFont fromFile(const QString&);
56 
57  explicit TulipFont(QObject *parent = NULL);
58  explicit TulipFont(const QString fontName, QObject *parent = NULL);
59  TulipFont(const TulipFont&);
60 
61  TulipFont& operator =(const TulipFont&);
62  bool isBold() const;
63  bool isItalic() const;
64  QString fontName() const;
65  QString fontFile() const;
66  bool exists() const;
67  int fontId() const;
68  QString fontFamily() const;
69 
70 public slots:
71  void setItalic(bool);
72  void setBold(bool);
73  void setFontName(const QString&);
74 };
75 
76 }
77 
78 #endif // TULIPFONT_H
79 ///@endcond