Tulip  4.8.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
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 <QObject>
26 #include <QMap>
27 
28 #include <tulip/tulipconf.h>
29 
30 namespace tlp {
31 
32 class TLP_QT_SCOPE TulipFont : public QObject {
33  static QMap<QString,int> FONT_IDS;
34  static int fontId(const QString&);
35 
36  Q_OBJECT
37  Q_PROPERTY(bool bold READ isBold WRITE setBold)
38  bool _bold;
39  Q_PROPERTY(bool italic READ isItalic WRITE setItalic)
40  bool _italic;
41  Q_PROPERTY(QString fontName READ fontName WRITE setFontName)
42  QString _fontName;
43  Q_PROPERTY(QString fontFile READ fontFile)
44  QString _fontFile;
45  Q_PROPERTY(bool exists READ exists)
46  Q_PROPERTY(int fontId READ fontId)
47  Q_PROPERTY(QString fontFamily READ fontFamily)
48 
49  void refreshFontFile();
50 public:
51 
52  static QString tulipFontsDirectory();
53  static QStringList installedFontNames();
54  static TulipFont fromFile(const QString&);
55 
56  explicit TulipFont(QObject *parent = NULL);
57  explicit TulipFont(const QString fontName, QObject *parent = NULL);
58  TulipFont(const TulipFont&);
59 
60  TulipFont& operator=(const TulipFont&);
61  bool isBold() const;
62  bool isItalic() const;
63  QString fontName() const;
64  QString fontFile() const;
65  bool exists() const;
66  int fontId() const;
67  QString fontFamily() const;
68 
69 public slots:
70  void setItalic(bool);
71  void setBold(bool);
72  void setFontName(const QString&);
73 };
74 
75 }
76 
77 #endif // TULIPFONT_H
78 ///@endcond