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