SGL
gfont.h
1 /*
2  * File: gfont.h
3  * -------------
4  *
5  * @author Marty Stepp
6  * @version 2019/04/30
7  * - added changeFontSize for a GText*
8  * @version 2018/09/07
9  * - added doc comments for new documentation generation
10  * @version 2018/08/23
11  * - renamed to gfont.h to replace Java version
12  * @version 2018/07/05
13  * - initial version
14  */
15 
16 
17 #ifndef _gfont_h
18 #define _gfont_h
19 
20 #include <string>
21 #include <QFont>
22 
23 #include "ginteractor.h"
24 #include "gobjects.h"
25 
38 class GFont {
39 public:
45  static void boldFont(GInteractor* interactor);
46 
52  static void changeFontSize(GInteractor* interactor, int dsize);
53 
59  static void changeFontSize(GText* label, int dsize);
60 
66  static QFont changeFontSize(const QFont& font, int dsize);
67 
72  static QFont deriveQFont(const QFont& font, QFont::Weight weight = QFont::Normal, int size = -1);
73 
78  static QFont deriveQFont(const QFont& font, const string& fontFamily, QFont::Weight weight = QFont::Normal, int size = -1);
79 
85  static QFont deriveQFont(const string& font, QFont::Weight weight = QFont::Normal, int size = -1);
86 
92  static QFont deriveQFont(const string& font, const string& fontFamily, QFont::Weight weight = QFont::Normal, int size = -1);
93 
99  static void italicFont(GInteractor* interactor);
100 
105  static string toFontString(const QFont& font);
106 
110  static QFont toQFont(const string& fontString);
111 
117  static QFont toQFont(const QFont& basisFont, const string& fontString);
118 
119 private:
120  GFont(); // prevent construction
121  static QFont::StyleHint getStyleHint(const string& fontFamily);
122 };
123 
124 #endif // _gfont_h
static void changeFontSize(GInteractor *interactor, int dsize)
Modifies the font of the given interactor, changing its size by the given number of points...
Definition: gfont.cpp:39
static QFont deriveQFont(const QFont &font, QFont::Weight weight=QFont::Normal, int size=-1)
Modifies the given font object, changing its weight and/or size to the given values, and returning the new modified font.
Definition: gfont.cpp:56
This graphical object subclass represents a text string.
Definition: gobjects.h:1442
static void italicFont(GInteractor *interactor)
Makes the given interactor&#39;s font italic.
Definition: gfont.cpp:105
This abstract class is the superclass for all graphical interactors.
Definition: ginteractor.h:48
This class contains static methods for dealing with fonts in our GUI system.
Definition: gfont.h:38
static string toFontString(const QFont &font)
Converts the given Qt font object into a font string such as "Helvetica-12-Bold". ...
Definition: gfont.cpp:114
static void boldFont(GInteractor *interactor)
Makes the given interactor&#39;s font bold.
Definition: gfont.cpp:33
static QFont toQFont(string fontString)
Converts a font string such as "Helvetica-12-Bold" into a Qt font object.
Definition: gfont.cpp:155